summaryrefslogtreecommitdiffstats
path: root/content/renderer
diff options
context:
space:
mode:
Diffstat (limited to 'content/renderer')
-rw-r--r--content/renderer/render_frame_impl.cc28
-rw-r--r--content/renderer/render_frame_impl.h5
-rw-r--r--content/renderer/render_thread_impl.cc3
-rw-r--r--content/renderer/render_view_impl.cc4
-rw-r--r--content/renderer/renderer_webkitplatformsupport_impl.cc18
-rw-r--r--content/renderer/renderer_webkitplatformsupport_impl.h7
-rw-r--r--content/renderer/shared_worker_repository.cc57
-rw-r--r--content/renderer/shared_worker_repository.h39
-rw-r--r--content/renderer/websharedworkerrepository_impl.cc35
-rw-r--r--content/renderer/websharedworkerrepository_impl.h37
10 files changed, 99 insertions, 134 deletions
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index 91475d3..c848027 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -168,34 +168,6 @@ WebKit::WebPlugin* RenderFrameImpl::createPlugin(
#endif // defined(ENABLE_PLUGINS)
}
-WebKit::WebSharedWorker* RenderFrameImpl::createSharedWorker(
- WebKit::WebFrame* frame,
- const WebKit::WebURL& url,
- const WebKit::WebString& name,
- unsigned long long document_id) {
- int route_id = MSG_ROUTING_NONE;
- bool exists = false;
- bool url_mismatch = false;
- ViewHostMsg_CreateWorker_Params params;
- params.url = url;
- params.name = name;
- params.document_id = document_id;
- params.render_view_route_id = render_view_->GetRoutingID();
- params.route_id = MSG_ROUTING_NONE;
- params.script_resource_appcache_id = 0;
- render_view_->Send(new ViewHostMsg_LookupSharedWorker(
- params, &exists, &route_id, &url_mismatch));
- if (url_mismatch) {
- return NULL;
- } else {
- return new WebSharedWorkerProxy(RenderThreadImpl::current(),
- document_id,
- exists,
- route_id,
- render_view_->GetRoutingID());
- }
-}
-
WebKit::WebMediaPlayer* RenderFrameImpl::createMediaPlayer(
WebKit::WebFrame* frame,
const WebKit::WebURL& url,
diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h
index 78e75b0..a13f3f8 100644
--- a/content/renderer/render_frame_impl.h
+++ b/content/renderer/render_frame_impl.h
@@ -40,11 +40,6 @@ class CONTENT_EXPORT RenderFrameImpl
virtual WebKit::WebPlugin* createPlugin(
WebKit::WebFrame* frame,
const WebKit::WebPluginParams& params);
- virtual WebKit::WebSharedWorker* createSharedWorker(
- WebKit::WebFrame* frame,
- const WebKit::WebURL& url,
- const WebKit::WebString& name,
- unsigned long long document_id);
virtual WebKit::WebMediaPlayer* createMediaPlayer(
WebKit::WebFrame* frame,
const WebKit::WebURL& url,
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc
index 775b6bf..266276e 100644
--- a/content/renderer/render_thread_impl.cc
+++ b/content/renderer/render_thread_impl.cc
@@ -104,7 +104,6 @@
#include "third_party/WebKit/public/web/WebRuntimeFeatures.h"
#include "third_party/WebKit/public/web/WebScriptController.h"
#include "third_party/WebKit/public/web/WebSecurityPolicy.h"
-#include "third_party/WebKit/public/web/WebSharedWorkerRepository.h"
#include "third_party/WebKit/public/web/WebView.h"
#include "ui/base/layout.h"
#include "ui/base/ui_base_switches.h"
@@ -638,8 +637,6 @@ void RenderThreadImpl::EnsureWebKitInitialized() {
webkit_platform_support_.reset(new RendererWebKitPlatformSupportImpl);
WebKit::initialize(webkit_platform_support_.get());
- WebKit::setSharedWorkerRepository(
- webkit_platform_support_.get()->sharedWorkerRepository());
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
index db2fd0ecb..d095282 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -118,6 +118,7 @@
#include "content/renderer/renderer_webcolorchooser_impl.h"
#include "content/renderer/resizing_mode_selector.h"
#include "content/renderer/savable_resources.h"
+#include "content/renderer/shared_worker_repository.h"
#include "content/renderer/speech_recognition_dispatcher.h"
#include "content/renderer/stats_collection_controller.h"
#include "content/renderer/stats_collection_observer.h"
@@ -316,7 +317,6 @@ using WebKit::WebSecurityOrigin;
using WebKit::WebSecurityPolicy;
using WebKit::WebSerializedScriptValue;
using WebKit::WebSettings;
-using WebKit::WebSharedWorker;
using WebKit::WebSize;
using WebKit::WebSocketStreamHandle;
using WebKit::WebStorageNamespace;
@@ -983,6 +983,8 @@ void RenderViewImpl::Initialize(RenderViewImplParams* params) {
new TextInputClientObserver(this);
#endif // defined(OS_MACOSX)
+ new SharedWorkerRepository(this);
+
#if defined(OS_ANDROID)
media_player_manager_.reset(new RendererMediaPlayerManager());
#endif
diff --git a/content/renderer/renderer_webkitplatformsupport_impl.cc b/content/renderer/renderer_webkitplatformsupport_impl.cc
index 962a5ca..6f7dd05 100644
--- a/content/renderer/renderer_webkitplatformsupport_impl.cc
+++ b/content/renderer/renderer_webkitplatformsupport_impl.cc
@@ -47,7 +47,6 @@
#include "content/renderer/renderer_clipboard_client.h"
#include "content/renderer/webclipboard_impl.h"
#include "content/renderer/webcrypto/webcrypto_impl.h"
-#include "content/renderer/websharedworkerrepository_impl.h"
#include "gpu/config/gpu_info.h"
#include "ipc/ipc_sync_message_filter.h"
#include "media/audio/audio_output_device.h"
@@ -205,7 +204,6 @@ RendererWebKitPlatformSupportImpl::RendererWebKitPlatformSupportImpl()
mime_registry_(new RendererWebKitPlatformSupportImpl::MimeRegistry),
sudden_termination_disables_(0),
plugin_refresh_allowed_(true),
- shared_worker_repository_(new WebSharedWorkerRepositoryImpl),
child_thread_loop_(base::MessageLoopProxy::current()) {
if (g_sandbox_enabled && sandboxEnabled()) {
sandbox_support_.reset(
@@ -607,22 +605,6 @@ long long RendererWebKitPlatformSupportImpl::databaseGetSpaceAvailableForOrigin(
sync_message_filter_.get());
}
-WebKit::WebSharedWorkerRepository*
-RendererWebKitPlatformSupportImpl::sharedWorkerRepository() {
-#if !defined(OS_ANDROID)
- if (!CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kDisableSharedWorkers)) {
- return shared_worker_repository_.get();
- } else {
- return NULL;
- }
-#else
- // Shared workers are unsupported on Android. Returning NULL will prevent the
- // window.SharedWorker constructor from being exposed. http://crbug.com/154571
- return NULL;
-#endif
-}
-
bool RendererWebKitPlatformSupportImpl::canAccelerate2dCanvas() {
RenderThreadImpl* thread = RenderThreadImpl::current();
GpuChannelHost* host = thread->EstablishGpuChannelSync(
diff --git a/content/renderer/renderer_webkitplatformsupport_impl.h b/content/renderer/renderer_webkitplatformsupport_impl.h
index 8378c34..1a55021 100644
--- a/content/renderer/renderer_webkitplatformsupport_impl.h
+++ b/content/renderer/renderer_webkitplatformsupport_impl.h
@@ -10,7 +10,6 @@
#include "base/platform_file.h"
#include "content/child/webkitplatformsupport_impl.h"
#include "content/common/content_export.h"
-#include "third_party/WebKit/public/web/WebSharedWorkerRepository.h"
#include "third_party/WebKit/public/platform/WebGraphicsContext3D.h"
#include "third_party/WebKit/public/platform/WebIDBFactory.h"
#include "webkit/renderer/compositor_bindings/web_compositor_support_impl.h"
@@ -42,7 +41,6 @@ class ThreadSafeSender;
class WebClipboardImpl;
class WebCryptoImpl;
class WebFileSystemImpl;
-class WebSharedWorkerRepositoryImpl;
class CONTENT_EXPORT RendererWebKitPlatformSupportImpl
: public WebKitPlatformSupportImpl {
@@ -92,7 +90,6 @@ class CONTENT_EXPORT RendererWebKitPlatformSupportImpl
virtual void screenColorProfile(WebKit::WebVector<char>* to_profile);
virtual WebKit::WebIDBFactory* idbFactory();
virtual WebKit::WebFileSystem* fileSystem();
- virtual WebKit::WebSharedWorkerRepository* sharedWorkerRepository();
virtual bool canAccelerate2dCanvas();
virtual bool isThreadedCompositingEnabled();
virtual double audioHardwareSampleRate();
@@ -196,10 +193,6 @@ class CONTENT_EXPORT RendererWebKitPlatformSupportImpl
// If true, then a GetPlugins call is allowed to rescan the disk.
bool plugin_refresh_allowed_;
- // Implementation of the WebSharedWorkerRepository APIs (provides an interface
- // to WorkerService on the browser thread.
- scoped_ptr<WebSharedWorkerRepositoryImpl> shared_worker_repository_;
-
scoped_ptr<WebKit::WebIDBFactory> web_idb_factory_;
scoped_ptr<WebFileSystemImpl> web_file_system_;
diff --git a/content/renderer/shared_worker_repository.cc b/content/renderer/shared_worker_repository.cc
new file mode 100644
index 0000000..e39fa37
--- /dev/null
+++ b/content/renderer/shared_worker_repository.cc
@@ -0,0 +1,57 @@
+// Copyright 2013 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.
+
+#include "content/renderer/shared_worker_repository.h"
+
+#include "content/child/child_thread.h"
+#include "content/common/view_messages.h"
+#include "content/renderer/render_view_impl.h"
+#include "content/renderer/websharedworker_proxy.h"
+#include "third_party/WebKit/public/web/WebView.h"
+
+namespace content {
+
+SharedWorkerRepository::SharedWorkerRepository(RenderViewImpl* render_view)
+ : RenderViewObserver(render_view) {
+ render_view->GetWebView()->setSharedWorkerRepositoryClient(this);
+}
+
+SharedWorkerRepository::~SharedWorkerRepository() {}
+
+WebKit::WebSharedWorker* SharedWorkerRepository::createSharedWorker(
+ const WebKit::WebURL& url,
+ const WebKit::WebString& name,
+ DocumentID document_id) {
+ int route_id = MSG_ROUTING_NONE;
+ bool exists = false;
+ bool url_mismatch = false;
+ ViewHostMsg_CreateWorker_Params params;
+ params.url = url;
+ params.name = name;
+ params.document_id = document_id;
+ params.render_view_route_id = render_view()->GetRoutingID();
+ params.route_id = MSG_ROUTING_NONE;
+ params.script_resource_appcache_id = 0;
+ Send(new ViewHostMsg_LookupSharedWorker(
+ params, &exists, &route_id, &url_mismatch));
+ if (url_mismatch)
+ return NULL;
+ documents_with_workers_.insert(document_id);
+ return new WebSharedWorkerProxy(ChildThread::current(),
+ document_id,
+ exists,
+ route_id,
+ render_view()->GetRoutingID());
+}
+
+void SharedWorkerRepository::documentDetached(DocumentID document) {
+ std::set<DocumentID>::iterator iter = documents_with_workers_.find(document);
+ if (iter != documents_with_workers_.end()) {
+ // Notify the browser process that the document has shut down.
+ Send(new ViewHostMsg_DocumentDetached(document));
+ documents_with_workers_.erase(iter);
+ }
+}
+
+} // namespace content
diff --git a/content/renderer/shared_worker_repository.h b/content/renderer/shared_worker_repository.h
new file mode 100644
index 0000000..28c36d9
--- /dev/null
+++ b/content/renderer/shared_worker_repository.h
@@ -0,0 +1,39 @@
+// Copyright 2013 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 CONTENT_RENDERER_SHARED_WORKER_REPOSITORY_H_
+#define CONTENT_RENDERER_SHARED_WORKER_REPOSITORY_H_
+
+#include <set>
+
+#include "base/basictypes.h"
+#include "content/public/renderer/render_view_observer.h"
+#include "third_party/WebKit/public/web/WebSharedWorkerRepositoryClient.h"
+
+namespace content {
+
+class RenderViewImpl;
+
+class SharedWorkerRepository : public RenderViewObserver,
+ public WebKit::WebSharedWorkerRepositoryClient {
+ public:
+ explicit SharedWorkerRepository(RenderViewImpl* render_view);
+ virtual ~SharedWorkerRepository();
+
+ // WebSharedWorkerRepositoryClient overrides.
+ virtual WebKit::WebSharedWorker* createSharedWorker(
+ const WebKit::WebURL& url,
+ const WebKit::WebString& name,
+ DocumentID document_id) OVERRIDE;
+ virtual void documentDetached(DocumentID document_id) OVERRIDE;
+
+ private:
+ std::set<DocumentID> documents_with_workers_;
+
+ DISALLOW_COPY_AND_ASSIGN(SharedWorkerRepository);
+};
+
+} // namespace content
+
+#endif // CONTENT_RENDERER_SHARED_WORKER_REPOSITORY_H_
diff --git a/content/renderer/websharedworkerrepository_impl.cc b/content/renderer/websharedworkerrepository_impl.cc
deleted file mode 100644
index d914cf7..0000000
--- a/content/renderer/websharedworkerrepository_impl.cc
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright 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.
-
-#include "content/renderer/websharedworkerrepository_impl.h"
-
-#include "content/child/child_thread.h"
-#include "content/common/view_messages.h"
-#include "content/renderer/websharedworker_proxy.h"
-
-namespace content {
-
-WebSharedWorkerRepositoryImpl::WebSharedWorkerRepositoryImpl() {}
-
-WebSharedWorkerRepositoryImpl::~WebSharedWorkerRepositoryImpl() {}
-
-void WebSharedWorkerRepositoryImpl::addSharedWorker(
- WebKit::WebSharedWorker* worker, DocumentID document) {
- shared_worker_parents_.insert(document);
-}
-
-void WebSharedWorkerRepositoryImpl::documentDetached(DocumentID document) {
- DocumentSet::iterator iter = shared_worker_parents_.find(document);
- if (iter != shared_worker_parents_.end()) {
- // Notify the browser process that the document has shut down.
- ChildThread::current()->Send(new ViewHostMsg_DocumentDetached(document));
- shared_worker_parents_.erase(iter);
- }
-}
-
-bool WebSharedWorkerRepositoryImpl::hasSharedWorkers(DocumentID document) {
- return shared_worker_parents_.find(document) != shared_worker_parents_.end();
-}
-
-} // namespace content
diff --git a/content/renderer/websharedworkerrepository_impl.h b/content/renderer/websharedworkerrepository_impl.h
deleted file mode 100644
index ebe2a22..0000000
--- a/content/renderer/websharedworkerrepository_impl.h
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright (c) 2012 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 CONTENT_RENDERER_WEBSHAREDWORKERREPOSITORY_IMPL_H_
-#define CONTENT_RENDERER_WEBSHAREDWORKERREPOSITORY_IMPL_H_
-
-#include "base/containers/hash_tables.h"
-#include "third_party/WebKit/public/web/WebSharedWorkerRepository.h"
-
-namespace WebKit {
-class WebSharedWorker;
-}
-
-namespace content {
-
-class WebSharedWorkerRepositoryImpl : public WebKit::WebSharedWorkerRepository {
- public:
- WebSharedWorkerRepositoryImpl();
- virtual ~WebSharedWorkerRepositoryImpl();
-
- virtual void addSharedWorker(WebKit::WebSharedWorker*, DocumentID document);
- virtual void documentDetached(DocumentID document);
-
- // Returns true if the document has created a SharedWorker (used by the
- // WebKit code to determine if the document can be suspended).
- virtual bool hasSharedWorkers(DocumentID document);
-
- private:
- // The set of documents that have created a SharedWorker.
- typedef base::hash_set<DocumentID> DocumentSet;
- DocumentSet shared_worker_parents_;
-};
-
-} // namespace content
-
-#endif // CONTENT_RENDERER_WEBSHAREDWORKERREPOSITORY_IMPL_H_