Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(275)

Unified Diff: content/browser/service_worker/embedded_worker_instance.h

Issue 127573002: Add basic browser test for EmbeddedWorker/ServiceWorker (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: copyright fix Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/service_worker/embedded_worker_instance.h
diff --git a/content/browser/service_worker/embedded_worker_instance.h b/content/browser/service_worker/embedded_worker_instance.h
index 5a992a2d4ff7528f0793fb1f0878b7cb553871c7..fcc2c3481996bc273182379c35b2a4e51ab476ae 100644
--- a/content/browser/service_worker/embedded_worker_instance.h
+++ b/content/browser/service_worker/embedded_worker_instance.h
@@ -12,6 +12,7 @@
#include "base/gtest_prod_util.h"
#include "base/logging.h"
#include "base/memory/ref_counted.h"
+#include "base/observer_list.h"
#include "content/common/content_export.h"
class GURL;
@@ -33,6 +34,13 @@ class CONTENT_EXPORT EmbeddedWorkerInstance {
STOPPING,
};
+ class Observer {
+ public:
+ virtual ~Observer() {}
+ virtual void OnStarted() = 0;
+ virtual void OnStopped() = 0;
+ };
+
~EmbeddedWorkerInstance();
// Starts the worker. It is invalid to call this when the worker is
@@ -63,6 +71,9 @@ class CONTENT_EXPORT EmbeddedWorkerInstance {
int process_id() const { return process_id_; }
int thread_id() const { return thread_id_; }
+ void AddObserver(Observer* observer);
+ void RemoveObserver(Observer* observer);
+
private:
friend class EmbeddedWorkerRegistry;
FRIEND_TEST_ALL_PREFIXES(EmbeddedWorkerInstanceTest, StartAndStop);
@@ -99,6 +110,7 @@ class CONTENT_EXPORT EmbeddedWorkerInstance {
int thread_id_;
ProcessRefMap process_refs_;
+ ObserverList<Observer> observer_list_;
DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerInstance);
};

Powered by Google App Engine
This is Rietveld 408576698