Move OneShotEvent into base/.
This CL moves the OneShotEvent primitive into base/, as it
now satisfies the rule of 3 (chromecast/, extensions/, chrome/).
[email protected], [email protected]
Bug: None
Change-Id: I52bea9524ee1f451d8c76d01869cbb382a738446
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1522498
Commit-Queue: calamity <[email protected]>
Reviewed-by: calamity <[email protected]>
Reviewed-by: danakj <[email protected]>
Cr-Commit-Position: refs/heads/master@{#647610}
diff --git a/base/BUILD.gn b/base/BUILD.gn
index 8c6f3ac0..a72bc5b1 100644
--- a/base/BUILD.gn
+++ b/base/BUILD.gn
@@ -538,6 +538,8 @@
"observer_list.h",
"observer_list_threadsafe.cc",
"observer_list_threadsafe.h",
+ "one_shot_event.cc",
+ "one_shot_event.h",
"optional.h",
"os_compat_android.cc",
"os_compat_android.h",
@@ -2489,6 +2491,7 @@
"no_destructor_unittest.cc",
"observer_list_threadsafe_unittest.cc",
"observer_list_unittest.cc",
+ "one_shot_event_unittest.cc",
"optional_unittest.cc",
"os_compat_android_unittest.cc",
"parameter_pack_unittest.cc",
diff --git a/extensions/common/one_shot_event.cc b/base/one_shot_event.cc
similarity index 69%
rename from extensions/common/one_shot_event.cc
rename to base/one_shot_event.cc
index 46cefec..addd0e1 100644
--- a/extensions/common/one_shot_event.cc
+++ b/base/one_shot_event.cc
@@ -2,29 +2,26 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "extensions/common/one_shot_event.h"
+#include "base/one_shot_event.h"
#include <stddef.h>
#include "base/callback.h"
#include "base/lazy_instance.h"
#include "base/location.h"
-#include "base/macros.h"
#include "base/single_thread_task_runner.h"
#include "base/task_runner.h"
#include "base/threading/thread_task_runner_handle.h"
#include "base/time/time.h"
-using base::SingleThreadTaskRunner;
-
-namespace extensions {
+namespace base {
struct OneShotEvent::TaskInfo {
TaskInfo() {}
- TaskInfo(const base::Location& from_here,
+ TaskInfo(const Location& from_here,
const scoped_refptr<SingleThreadTaskRunner>& runner,
- base::OnceClosure task,
- const base::TimeDelta& delay)
+ OnceClosure task,
+ const TimeDelta& delay)
: from_here(from_here),
runner(runner),
task(std::move(task)),
@@ -33,10 +30,10 @@
}
TaskInfo(TaskInfo&&) = default;
- base::Location from_here;
+ Location from_here;
scoped_refptr<SingleThreadTaskRunner> runner;
- base::OnceClosure task;
- base::TimeDelta delay;
+ OnceClosure task;
+ TimeDelta delay;
private:
DISALLOW_COPY_AND_ASSIGN(TaskInfo);
@@ -52,24 +49,22 @@
}
OneShotEvent::~OneShotEvent() {}
-void OneShotEvent::Post(const base::Location& from_here,
- base::OnceClosure task) const {
- PostImpl(from_here, std::move(task), base::ThreadTaskRunnerHandle::Get(),
- base::TimeDelta());
+void OneShotEvent::Post(const Location& from_here, OnceClosure task) const {
+ PostImpl(from_here, std::move(task), ThreadTaskRunnerHandle::Get(),
+ TimeDelta());
}
void OneShotEvent::Post(
- const base::Location& from_here,
- base::OnceClosure task,
+ const Location& from_here,
+ OnceClosure task,
const scoped_refptr<SingleThreadTaskRunner>& runner) const {
- PostImpl(from_here, std::move(task), runner, base::TimeDelta());
+ PostImpl(from_here, std::move(task), runner, TimeDelta());
}
-void OneShotEvent::PostDelayed(const base::Location& from_here,
- base::OnceClosure task,
- const base::TimeDelta& delay) const {
- PostImpl(from_here, std::move(task), base::ThreadTaskRunnerHandle::Get(),
- delay);
+void OneShotEvent::PostDelayed(const Location& from_here,
+ OnceClosure task,
+ const TimeDelta& delay) const {
+ PostImpl(from_here, std::move(task), ThreadTaskRunnerHandle::Get(), delay);
}
void OneShotEvent::Signal() {
@@ -98,10 +93,10 @@
DCHECK(tasks_.empty()) << "No new tasks should be added during task running!";
}
-void OneShotEvent::PostImpl(const base::Location& from_here,
- base::OnceClosure task,
+void OneShotEvent::PostImpl(const Location& from_here,
+ OnceClosure task,
const scoped_refptr<SingleThreadTaskRunner>& runner,
- const base::TimeDelta& delay) const {
+ const TimeDelta& delay) const {
DCHECK(thread_checker_.CalledOnValidThread());
if (is_signaled()) {
@@ -114,4 +109,4 @@
}
}
-} // namespace extensions
+} // namespace base
diff --git a/extensions/common/one_shot_event.h b/base/one_shot_event.h
similarity index 77%
rename from extensions/common/one_shot_event.h
rename to base/one_shot_event.h
index 591a75f..7649378 100644
--- a/extensions/common/one_shot_event.h
+++ b/base/one_shot_event.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef EXTENSIONS_COMMON_ONE_SHOT_EVENT_H_
-#define EXTENSIONS_COMMON_ONE_SHOT_EVENT_H_
+#ifndef BASE_ONE_SHOT_EVENT_H_
+#define BASE_ONE_SHOT_EVENT_H_
#include <vector>
@@ -14,23 +14,21 @@
#include "base/threading/thread_checker.h"
namespace base {
+
class Location;
class SingleThreadTaskRunner;
class TimeDelta;
-}
-
-namespace extensions {
// This class represents an event that's expected to happen once. It
// allows clients to guarantee that code is run after the OneShotEvent
// is signaled. If the OneShotEvent is destroyed before it's
-// signaled, the delayed closures are destroyed without being run.
+// signaled, the Onceclosure are destroyed without being run.
//
// This class is similar to a WaitableEvent combined with several
// WaitableEventWatchers, but using it is simpler.
//
// This class is not thread-safe, and must be used from a single thread.
-class OneShotEvent {
+class BASE_EXPORT OneShotEvent {
public:
OneShotEvent();
// Use the following constructor to create an already signaled event. This is
@@ -73,23 +71,23 @@
//
// Const because Post() doesn't modify the logical state of this
// object (which is just the is_signaled() bit).
- void Post(const base::Location& from_here, base::OnceClosure task) const;
- void Post(const base::Location& from_here,
- base::OnceClosure task,
- const scoped_refptr<base::SingleThreadTaskRunner>& runner) const;
- void PostDelayed(const base::Location& from_here,
- base::OnceClosure task,
- const base::TimeDelta& delay) const;
+ void Post(const Location& from_here, OnceClosure task) const;
+ void Post(const Location& from_here,
+ OnceClosure task,
+ const scoped_refptr<SingleThreadTaskRunner>& runner) const;
+ void PostDelayed(const Location& from_here,
+ OnceClosure task,
+ const TimeDelta& delay) const;
private:
struct TaskInfo;
- void PostImpl(const base::Location& from_here,
- base::OnceClosure task,
- const scoped_refptr<base::SingleThreadTaskRunner>& runner,
- const base::TimeDelta& delay) const;
+ void PostImpl(const Location& from_here,
+ OnceClosure task,
+ const scoped_refptr<SingleThreadTaskRunner>& runner,
+ const TimeDelta& delay) const;
- base::ThreadChecker thread_checker_;
+ ThreadChecker thread_checker_;
bool signaled_;
@@ -105,6 +103,6 @@
mutable std::vector<TaskInfo> tasks_;
};
-} // namespace extensions
+} // namespace base
-#endif // EXTENSIONS_COMMON_ONE_SHOT_EVENT_H_
+#endif // BASE_ONE_SHOT_EVENT_H_
diff --git a/extensions/common/one_shot_event_unittest.cc b/base/one_shot_event_unittest.cc
similarity index 96%
rename from extensions/common/one_shot_event_unittest.cc
rename to base/one_shot_event_unittest.cc
index f8e702ee..b873336 100644
--- a/extensions/common/one_shot_event_unittest.cc
+++ b/base/one_shot_event_unittest.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "extensions/common/one_shot_event.h"
+#include "base/one_shot_event.h"
#include "base/bind.h"
#include "base/message_loop/message_loop.h"
@@ -11,11 +11,11 @@
#include "base/test/test_simple_task_runner.h"
#include "testing/gtest/include/gtest/gtest.h"
-namespace extensions {
+namespace base {
-namespace {
-
-void Increment(int* i) { ++*i; }
+void Increment(int* i) {
+ ++*i;
+}
// |*did_delete_instance| will be set to true upon its destruction.
class RefCountedClass : public base::RefCounted<RefCountedClass> {
@@ -171,5 +171,4 @@
EXPECT_TRUE(did_delete_instance);
}
-} // namespace
-} // namespace extensions
+} // namespace base
diff --git a/chrome/browser/apps/platform_apps/shortcut_manager.cc b/chrome/browser/apps/platform_apps/shortcut_manager.cc
index 7acc62e..dc10435 100644
--- a/chrome/browser/apps/platform_apps/shortcut_manager.cc
+++ b/chrome/browser/apps/platform_apps/shortcut_manager.cc
@@ -8,6 +8,7 @@
#include "base/bind_helpers.h"
#include "base/command_line.h"
#include "base/compiler_specific.h"
+#include "base/one_shot_event.h"
#include "base/strings/string16.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/post_task.h"
@@ -28,7 +29,6 @@
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_system.h"
#include "extensions/common/extension_set.h"
-#include "extensions/common/one_shot_event.h"
using extensions::Extension;
diff --git a/chrome/browser/background/background_application_list_model.cc b/chrome/browser/background/background_application_list_model.cc
index 84bccb3c..8fa2e8b 100644
--- a/chrome/browser/background/background_application_list_model.cc
+++ b/chrome/browser/background/background_application_list_model.cc
@@ -9,6 +9,7 @@
#include <utility>
#include "base/bind.h"
+#include "base/one_shot_event.h"
#include "base/strings/string_number_conversions.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/background/background_contents_service.h"
@@ -33,7 +34,6 @@
#include "extensions/common/extension_set.h"
#include "extensions/common/manifest_handlers/background_info.h"
#include "extensions/common/manifest_handlers/icons_handler.h"
-#include "extensions/common/one_shot_event.h"
#include "extensions/common/permissions/permission_set.h"
#include "extensions/common/permissions/permissions_data.h"
#include "ui/base/l10n/l10n_util_collator.h"
diff --git a/chrome/browser/background/background_contents_service.cc b/chrome/browser/background/background_contents_service.cc
index f8c67a1..e3675ee 100644
--- a/chrome/browser/background/background_contents_service.cc
+++ b/chrome/browser/background/background_contents_service.cc
@@ -12,6 +12,7 @@
#include "base/location.h"
#include "base/macros.h"
#include "base/metrics/histogram_macros.h"
+#include "base/one_shot_event.h"
#include "base/single_thread_task_runner.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
@@ -49,7 +50,6 @@
#include "extensions/common/extension_set.h"
#include "extensions/common/manifest_handlers/background_info.h"
#include "extensions/common/manifest_handlers/icons_handler.h"
-#include "extensions/common/one_shot_event.h"
#include "extensions/grit/extensions_browser_resources.h"
#include "ipc/ipc_message.h"
#include "ui/base/l10n/l10n_util.h"
diff --git a/chrome/browser/background/background_mode_manager.cc b/chrome/browser/background/background_mode_manager.cc
index 6c7273c..3fadac56 100644
--- a/chrome/browser/background/background_mode_manager.cc
+++ b/chrome/browser/background/background_mode_manager.cc
@@ -19,6 +19,7 @@
#include "base/logging.h"
#include "base/metrics/histogram_macros.h"
#include "base/metrics/user_metrics.h"
+#include "base/one_shot_event.h"
#include "base/single_thread_task_runner.h"
#include "base/stl_util.h"
#include "base/strings/utf_string_conversions.h"
@@ -64,7 +65,6 @@
#include "extensions/common/constants.h"
#include "extensions/common/extension.h"
#include "extensions/common/manifest_handlers/options_page_info.h"
-#include "extensions/common/one_shot_event.h"
#include "extensions/common/permissions/permission_set.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
diff --git a/chrome/browser/chromeos/arc/boot_phase_monitor/arc_boot_phase_monitor_bridge.cc b/chrome/browser/chromeos/arc/boot_phase_monitor/arc_boot_phase_monitor_bridge.cc
index 2873ce2..fb0db8d 100644
--- a/chrome/browser/chromeos/arc/boot_phase_monitor/arc_boot_phase_monitor_bridge.cc
+++ b/chrome/browser/chromeos/arc/boot_phase_monitor/arc_boot_phase_monitor_bridge.cc
@@ -10,6 +10,7 @@
#include "base/logging.h"
#include "base/memory/singleton.h"
#include "base/metrics/histogram_macros.h"
+#include "base/one_shot_event.h"
#include "chrome/browser/chromeos/arc/arc_util.h"
#include "chrome/browser/chromeos/arc/boot_phase_monitor/arc_instance_throttle.h"
#include "chrome/browser/profiles/profile.h"
@@ -25,7 +26,6 @@
#include "extensions/browser/extension_system.h"
#include "extensions/browser/extension_system_provider.h"
#include "extensions/browser/extensions_browser_client.h"
-#include "extensions/common/one_shot_event.h"
namespace arc {
namespace {
diff --git a/chrome/browser/chromeos/lock_screen_apps/lock_screen_profile_creator_impl.cc b/chrome/browser/chromeos/lock_screen_apps/lock_screen_profile_creator_impl.cc
index c9b69c3..7309b3f 100644
--- a/chrome/browser/chromeos/lock_screen_apps/lock_screen_profile_creator_impl.cc
+++ b/chrome/browser/chromeos/lock_screen_apps/lock_screen_profile_creator_impl.cc
@@ -9,6 +9,7 @@
#include "base/bind.h"
#include "base/metrics/histogram_macros.h"
+#include "base/one_shot_event.h"
#include "base/strings/string16.h"
#include "base/time/tick_clock.h"
#include "base/time/time.h"
@@ -19,7 +20,6 @@
#include "components/prefs/pref_service.h"
#include "components/safe_browsing/common/safe_browsing_prefs.h"
#include "extensions/browser/extension_system.h"
-#include "extensions/common/one_shot_event.h"
namespace lock_screen_apps {
diff --git a/chrome/browser/extensions/activity_log/activity_log.cc b/chrome/browser/extensions/activity_log/activity_log.cc
index b3bf8f3..eace5296 100644
--- a/chrome/browser/extensions/activity_log/activity_log.cc
+++ b/chrome/browser/extensions/activity_log/activity_log.cc
@@ -15,6 +15,7 @@
#include "base/json/json_string_value_serializer.h"
#include "base/lazy_instance.h"
#include "base/logging.h"
+#include "base/one_shot_event.h"
#include "base/stl_util.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
@@ -52,7 +53,6 @@
#include "extensions/browser/extensions_browser_client.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_messages.h"
-#include "extensions/common/one_shot_event.h"
#include "third_party/re2/src/re2/re2.h"
#include "url/gurl.h"
diff --git a/chrome/browser/extensions/api/storage/managed_value_store_cache.cc b/chrome/browser/extensions/api/storage/managed_value_store_cache.cc
index ba3dfb2c..809b193b 100644
--- a/chrome/browser/extensions/api/storage/managed_value_store_cache.cc
+++ b/chrome/browser/extensions/api/storage/managed_value_store_cache.cc
@@ -13,6 +13,7 @@
#include "base/logging.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
+#include "base/one_shot_event.h"
#include "base/scoped_observer.h"
#include "base/task/post_task.h"
#include "chrome/browser/extensions/api/storage/policy_value_store.h"
@@ -41,7 +42,6 @@
#include "extensions/common/extension_set.h"
#include "extensions/common/manifest.h"
#include "extensions/common/manifest_constants.h"
-#include "extensions/common/one_shot_event.h"
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/profiles/profile_helper.h"
diff --git a/chrome/browser/extensions/chrome_process_manager_delegate.cc b/chrome/browser/extensions/chrome_process_manager_delegate.cc
index 6076a22..9d7ba9e9 100644
--- a/chrome/browser/extensions/chrome_process_manager_delegate.cc
+++ b/chrome/browser/extensions/chrome_process_manager_delegate.cc
@@ -6,6 +6,7 @@
#include "base/command_line.h"
#include "base/logging.h"
+#include "base/one_shot_event.h"
#include "build/build_config.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_notification_types.h"
@@ -21,7 +22,6 @@
#include "extensions/browser/process_manager.h"
#include "extensions/browser/process_manager_factory.h"
#include "extensions/common/extension.h"
-#include "extensions/common/one_shot_event.h"
#include "extensions/common/permissions/permissions_data.h"
#if defined(OS_CHROMEOS)
diff --git a/chrome/browser/extensions/extension_function_registration_test.cc b/chrome/browser/extensions/extension_function_registration_test.cc
index fe75530..8652e41 100644
--- a/chrome/browser/extensions/extension_function_registration_test.cc
+++ b/chrome/browser/extensions/extension_function_registration_test.cc
@@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/one_shot_event.h"
#include "chrome/browser/extensions/extension_browsertest.h"
#include "extensions/browser/extension_function_registry.h"
#include "extensions/browser/extension_system.h"
-#include "extensions/common/one_shot_event.h"
namespace extensions {
diff --git a/chrome/browser/extensions/extension_garbage_collector.cc b/chrome/browser/extensions/extension_garbage_collector.cc
index e3af0c2..e3b98bd 100644
--- a/chrome/browser/extensions/extension_garbage_collector.cc
+++ b/chrome/browser/extensions/extension_garbage_collector.cc
@@ -15,6 +15,7 @@
#include "base/files/file_util.h"
#include "base/location.h"
#include "base/logging.h"
+#include "base/one_shot_event.h"
#include "base/sequenced_task_runner.h"
#include "base/single_thread_task_runner.h"
#include "base/strings/string_util.h"
@@ -37,7 +38,6 @@
#include "extensions/common/extension.h"
#include "extensions/common/file_util.h"
#include "extensions/common/manifest_handlers/app_isolation_info.h"
-#include "extensions/common/one_shot_event.h"
namespace extensions {
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index d58ad80..8756a67 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -18,6 +18,7 @@
#include "base/location.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
+#include "base/one_shot_event.h"
#include "base/single_thread_task_runner.h"
#include "base/stl_util.h"
#include "base/strings/string_number_conversions.h"
@@ -98,7 +99,6 @@
#include "extensions/common/manifest_constants.h"
#include "extensions/common/manifest_handlers/shared_module_info.h"
#include "extensions/common/manifest_url_handlers.h"
-#include "extensions/common/one_shot_event.h"
#include "extensions/common/permissions/api_permission.h"
#include "extensions/common/permissions/permission_message_provider.h"
#include "extensions/common/permissions/permissions_data.h"
@@ -283,7 +283,7 @@
Blacklist* blacklist,
bool autoupdate_enabled,
bool extensions_enabled,
- OneShotEvent* ready)
+ base::OneShotEvent* ready)
: Blacklist::Observer(blacklist),
command_line_(command_line),
profile_(profile),
diff --git a/chrome/browser/extensions/extension_service.h b/chrome/browser/extensions/extension_service.h
index 06a8838..2c88f65d 100644
--- a/chrome/browser/extensions/extension_service.h
+++ b/chrome/browser/extensions/extension_service.h
@@ -51,6 +51,7 @@
namespace base {
class CommandLine;
+class OneShotEvent;
}
FORWARD_DECLARE_TEST(BlacklistedExtensionSyncServiceTest,
@@ -66,7 +67,6 @@
class ExtensionSystem;
class ExtensionUpdater;
class ExternalInstallManager;
-class OneShotEvent;
class SharedModuleService;
class UpdateObserver;
@@ -191,7 +191,7 @@
Blacklist* blacklist,
bool autoupdate_enabled,
bool extensions_enabled,
- OneShotEvent* ready);
+ base::OneShotEvent* ready);
~ExtensionService() override;
@@ -619,7 +619,7 @@
bool extensions_enabled_ = true;
// Signaled when all extensions are loaded.
- OneShotEvent* const ready_;
+ base::OneShotEvent* const ready_;
// Our extension updater, if updates are turned on.
std::unique_ptr<ExtensionUpdater> updater_;
diff --git a/chrome/browser/extensions/extension_sync_service.cc b/chrome/browser/extensions/extension_sync_service.cc
index ce809cd..da9cba1 100644
--- a/chrome/browser/extensions/extension_sync_service.cc
+++ b/chrome/browser/extensions/extension_sync_service.cc
@@ -7,6 +7,7 @@
#include <utility>
#include "base/auto_reset.h"
+#include "base/one_shot_event.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/extensions/bookmark_app_helper.h"
#include "chrome/browser/extensions/extension_service.h"
@@ -31,7 +32,6 @@
#include "extensions/common/extension.h"
#include "extensions/common/extension_set.h"
#include "extensions/common/image_util.h"
-#include "extensions/common/one_shot_event.h"
#include "extensions/common/permissions/permission_message_provider.h"
#include "extensions/common/permissions/permissions_data.h"
diff --git a/chrome/browser/extensions/extension_system_impl.cc b/chrome/browser/extensions/extension_system_impl.cc
index 375d183..2b4d0cc1 100644
--- a/chrome/browser/extensions/extension_system_impl.cc
+++ b/chrome/browser/extensions/extension_system_impl.cc
@@ -411,7 +411,7 @@
InfoMap* ExtensionSystemImpl::info_map() { return shared_->info_map(); }
-const OneShotEvent& ExtensionSystemImpl::ready() const {
+const base::OneShotEvent& ExtensionSystemImpl::ready() const {
return shared_->ready();
}
diff --git a/chrome/browser/extensions/extension_system_impl.h b/chrome/browser/extensions/extension_system_impl.h
index 925637f..98809e1 100644
--- a/chrome/browser/extensions/extension_system_impl.h
+++ b/chrome/browser/extensions/extension_system_impl.h
@@ -8,10 +8,10 @@
#include <string>
#include "base/macros.h"
+#include "base/one_shot_event.h"
#include "build/build_config.h"
#include "chrome/browser/extensions/extension_cookie_notifier.h"
#include "extensions/browser/extension_system.h"
-#include "extensions/common/one_shot_event.h"
class Profile;
@@ -70,7 +70,7 @@
const std::string& extension_id,
const UnloadedExtensionReason reason) override;
- const OneShotEvent& ready() const override;
+ const base::OneShotEvent& ready() const override;
ContentVerifier* content_verifier() override; // shared
std::unique_ptr<ExtensionSet> GetDependentExtensions(
const Extension* extension) override;
@@ -113,7 +113,7 @@
InfoMap* info_map();
QuotaService* quota_service();
AppSorting* app_sorting();
- const OneShotEvent& ready() const { return ready_; }
+ const base::OneShotEvent& ready() const { return ready_; }
ContentVerifier* content_verifier();
private:
@@ -154,7 +154,7 @@
std::unique_ptr<InstallGate> kiosk_app_update_install_gate_;
#endif
- OneShotEvent ready_;
+ base::OneShotEvent ready_;
};
std::unique_ptr<ExtensionCookieNotifier> cookie_notifier_;
diff --git a/chrome/browser/extensions/extension_web_ui_override_registrar.cc b/chrome/browser/extensions/extension_web_ui_override_registrar.cc
index 2e3c41c..bdcef23 100644
--- a/chrome/browser/extensions/extension_web_ui_override_registrar.cc
+++ b/chrome/browser/extensions/extension_web_ui_override_registrar.cc
@@ -6,11 +6,11 @@
#include "base/bind.h"
#include "base/lazy_instance.h"
+#include "base/one_shot_event.h"
#include "chrome/browser/extensions/extension_web_ui.h"
#include "chrome/browser/profiles/profile.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_system.h"
-#include "extensions/common/one_shot_event.h"
namespace extensions {
diff --git a/chrome/browser/extensions/install_verifier.cc b/chrome/browser/extensions/install_verifier.cc
index 1f4e4f2..c7a34717 100644
--- a/chrome/browser/extensions/install_verifier.cc
+++ b/chrome/browser/extensions/install_verifier.cc
@@ -13,6 +13,7 @@
#include "base/command_line.h"
#include "base/metrics/field_trial.h"
#include "base/metrics/histogram_macros.h"
+#include "base/one_shot_event.h"
#include "base/stl_util.h"
#include "base/trace_event/trace_event.h"
#include "build/build_config.h"
@@ -33,7 +34,6 @@
#include "extensions/common/extension_set.h"
#include "extensions/common/manifest.h"
#include "extensions/common/manifest_url_handlers.h"
-#include "extensions/common/one_shot_event.h"
#include "services/network/public/mojom/url_loader_factory.mojom.h"
#include "ui/base/l10n/l10n_util.h"
diff --git a/chrome/browser/extensions/test_extension_system.cc b/chrome/browser/extensions/test_extension_system.cc
index 60b4000..eeec53c 100644
--- a/chrome/browser/extensions/test_extension_system.cc
+++ b/chrome/browser/extensions/test_extension_system.cc
@@ -143,7 +143,7 @@
return app_sorting_.get();
}
-const OneShotEvent& TestExtensionSystem::ready() const {
+const base::OneShotEvent& TestExtensionSystem::ready() const {
return ready_;
}
diff --git a/chrome/browser/extensions/test_extension_system.h b/chrome/browser/extensions/test_extension_system.h
index 812672ec..ec7fe40b 100644
--- a/chrome/browser/extensions/test_extension_system.h
+++ b/chrome/browser/extensions/test_extension_system.h
@@ -7,8 +7,8 @@
#include <memory>
+#include "base/one_shot_event.h"
#include "extensions/browser/extension_system.h"
-#include "extensions/common/one_shot_event.h"
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/login/users/scoped_test_user_manager.h"
@@ -71,7 +71,7 @@
InfoMap* info_map() override;
QuotaService* quota_service() override;
AppSorting* app_sorting() override;
- const OneShotEvent& ready() const override;
+ const base::OneShotEvent& ready() const override;
ContentVerifier* content_verifier() override;
std::unique_ptr<ExtensionSet> GetDependentExtensions(
const Extension* extension) override;
@@ -107,7 +107,7 @@
scoped_refptr<InfoMap> info_map_;
std::unique_ptr<QuotaService> quota_service_;
std::unique_ptr<AppSorting> app_sorting_;
- OneShotEvent ready_;
+ base::OneShotEvent ready_;
std::unique_ptr<service_manager::TestConnectorFactory> connector_factory_;
std::unique_ptr<service_manager::Connector> connector_;
diff --git a/chrome/browser/first_run/first_run.cc b/chrome/browser/first_run/first_run.cc
index fcc7e20..04a86e3 100644
--- a/chrome/browser/first_run/first_run.cc
+++ b/chrome/browser/first_run/first_run.cc
@@ -17,6 +17,7 @@
#include "base/metrics/histogram_macros.h"
#include "base/metrics/user_metrics.h"
#include "base/no_destructor.h"
+#include "base/one_shot_event.h"
#include "base/path_service.h"
#include "base/run_loop.h"
#include "base/strings/utf_string_conversions.h"
@@ -57,7 +58,6 @@
#include "content/public/browser/notification_types.h"
#include "content/public/browser/web_contents.h"
#include "extensions/browser/extension_system.h"
-#include "extensions/common/one_shot_event.h"
#include "google_apis/gaia/gaia_auth_util.h"
#include "url/gurl.h"
diff --git a/chrome/browser/themes/theme_syncable_service.cc b/chrome/browser/themes/theme_syncable_service.cc
index dc7e3fdf..ea065fe 100644
--- a/chrome/browser/themes/theme_syncable_service.cc
+++ b/chrome/browser/themes/theme_syncable_service.cc
@@ -9,6 +9,7 @@
#include <string>
#include <utility>
+#include "base/one_shot_event.h"
#include "base/strings/stringprintf.h"
#include "base/version.h"
#include "chrome/browser/extensions/extension_service.h"
@@ -22,7 +23,6 @@
#include "extensions/browser/extension_prefs.h"
#include "extensions/browser/extension_system.h"
#include "extensions/common/manifest_url_handlers.h"
-#include "extensions/common/one_shot_event.h"
using std::string;
diff --git a/chrome/browser/ui/app_list/app_list_syncable_service.cc b/chrome/browser/ui/app_list/app_list_syncable_service.cc
index 6af4d55..03ecf86c 100644
--- a/chrome/browser/ui/app_list/app_list_syncable_service.cc
+++ b/chrome/browser/ui/app_list/app_list_syncable_service.cc
@@ -12,6 +12,7 @@
#include "base/command_line.h"
#include "base/feature_list.h"
#include "base/macros.h"
+#include "base/one_shot_event.h"
#include "base/stl_util.h"
#include "base/values.h"
#include "build/build_config.h"
@@ -49,7 +50,6 @@
#include "extensions/browser/extension_system.h"
#include "extensions/browser/uninstall_reason.h"
#include "extensions/common/constants.h"
-#include "extensions/common/one_shot_event.h"
#include "ui/base/l10n/l10n_util.h"
using syncer::SyncChange;
diff --git a/chrome/browser/ui/toolbar/toolbar_actions_model.cc b/chrome/browser/ui/toolbar/toolbar_actions_model.cc
index 0128cd71..f15fb58 100644
--- a/chrome/browser/ui/toolbar/toolbar_actions_model.cc
+++ b/chrome/browser/ui/toolbar/toolbar_actions_model.cc
@@ -12,6 +12,7 @@
#include "base/location.h"
#include "base/metrics/histogram_base.h"
#include "base/metrics/histogram_macros.h"
+#include "base/one_shot_event.h"
#include "base/single_thread_task_runner.h"
#include "base/stl_util.h"
#include "base/threading/thread_task_runner_handle.h"
@@ -39,7 +40,6 @@
#include "extensions/browser/pref_names.h"
#include "extensions/common/extension_set.h"
#include "extensions/common/manifest_constants.h"
-#include "extensions/common/one_shot_event.h"
ToolbarActionsModel::ToolbarActionsModel(
Profile* profile,
diff --git a/chrome/browser/web_applications/extensions/bookmark_app_registrar.cc b/chrome/browser/web_applications/extensions/bookmark_app_registrar.cc
index d8af4a37..33e73ce 100644
--- a/chrome/browser/web_applications/extensions/bookmark_app_registrar.cc
+++ b/chrome/browser/web_applications/extensions/bookmark_app_registrar.cc
@@ -6,13 +6,13 @@
#include <utility>
+#include "base/one_shot_event.h"
#include "chrome/browser/extensions/convert_web_app.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/extensions/api/url_handlers/url_handlers_parser.h"
#include "extensions/browser/extension_prefs.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_system.h"
-#include "extensions/common/one_shot_event.h"
namespace extensions {
diff --git a/chrome/browser/web_applications/web_app_provider.cc b/chrome/browser/web_applications/web_app_provider.cc
index d55fa19..b18c7f59 100644
--- a/chrome/browser/web_applications/web_app_provider.cc
+++ b/chrome/browser/web_applications/web_app_provider.cc
@@ -9,6 +9,7 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/feature_list.h"
+#include "base/one_shot_event.h"
#include "base/threading/thread_task_runner_handle.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/profiles/profile.h"
@@ -39,7 +40,6 @@
#include "content/public/browser/notification_source.h"
#include "content/public/browser/web_contents.h"
#include "extensions/browser/extension_system.h"
-#include "extensions/common/one_shot_event.h"
namespace web_app {
diff --git a/chrome/browser/web_applications/web_app_provider.h b/chrome/browser/web_applications/web_app_provider.h
index 63a9a311..1d452d4 100644
--- a/chrome/browser/web_applications/web_app_provider.h
+++ b/chrome/browser/web_applications/web_app_provider.h
@@ -84,7 +84,7 @@
const content::NotificationDetails& details) override;
// Fires when app registry becomes ready.
- // Consider to use base::ObserverList or extensions::OneShotEvent if many
+ // Consider to use base::ObserverList or base::OneShotEvent if many
// subscribers needed.
void SetRegistryReadyCallback(base::OnceClosure callback);
diff --git a/chromecast/browser/extensions/cast_extension_system.cc b/chromecast/browser/extensions/cast_extension_system.cc
index 6eec4c9..9c7ae096 100644
--- a/chromecast/browser/extensions/cast_extension_system.cc
+++ b/chromecast/browser/extensions/cast_extension_system.cc
@@ -262,7 +262,7 @@
const std::string& extension_id,
const UnloadedExtensionReason reason) {}
-const OneShotEvent& CastExtensionSystem::ready() const {
+const base::OneShotEvent& CastExtensionSystem::ready() const {
return ready_;
}
diff --git a/chromecast/browser/extensions/cast_extension_system.h b/chromecast/browser/extensions/cast_extension_system.h
index 1cbac8b..975197a 100644
--- a/chromecast/browser/extensions/cast_extension_system.h
+++ b/chromecast/browser/extensions/cast_extension_system.h
@@ -10,9 +10,9 @@
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
+#include "base/one_shot_event.h"
#include "extensions/browser/extension_registrar.h"
#include "extensions/browser/extension_system.h"
-#include "extensions/common/one_shot_event.h"
namespace base {
class FilePath;
@@ -80,7 +80,7 @@
void UnregisterExtensionWithRequestContexts(
const std::string& extension_id,
const UnloadedExtensionReason reason) override;
- const OneShotEvent& ready() const override;
+ const base::OneShotEvent& ready() const override;
ContentVerifier* content_verifier() override;
std::unique_ptr<ExtensionSet> GetDependentExtensions(
const Extension* extension) override;
@@ -125,7 +125,7 @@
scoped_refptr<ValueStoreFactory> store_factory_;
// Signaled when the extension system has completed its startup tasks.
- OneShotEvent ready_;
+ base::OneShotEvent ready_;
base::WeakPtrFactory<CastExtensionSystem> weak_factory_;
diff --git a/extensions/browser/api/declarative/rules_registry.h b/extensions/browser/api/declarative/rules_registry.h
index 7479a2a..e32424d 100644
--- a/extensions/browser/api/declarative/rules_registry.h
+++ b/extensions/browser/api/declarative/rules_registry.h
@@ -17,12 +17,12 @@
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
+#include "base/one_shot_event.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "extensions/common/api/events.h"
#include "extensions/common/extension_id.h"
-#include "extensions/common/one_shot_event.h"
namespace content {
class BrowserContext;
@@ -55,9 +55,7 @@
RulesCacheDelegate* cache_delegate,
int id);
- const OneShotEvent& ready() const {
- return ready_;
- }
+ const base::OneShotEvent& ready() const { return ready_; }
// RulesRegistry implementation:
@@ -258,7 +256,7 @@
// Signaled when we have finished reading from storage for all extensions that
// are loaded on startup.
- OneShotEvent ready_;
+ base::OneShotEvent ready_;
ProcessStateMap process_changed_rules_requested_;
diff --git a/extensions/browser/api/runtime/runtime_api.cc b/extensions/browser/api/runtime/runtime_api.cc
index 50da868..968e2d9 100644
--- a/extensions/browser/api/runtime/runtime_api.cc
+++ b/extensions/browser/api/runtime/runtime_api.cc
@@ -12,6 +12,7 @@
#include "base/location.h"
#include "base/logging.h"
#include "base/metrics/histogram.h"
+#include "base/one_shot_event.h"
#include "base/single_thread_task_runner.h"
#include "base/strings/string_number_conversions.h"
#include "base/threading/thread_task_runner_handle.h"
@@ -40,7 +41,6 @@
#include "extensions/common/extension.h"
#include "extensions/common/manifest_handlers/background_info.h"
#include "extensions/common/manifest_handlers/shared_module_info.h"
-#include "extensions/common/one_shot_event.h"
#include "storage/browser/fileapi/isolated_context.h"
#include "url/gurl.h"
diff --git a/extensions/browser/extension_system.h b/extensions/browser/extension_system.h
index 5177822..2bfdd21 100644
--- a/extensions/browser/extension_system.h
+++ b/extensions/browser/extension_system.h
@@ -20,6 +20,10 @@
#error "Extensions must be enabled"
#endif
+namespace base {
+class OneShotEvent;
+}
+
namespace content {
class BrowserContext;
}
@@ -33,7 +37,6 @@
class ExtensionSet;
class InfoMap;
class ManagementPolicy;
-class OneShotEvent;
class QuotaService;
class RuntimeData;
class ServiceWorkerManager;
@@ -122,7 +125,7 @@
const UnloadedExtensionReason reason) {}
// Signaled when the extension system has completed its startup tasks.
- virtual const OneShotEvent& ready() const = 0;
+ virtual const base::OneShotEvent& ready() const = 0;
// Returns the content verifier, if any.
virtual ContentVerifier* content_verifier() = 0;
diff --git a/extensions/browser/extension_user_script_loader.cc b/extensions/browser/extension_user_script_loader.cc
index a0b8bc89..73258f33 100644
--- a/extensions/browser/extension_user_script_loader.cc
+++ b/extensions/browser/extension_user_script_loader.cc
@@ -16,6 +16,7 @@
#include "base/bind_helpers.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
+#include "base/one_shot_event.h"
#include "base/strings/string_util.h"
#include "base/task/post_task.h"
#include "base/version.h"
@@ -33,7 +34,6 @@
#include "extensions/common/file_util.h"
#include "extensions/common/manifest_handlers/default_locale_handler.h"
#include "extensions/common/message_bundle.h"
-#include "extensions/common/one_shot_event.h"
#include "ui/base/resource/resource_bundle.h"
using content::BrowserContext;
diff --git a/extensions/browser/mock_extension_system.cc b/extensions/browser/mock_extension_system.cc
index 55a6c454..13eeaa1 100644
--- a/extensions/browser/mock_extension_system.cc
+++ b/extensions/browser/mock_extension_system.cc
@@ -64,7 +64,7 @@
return nullptr;
}
-const OneShotEvent& MockExtensionSystem::ready() const {
+const base::OneShotEvent& MockExtensionSystem::ready() const {
return ready_;
}
diff --git a/extensions/browser/mock_extension_system.h b/extensions/browser/mock_extension_system.h
index 6a51491..6d5b7c7 100644
--- a/extensions/browser/mock_extension_system.h
+++ b/extensions/browser/mock_extension_system.h
@@ -6,11 +6,11 @@
#define EXTENSIONS_BROWSER_MOCK_EXTENSION_SYSTEM_H_
#include "base/macros.h"
+#include "base/one_shot_event.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h"
#include "extensions/browser/extension_registry_factory.h"
#include "extensions/browser/extension_system.h"
#include "extensions/browser/extension_system_provider.h"
-#include "extensions/common/one_shot_event.h"
namespace extensions {
@@ -42,7 +42,7 @@
InfoMap* info_map() override;
QuotaService* quota_service() override;
AppSorting* app_sorting() override;
- const OneShotEvent& ready() const override;
+ const base::OneShotEvent& ready() const override;
ContentVerifier* content_verifier() override;
std::unique_ptr<ExtensionSet> GetDependentExtensions(
const Extension* extension) override;
@@ -56,7 +56,7 @@
private:
content::BrowserContext* browser_context_;
- OneShotEvent ready_;
+ base::OneShotEvent ready_;
DISALLOW_COPY_AND_ASSIGN(MockExtensionSystem);
};
diff --git a/extensions/browser/process_manager.cc b/extensions/browser/process_manager.cc
index 14fa00f..b203c13 100644
--- a/extensions/browser/process_manager.cc
+++ b/extensions/browser/process_manager.cc
@@ -14,6 +14,7 @@
#include "base/logging.h"
#include "base/macros.h"
#include "base/metrics/histogram_macros.h"
+#include "base/one_shot_event.h"
#include "base/single_thread_task_runner.h"
#include "base/strings/string_number_conversions.h"
#include "base/task/post_task.h"
@@ -49,7 +50,6 @@
#include "extensions/common/extension_messages.h"
#include "extensions/common/manifest_handlers/background_info.h"
#include "extensions/common/manifest_handlers/incognito_info.h"
-#include "extensions/common/one_shot_event.h"
using content::BrowserContext;
diff --git a/extensions/common/BUILD.gn b/extensions/common/BUILD.gn
index 641ca4e..1c2643d 100644
--- a/extensions/common/BUILD.gn
+++ b/extensions/common/BUILD.gn
@@ -241,8 +241,6 @@
"manifest_url_handlers.h",
"message_bundle.cc",
"message_bundle.h",
- "one_shot_event.cc",
- "one_shot_event.h",
"permissions/api_permission.cc",
"permissions/api_permission.h",
"permissions/api_permission_set.cc",
@@ -429,7 +427,6 @@
"manifest_handlers/oauth2_manifest_unittest.cc",
"manifest_handlers/shared_module_manifest_unittest.cc",
"message_bundle_unittest.cc",
- "one_shot_event_unittest.cc",
"permissions/api_permission_set_unittest.cc",
"permissions/api_permission_unittest.cc",
"permissions/base_set_operators_unittest.cc",
diff --git a/extensions/shell/browser/shell_extension_system.cc b/extensions/shell/browser/shell_extension_system.cc
index a3bffdb..e778a0c 100644
--- a/extensions/shell/browser/shell_extension_system.cc
+++ b/extensions/shell/browser/shell_extension_system.cc
@@ -154,7 +154,7 @@
const std::string& extension_id,
const UnloadedExtensionReason reason) {}
-const OneShotEvent& ShellExtensionSystem::ready() const {
+const base::OneShotEvent& ShellExtensionSystem::ready() const {
return ready_;
}
diff --git a/extensions/shell/browser/shell_extension_system.h b/extensions/shell/browser/shell_extension_system.h
index 7e6075a93..a782471f 100644
--- a/extensions/shell/browser/shell_extension_system.h
+++ b/extensions/shell/browser/shell_extension_system.h
@@ -12,8 +12,8 @@
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
+#include "base/one_shot_event.h"
#include "extensions/browser/extension_system.h"
-#include "extensions/common/one_shot_event.h"
namespace base {
class FilePath;
@@ -78,7 +78,7 @@
void UnregisterExtensionWithRequestContexts(
const std::string& extension_id,
const UnloadedExtensionReason reason) override;
- const OneShotEvent& ready() const override;
+ const base::OneShotEvent& ready() const override;
ContentVerifier* content_verifier() override;
std::unique_ptr<ExtensionSet> GetDependentExtensions(
const Extension* extension) override;
@@ -108,7 +108,7 @@
scoped_refptr<ValueStoreFactory> store_factory_;
// Signaled when the extension system has completed its startup tasks.
- OneShotEvent ready_;
+ base::OneShotEvent ready_;
base::WeakPtrFactory<ShellExtensionSystem> weak_factory_;