Bind non-Windows platform services explicitly
This commit is contained in:
@@ -259,11 +259,8 @@ public:
|
||||
void publish_exported_image(std::string_view path) override
|
||||
{
|
||||
const auto family = pp::platform::current_platform_family();
|
||||
if (pp::platform::legacy::handles_legacy_web_platform_family(family))
|
||||
{
|
||||
pp::platform::legacy::publish_legacy_web_exported_image(path);
|
||||
if (pp::platform::legacy::try_publish_legacy_web_exported_image(family, path))
|
||||
return;
|
||||
}
|
||||
if (!pp::platform::platform_publishes_exported_images(family))
|
||||
{
|
||||
(void)path;
|
||||
@@ -279,11 +276,8 @@ public:
|
||||
void flush_persistent_storage() override
|
||||
{
|
||||
const auto family = pp::platform::current_platform_family();
|
||||
if (pp::platform::legacy::handles_legacy_web_platform_family(family))
|
||||
{
|
||||
pp::platform::legacy::flush_legacy_web_persistent_storage();
|
||||
if (pp::platform::legacy::try_flush_legacy_web_persistent_storage(family))
|
||||
return;
|
||||
}
|
||||
if (!pp::platform::platform_flushes_persistent_storage(family))
|
||||
return;
|
||||
}
|
||||
@@ -449,8 +443,9 @@ public:
|
||||
[[nodiscard]] int default_canvas_resolution() override
|
||||
{
|
||||
const auto family = pp::platform::current_platform_family();
|
||||
if (pp::platform::legacy::handles_legacy_web_platform_family(family))
|
||||
return pp::platform::legacy::default_legacy_web_canvas_resolution();
|
||||
int resolution = 0;
|
||||
if (pp::platform::legacy::try_default_legacy_web_canvas_resolution(family, resolution))
|
||||
return resolution;
|
||||
return pp::platform::platform_default_canvas_resolution(family);
|
||||
}
|
||||
|
||||
@@ -527,11 +522,12 @@ public:
|
||||
pp::platform::PreparedFileCallback callback) override
|
||||
{
|
||||
const auto family = pp::platform::current_platform_family();
|
||||
if (pp::platform::legacy::handles_legacy_web_platform_family(family))
|
||||
{
|
||||
pp::platform::legacy::save_legacy_web_prepared_file(path, suggested_name, std::move(callback));
|
||||
if (pp::platform::legacy::try_save_legacy_web_prepared_file(
|
||||
family,
|
||||
path,
|
||||
suggested_name,
|
||||
std::move(callback)))
|
||||
return;
|
||||
}
|
||||
|
||||
const std::string value(path);
|
||||
const std::string name(suggested_name);
|
||||
|
||||
@@ -108,16 +108,47 @@ void publish_legacy_web_exported_image(std::string_view path)
|
||||
active_legacy_web_platform_services().publish_exported_image(path);
|
||||
}
|
||||
|
||||
[[nodiscard]] bool try_publish_legacy_web_exported_image(
|
||||
pp::platform::PlatformFamily family,
|
||||
std::string_view path)
|
||||
{
|
||||
if (!handles_legacy_web_platform_family(family))
|
||||
return false;
|
||||
|
||||
publish_legacy_web_exported_image(path);
|
||||
return true;
|
||||
}
|
||||
|
||||
void flush_legacy_web_persistent_storage()
|
||||
{
|
||||
active_legacy_web_platform_services().flush_persistent_storage();
|
||||
}
|
||||
|
||||
[[nodiscard]] bool try_flush_legacy_web_persistent_storage(pp::platform::PlatformFamily family)
|
||||
{
|
||||
if (!handles_legacy_web_platform_family(family))
|
||||
return false;
|
||||
|
||||
flush_legacy_web_persistent_storage();
|
||||
return true;
|
||||
}
|
||||
|
||||
[[nodiscard]] int default_legacy_web_canvas_resolution() noexcept
|
||||
{
|
||||
return active_legacy_web_platform_services().default_canvas_resolution();
|
||||
}
|
||||
|
||||
[[nodiscard]] bool try_default_legacy_web_canvas_resolution(
|
||||
pp::platform::PlatformFamily family,
|
||||
int& resolution) noexcept
|
||||
{
|
||||
if (!handles_legacy_web_platform_family(family))
|
||||
return false;
|
||||
|
||||
resolution = default_legacy_web_canvas_resolution();
|
||||
return true;
|
||||
}
|
||||
|
||||
void save_legacy_web_prepared_file(
|
||||
std::string_view path,
|
||||
std::string_view suggested_name,
|
||||
@@ -129,6 +160,19 @@ void save_legacy_web_prepared_file(
|
||||
std::move(callback));
|
||||
}
|
||||
|
||||
[[nodiscard]] bool try_save_legacy_web_prepared_file(
|
||||
pp::platform::PlatformFamily family,
|
||||
std::string_view path,
|
||||
std::string_view suggested_name,
|
||||
pp::platform::PreparedFileCallback callback)
|
||||
{
|
||||
if (!handles_legacy_web_platform_family(family))
|
||||
return false;
|
||||
|
||||
save_legacy_web_prepared_file(path, suggested_name, std::move(callback));
|
||||
return true;
|
||||
}
|
||||
|
||||
[[nodiscard]] const pp::platform::PlatformStoragePaths& active_legacy_storage_paths()
|
||||
{
|
||||
return retained_legacy_storage_paths().storage_paths;
|
||||
|
||||
@@ -24,12 +24,25 @@ void request_legacy_glfw_app_close();
|
||||
[[nodiscard]] pp::platform::WebPlatformServices& active_legacy_web_platform_services();
|
||||
[[nodiscard]] bool handles_legacy_web_platform_family(pp::platform::PlatformFamily family) noexcept;
|
||||
void publish_legacy_web_exported_image(std::string_view path);
|
||||
[[nodiscard]] bool try_publish_legacy_web_exported_image(
|
||||
pp::platform::PlatformFamily family,
|
||||
std::string_view path);
|
||||
void flush_legacy_web_persistent_storage();
|
||||
[[nodiscard]] bool try_flush_legacy_web_persistent_storage(
|
||||
pp::platform::PlatformFamily family);
|
||||
[[nodiscard]] int default_legacy_web_canvas_resolution() noexcept;
|
||||
[[nodiscard]] bool try_default_legacy_web_canvas_resolution(
|
||||
pp::platform::PlatformFamily family,
|
||||
int& resolution) noexcept;
|
||||
void save_legacy_web_prepared_file(
|
||||
std::string_view path,
|
||||
std::string_view suggested_name,
|
||||
pp::platform::PreparedFileCallback callback);
|
||||
[[nodiscard]] bool try_save_legacy_web_prepared_file(
|
||||
pp::platform::PlatformFamily family,
|
||||
std::string_view path,
|
||||
std::string_view suggested_name,
|
||||
pp::platform::PreparedFileCallback callback);
|
||||
|
||||
[[nodiscard]] const pp::platform::PlatformStoragePaths& active_legacy_storage_paths();
|
||||
void set_legacy_storage_paths(pp::platform::PlatformStoragePaths paths);
|
||||
|
||||
Reference in New Issue
Block a user