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

Unified Diff: content/renderer/websharedworker_proxy.h

Issue 8416029: Removing dedicated worker-related IPC code (second round). (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Style nit Created 9 years, 2 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
« no previous file with comments | « content/renderer/render_view_impl.cc ('k') | content/renderer/websharedworker_proxy.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/websharedworker_proxy.h
diff --git a/content/renderer/websharedworker_proxy.h b/content/renderer/websharedworker_proxy.h
index acc8dcab57a757bb1f94023050881c57347ee70a..9f1041f3df4b3cc480f2b31b7999e6fa8535a7c0 100644
--- a/content/renderer/websharedworker_proxy.h
+++ b/content/renderer/websharedworker_proxy.h
@@ -6,9 +6,13 @@
#define CONTENT_RENDERER_WEBSHAREDWORKER_PROXY_H_
#pragma once
+#include <string>
+#include <vector>
+
#include "base/basictypes.h"
-#include "content/renderer/webworker_base.h"
+#include "base/memory/scoped_ptr.h"
#include "googleurl/src/gurl.h"
+#include "ipc/ipc_channel.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebSharedWorker.h"
class ChildThread;
@@ -19,7 +23,7 @@ class ChildThread;
// happen via the WebMessagePortChannel, and the WebSharedWorker instance will
// be freed.
class WebSharedWorkerProxy : public WebKit::WebSharedWorker,
- private WebWorkerBase {
+ private IPC::Channel::Listener {
public:
// If the worker not loaded yet, route_id == MSG_ROUTING_NONE
WebSharedWorkerProxy(ChildThread* child_thread,
@@ -27,6 +31,7 @@ class WebSharedWorkerProxy : public WebKit::WebSharedWorker,
bool exists,
int route_id,
int render_view_route_id);
+ virtual ~WebSharedWorkerProxy();
// Implementations of WebSharedWorker APIs
virtual bool isStarted();
@@ -40,12 +45,57 @@ class WebSharedWorkerProxy : public WebKit::WebSharedWorker,
virtual void terminateWorkerContext();
virtual void clientDestroyed();
+ private:
// IPC::Channel::Listener implementation.
virtual bool OnMessageReceived(const IPC::Message& message);
- private:
+ // Returns true if the worker is running (can send messages to it).
+ bool IsStarted();
+
+ // Disconnects the worker (stops listening for incoming messages).
+ void Disconnect();
+
+ // Sends a message to the worker thread (forwarded via the RenderViewHost).
+ // If WorkerStarted() has not yet been called, message is queued.
+ bool Send(IPC::Message*);
+
+ // Returns true if there are queued messages.
+ bool HasQueuedMessages() { return !queued_messages_.empty(); }
+
+ // Sends any messages currently in the queue.
+ void SendQueuedMessages();
+
+ void CreateWorkerContext(const GURL& script_url,
+ bool is_shared,
+ const string16& name,
+ const string16& user_agent,
+ const string16& source_code,
+ int pending_route_id,
+ int64 script_resource_appcache_id);
void OnWorkerCreated();
+
+ // Routing id associated with this worker - used to receive messages from the
+ // worker, and also to route messages to the worker (WorkerService contains
+ // a map that maps between these renderer-side route IDs and worker-side
+ // routing ids).
+ int route_id_;
+
+ // The routing id for the RenderView that created this worker.
+ int render_view_route_id_;
+
+ ChildThread* child_thread_;
+
+ // ID of our parent document (used to shutdown workers when the parent
+ // document is detached).
+ unsigned long long document_id_;
+
+ // ID of our parent's appcache host, only valid for dedicated workers.
+ int parent_appcache_host_id_;
+
+ // Stores messages that were sent before the StartWorkerContext message.
+ std::vector<IPC::Message*> queued_messages_;
+
// The id for the placeholder worker instance we've stored on the
// browser process (we need to pass this same route id back in when creating
// the worker).
« no previous file with comments | « content/renderer/render_view_impl.cc ('k') | content/renderer/websharedworker_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698