diff --git a/cobalt/browser/web_module.cc b/cobalt/browser/web_module.cc index 7713adf1eae7..313a99047a1a 100644 --- a/cobalt/browser/web_module.cc +++ b/cobalt/browser/web_module.cc @@ -452,7 +452,7 @@ class WebModule::Impl { // Used to avoid a deadlock when running |Impl::Pause| while waiting for the // web debugger to connect. - starboard::atomic_bool* waiting_for_web_debugger_; + std::atomic_bool* waiting_for_web_debugger_; // Interface to report behaviour relevant to the web debugger. debug::backend::DebuggerHooksImpl debugger_hooks_; diff --git a/cobalt/browser/web_module.h b/cobalt/browser/web_module.h index 179e12a8d096..82aa422acd7d 100644 --- a/cobalt/browser/web_module.h +++ b/cobalt/browser/web_module.h @@ -15,6 +15,7 @@ #ifndef COBALT_BROWSER_WEB_MODULE_H_ #define COBALT_BROWSER_WEB_MODULE_H_ +#include #include #include #include @@ -424,7 +425,7 @@ class WebModule : public base::CurrentThread::DestructionObserver, int dom_max_element_depth, float layout_refresh_rate, const scoped_refptr& ui_nav_root, #if defined(ENABLE_DEBUGGER) - starboard::atomic_bool* waiting_for_web_debugger, + std::atomic_bool* waiting_for_web_debugger, #endif // defined(ENABLE_DEBUGGER) base::WaitableEvent* synchronous_loader_interrupt, const Options& options) @@ -464,7 +465,7 @@ class WebModule : public base::CurrentThread::DestructionObserver, float layout_refresh_rate; scoped_refptr ui_nav_root; #if defined(ENABLE_DEBUGGER) - starboard::atomic_bool* waiting_for_web_debugger; + std::atomic_bool* waiting_for_web_debugger; #endif // defined(ENABLE_DEBUGGER) base::WaitableEvent* synchronous_loader_interrupt; Options options; @@ -503,7 +504,7 @@ class WebModule : public base::CurrentThread::DestructionObserver, #if defined(ENABLE_DEBUGGER) // Used to avoid a deadlock when running |Blur| while waiting for the web // debugger to connect. Initializes to false. - starboard::atomic_bool waiting_for_web_debugger_; + std::atomic_bool waiting_for_web_debugger_; #endif // defined(ENABLE_DEBUGGER) // This event is used to interrupt the loader when JavaScript is loaded diff --git a/cobalt/loader/net_fetcher.h b/cobalt/loader/net_fetcher.h index f2b1e4dde08a..e159ebfd5038 100644 --- a/cobalt/loader/net_fetcher.h +++ b/cobalt/loader/net_fetcher.h @@ -15,6 +15,7 @@ #ifndef COBALT_LOADER_NET_FETCHER_H_ #define COBALT_LOADER_NET_FETCHER_H_ +#include #include #include @@ -132,7 +133,7 @@ class NetFetcher : public Fetcher, scoped_refptr const task_runner_; bool skip_fetch_intercept_; - starboard::atomic_bool will_destroy_current_task_runner_; + std::atomic_bool will_destroy_current_task_runner_; bool main_resource_; DISALLOW_COPY_AND_ASSIGN(NetFetcher); diff --git a/cobalt/media/decoder_buffer_allocator.h b/cobalt/media/decoder_buffer_allocator.h index 16afc8d3560e..2790c7344e53 100644 --- a/cobalt/media/decoder_buffer_allocator.h +++ b/cobalt/media/decoder_buffer_allocator.h @@ -15,6 +15,7 @@ #ifndef COBALT_MEDIA_DECODER_BUFFER_ALLOCATOR_H_ #define COBALT_MEDIA_DECODER_BUFFER_ALLOCATOR_H_ +#include #include #include "base/compiler_specific.h" @@ -75,7 +76,7 @@ class DecoderBufferAllocator : public ::media::DecoderBuffer::Allocator, int max_buffer_capacity_ = 0; // Monitor memory allocation and use when |using_memory_pool_| is false - starboard::atomic_int32_t sbmemory_bytes_used_; + std::atomic_int32_t sbmemory_bytes_used_; }; } // namespace media diff --git a/cobalt/network/disk_cache/resource_type.cc b/cobalt/network/disk_cache/resource_type.cc index fe2ae4fb1377..2fd5103d67c5 100644 --- a/cobalt/network/disk_cache/resource_type.cc +++ b/cobalt/network/disk_cache/resource_type.cc @@ -14,6 +14,8 @@ #include "cobalt/network/disk_cache/resource_type.h" +#include + #include "base/logging.h" namespace cobalt { @@ -85,27 +87,24 @@ namespace settings { namespace { -starboard::atomic_int32_t other_quota = - starboard::atomic_int32_t(defaults::GetQuota(kOther)); -starboard::atomic_int32_t html_quota = - starboard::atomic_int32_t(defaults::GetQuota(kHTML)); -starboard::atomic_int32_t css_quota = - starboard::atomic_int32_t(defaults::GetQuota(kCSS)); -starboard::atomic_int32_t image_quota = - starboard::atomic_int32_t(defaults::GetQuota(kImage)); -starboard::atomic_int32_t font_quota = - starboard::atomic_int32_t(defaults::GetQuota(kFont)); -starboard::atomic_int32_t splash_screen_quota = - starboard::atomic_int32_t(defaults::GetQuota(kSplashScreen)); -starboard::atomic_int32_t uncompiled_script_quota = - starboard::atomic_int32_t(defaults::GetQuota(kUncompiledScript)); -starboard::atomic_int32_t compiled_script_quota = - starboard::atomic_int32_t(defaults::GetQuota(kCompiledScript)); -starboard::atomic_int32_t cache_api_quota = - starboard::atomic_int32_t(defaults::GetQuota(kCacheApi)); -starboard::atomic_int32_t service_worker_script_quota = - starboard::atomic_int32_t(defaults::GetQuota(kServiceWorkerScript)); -starboard::atomic_bool cache_enabled = starboard::atomic_bool(true); +std::atomic_int32_t other_quota = + std::atomic_int32_t(defaults::GetQuota(kOther)); +std::atomic_int32_t html_quota = std::atomic_int32_t(defaults::GetQuota(kHTML)); +std::atomic_int32_t css_quota = std::atomic_int32_t(defaults::GetQuota(kCSS)); +std::atomic_int32_t image_quota = + std::atomic_int32_t(defaults::GetQuota(kImage)); +std::atomic_int32_t font_quota = std::atomic_int32_t(defaults::GetQuota(kFont)); +std::atomic_int32_t splash_screen_quota = + std::atomic_int32_t(defaults::GetQuota(kSplashScreen)); +std::atomic_int32_t uncompiled_script_quota = + std::atomic_int32_t(defaults::GetQuota(kUncompiledScript)); +std::atomic_int32_t compiled_script_quota = + std::atomic_int32_t(defaults::GetQuota(kCompiledScript)); +std::atomic_int32_t cache_api_quota = + std::atomic_int32_t(defaults::GetQuota(kCacheApi)); +std::atomic_int32_t service_worker_script_quota = + std::atomic_int32_t(defaults::GetQuota(kServiceWorkerScript)); +std::atomic_bool cache_enabled = std::atomic_bool(true); } // namespace diff --git a/cobalt/updater/configurator.h b/cobalt/updater/configurator.h index 24b5f8064fdf..feea9ba1fee0 100644 --- a/cobalt/updater/configurator.h +++ b/cobalt/updater/configurator.h @@ -7,6 +7,7 @@ #include +#include #include #include #include @@ -114,7 +115,7 @@ class Configurator : public update_client::Configurator { std::string user_agent_string_; uint64_t min_free_space_bytes_ = 48 * 1024 * 1024; base::Lock min_free_space_bytes_lock_; - starboard::atomic_bool use_compressed_updates_; + std::atomic_bool use_compressed_updates_; DISALLOW_COPY_AND_ASSIGN(Configurator); }; diff --git a/cobalt/watchdog/watchdog.h b/cobalt/watchdog/watchdog.h index 2a452d20c623..f4b6150643ee 100644 --- a/cobalt/watchdog/watchdog.h +++ b/cobalt/watchdog/watchdog.h @@ -17,6 +17,7 @@ #include +#include #include #include #include @@ -198,7 +199,7 @@ class Watchdog : public Singleton { // Monitor thread. pthread_t watchdog_thread_; // Flag to stop monitor thread. - starboard::atomic_bool is_monitoring_; + std::atomic_bool is_monitoring_; // Conditional Variable to wait and shutdown monitor thread. starboard::ConditionVariable monitor_wait_ = starboard::ConditionVariable(mutex_); diff --git a/cobalt/worker/service_worker_jobs.cc b/cobalt/worker/service_worker_jobs.cc index ff010872cd62..ec726791e790 100644 --- a/cobalt/worker/service_worker_jobs.cc +++ b/cobalt/worker/service_worker_jobs.cc @@ -14,6 +14,12 @@ #include "cobalt/worker/service_worker_jobs.h" +<<<<<<< HEAD +======= +#include +#include + +>>>>>>> 9263496a5dc (Remove starboard/common/atomic usage above Starboard (#3252)) #include "base/bind.h" #include "base/strings/stringprintf.h" #include "base/task/current_thread.h" @@ -787,8 +793,7 @@ void ServiceWorkerJobs::Install( // Using a shared pointer because this flag is explicitly defined in the spec // to be modified from the worker's event loop, at asynchronous promise // completion that may occur after a timeout. - std::shared_ptr install_failed( - new starboard::atomic_bool(false)); + std::shared_ptr install_failed(new std::atomic_bool(false)); // 2. Let newestWorker be the result of running Get Newest Worker algorithm // passing registration as its argument. @@ -878,7 +883,7 @@ void ServiceWorkerJobs::Install( base::Bind( [](ServiceWorkerObject* installing_worker, base::WaitableEvent* done_event, - std::shared_ptr install_failed) { + std::shared_ptr install_failed) { // 11.3.1.1. Let e be the result of creating an event with // ExtendableEvent. // 11.3.1.2. Initialize e’s type attribute to install. @@ -895,7 +900,7 @@ void ServiceWorkerJobs::Install( // If task is discarded, set installFailed to true. auto done_callback = base::BindOnce( [](base::WaitableEvent* done_event, - std::shared_ptr install_failed, + std::shared_ptr install_failed, bool was_rejected) { if (was_rejected) install_failed->store(true); done_event->Signal(); diff --git a/cobalt/worker/service_worker_jobs.h b/cobalt/worker/service_worker_jobs.h index 62b5b9593094..0fb9530549e8 100644 --- a/cobalt/worker/service_worker_jobs.h +++ b/cobalt/worker/service_worker_jobs.h @@ -15,6 +15,7 @@ #ifndef COBALT_WORKER_SERVICE_WORKER_JOBS_H_ #define COBALT_WORKER_SERVICE_WORKER_JOBS_H_ +#include #include #include #include @@ -83,7 +84,7 @@ class ServiceWorkerJobs { bool is_pending() const { return is_pending_.load(); } private: - starboard::atomic_bool is_pending_{true}; + std::atomic_bool is_pending_{true}; std::unique_ptr promise_bool_reference_; std::unique_ptr diff --git a/cobalt/worker/service_worker_object.h b/cobalt/worker/service_worker_object.h index 7e70d0ceb78a..7f4d579671c5 100644 --- a/cobalt/worker/service_worker_object.h +++ b/cobalt/worker/service_worker_object.h @@ -15,6 +15,7 @@ #ifndef COBALT_WORKER_SERVICE_WORKER_OBJECT_H_ #define COBALT_WORKER_SERVICE_WORKER_OBJECT_H_ +#include #include #include #include @@ -196,7 +197,7 @@ class ServiceWorkerObject // https://www.w3.org/TR/2022/CRD-service-workers-20220712/#service-worker-start-status std::unique_ptr start_status_; - starboard::atomic_bool start_failed_; + std::atomic_bool start_failed_; scoped_refptr worker_global_scope_; diff --git a/cobalt/xhr/xml_http_request.h b/cobalt/xhr/xml_http_request.h index a4dacc218ddb..b6cbf651926e 100644 --- a/cobalt/xhr/xml_http_request.h +++ b/cobalt/xhr/xml_http_request.h @@ -15,6 +15,7 @@ #ifndef COBALT_XHR_XML_HTTP_REQUEST_H_ #define COBALT_XHR_XML_HTTP_REQUEST_H_ +#include #include #include #include @@ -347,7 +348,7 @@ class XMLHttpRequestImpl : public base::SupportsWeakPtr, bool upload_listener_; bool with_credentials_; XMLHttpRequest* xhr_; - starboard::atomic_bool will_destroy_current_task_runner_; + std::atomic_bool will_destroy_current_task_runner_; // A corspreflight instance for potentially sending preflight // request and performing cors check for all cross origin requests.