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

Unified Diff: chrome/renderer/websharedworker_impl.h

Issue 340036: Initial pass of shared workers renderer-side code (Closed)
Patch Set: Changes reflecting review feedback Created 11 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
Index: chrome/renderer/websharedworker_impl.h
diff --git a/chrome/renderer/websharedworker_impl.h b/chrome/renderer/websharedworker_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..14d122d89bb3c1d085f938f9f75bbbc5719478cf
--- /dev/null
+++ b/chrome/renderer/websharedworker_impl.h
@@ -0,0 +1,49 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_RENDERER_WEBSHAREDWORKER_IMPL_H_
+#define CHROME_RENDERER_WEBSHAREDWORKER_IMPL_H_
+
+#include "base/basictypes.h"
+#include "chrome/renderer/webworker_base.h"
+#include "googleurl/src/gurl.h"
+#include "webkit/api/public/WebSharedWorker.h"
+
+class ChildThread;
+
+// Implementation of the WebSharedWorker APIs. This object is intended to only
+// live long enough to allow the caller to send a "connect" event to the worker
+// thread. Once the connect event has been sent, all future communication will
+// happen via the WebMessagePortChannel, and the WebSharedWorker instance will
+// be freed.
+class WebSharedWorkerImpl : public WebKit::WebSharedWorker,
+ private WebWorkerBase {
+ public:
+ WebSharedWorkerImpl(const GURL& url,
+ const string16& name,
+ ChildThread* child_thread,
+ int route_id,
+ int render_view_route_id);
+
+ // Implementations of WebSharedWorker APIs
+ virtual bool isStarted();
+ virtual void connect(WebKit::WebMessagePortChannel* channel);
+ virtual void startWorkerContext(const WebKit::WebURL& script_url,
+ const WebKit::WebString& user_agent,
+ const WebKit::WebString& source_code);
+
+ // IPC::Channel::Listener implementation.
+ void OnMessageReceived(const IPC::Message& message);
+
+ private:
+ void OnWorkerCreated();
+
+ // The name and URL that uniquely identify this worker.
+ GURL url_;
+ string16 name_;
+
+ DISALLOW_COPY_AND_ASSIGN(WebSharedWorkerImpl);
+};
+
+#endif // CHROME_RENDERER_WEBSHAREDWORKER_IMPL_H_

Powered by Google App Engine
This is Rietveld 408576698