diff options
8 files changed, 40 insertions, 36 deletions
diff --git a/content/child/webmessageportchannel_impl.cc b/content/child/webmessageportchannel_impl.cc index 17b7b16..e0fe126 100644 --- a/content/child/webmessageportchannel_impl.cc +++ b/content/child/webmessageportchannel_impl.cc @@ -60,6 +60,23 @@ WebMessagePortChannelImpl::~WebMessagePortChannelImpl() { } // static +void WebMessagePortChannelImpl::CreatePair( + base::MessageLoopProxy* child_thread_loop, + blink::WebMessagePortChannel** channel1, + blink::WebMessagePortChannel** channel2) { + WebMessagePortChannelImpl* impl1 = + new WebMessagePortChannelImpl(child_thread_loop); + WebMessagePortChannelImpl* impl2 = + new WebMessagePortChannelImpl(child_thread_loop); + + impl1->Entangle(impl2); + impl2->Entangle(impl1); + + *channel1 = impl1; + *channel2 = impl2; +} + +// static std::vector<int> WebMessagePortChannelImpl::ExtractMessagePortIDs( WebMessagePortChannelArray* channels) { std::vector<int> message_port_ids; @@ -93,12 +110,7 @@ void WebMessagePortChannelImpl::destroy() { } void WebMessagePortChannelImpl::entangle(WebMessagePortChannel* channel) { - // The message port ids might not be set up yet, if this channel wasn't - // created on the main thread. So need to wait until we're on the main thread - // before getting the other message port id. - scoped_refptr<WebMessagePortChannelImpl> webchannel( - static_cast<WebMessagePortChannelImpl*>(channel)); - Entangle(webchannel); + NOTREACHED(); // DEPRECATED } void WebMessagePortChannelImpl::postMessage( @@ -160,6 +172,9 @@ void WebMessagePortChannelImpl::Init() { void WebMessagePortChannelImpl::Entangle( scoped_refptr<WebMessagePortChannelImpl> channel) { + // The message port ids might not be set up yet, if this channel wasn't + // created on the main thread. So need to wait until we're on the main thread + // before getting the other message port id. if (!child_thread_loop_->BelongsToCurrentThread()) { child_thread_loop_->PostTask( FROM_HERE, diff --git a/content/child/webmessageportchannel_impl.h b/content/child/webmessageportchannel_impl.h index 1fe46e8..3098d62 100644 --- a/content/child/webmessageportchannel_impl.h +++ b/content/child/webmessageportchannel_impl.h @@ -33,6 +33,10 @@ class WebMessagePortChannelImpl int message_port_id, base::MessageLoopProxy* child_thread_loop); + static void CreatePair(base::MessageLoopProxy* child_thread_loop, + blink::WebMessagePortChannel** channel1, + blink::WebMessagePortChannel** channel2); + // Extracts port IDs for passing on to the browser process, and queues any // received messages. Takes ownership of the passed array (and deletes it). static std::vector<int> ExtractMessagePortIDs( diff --git a/content/ppapi_plugin/ppapi_webkitplatformsupport_impl.cc b/content/ppapi_plugin/ppapi_webkitplatformsupport_impl.cc index 948b025..bdaf47d 100644 --- a/content/ppapi_plugin/ppapi_webkitplatformsupport_impl.cc +++ b/content/ppapi_plugin/ppapi_webkitplatformsupport_impl.cc @@ -183,10 +183,12 @@ bool PpapiWebKitPlatformSupportImpl::isLinkVisited( return false; } -blink::WebMessagePortChannel* -PpapiWebKitPlatformSupportImpl::createMessagePortChannel() { +void PpapiWebKitPlatformSupportImpl::createMessageChannel( + blink::WebMessagePortChannel** channel1, + blink::WebMessagePortChannel** channel2) { NOTREACHED(); - return NULL; + *channel1 = NULL; + *channel2 = NULL; } void PpapiWebKitPlatformSupportImpl::setCookies( diff --git a/content/ppapi_plugin/ppapi_webkitplatformsupport_impl.h b/content/ppapi_plugin/ppapi_webkitplatformsupport_impl.h index f063506..3361304 100644 --- a/content/ppapi_plugin/ppapi_webkitplatformsupport_impl.h +++ b/content/ppapi_plugin/ppapi_webkitplatformsupport_impl.h @@ -28,7 +28,8 @@ class PpapiWebKitPlatformSupportImpl : public BlinkPlatformImpl { virtual unsigned long long visitedLinkHash(const char* canonicalURL, size_t length); virtual bool isLinkVisited(unsigned long long linkHash); - virtual blink::WebMessagePortChannel* createMessagePortChannel(); + virtual void createMessageChannel(blink::WebMessagePortChannel** channel1, + blink::WebMessagePortChannel** channel2); virtual void setCookies(const blink::WebURL& url, const blink::WebURL& first_party_for_cookies, const blink::WebString& value); diff --git a/content/renderer/renderer_webkitplatformsupport_impl.cc b/content/renderer/renderer_webkitplatformsupport_impl.cc index 367bc53..ca92d5e 100644 --- a/content/renderer/renderer_webkitplatformsupport_impl.cc +++ b/content/renderer/renderer_webkitplatformsupport_impl.cc @@ -315,18 +315,11 @@ bool RendererWebKitPlatformSupportImpl::isLinkVisited( return GetContentClient()->renderer()->IsLinkVisited(link_hash); } -blink::WebMessagePortChannel* -RendererWebKitPlatformSupportImpl::createMessagePortChannel() { - return new WebMessagePortChannelImpl(child_thread_loop_.get()); -} - void RendererWebKitPlatformSupportImpl::createMessageChannel( blink::WebMessagePortChannel** channel1, blink::WebMessagePortChannel** channel2) { - *channel1 = new WebMessagePortChannelImpl(child_thread_loop_.get()); - *channel2 = new WebMessagePortChannelImpl(child_thread_loop_.get()); - (*channel1)->entangle(*channel2); - (*channel2)->entangle(*channel1); + WebMessagePortChannelImpl::CreatePair( + child_thread_loop_.get(), channel1, channel2); } blink::WebPrescientNetworking* diff --git a/content/renderer/renderer_webkitplatformsupport_impl.h b/content/renderer/renderer_webkitplatformsupport_impl.h index 2ca0057..9fa0115 100644 --- a/content/renderer/renderer_webkitplatformsupport_impl.h +++ b/content/renderer/renderer_webkitplatformsupport_impl.h @@ -67,10 +67,8 @@ class CONTENT_EXPORT RendererWebKitPlatformSupportImpl virtual unsigned long long visitedLinkHash( const char* canonicalURL, size_t length); virtual bool isLinkVisited(unsigned long long linkHash); - virtual blink::WebMessagePortChannel* createMessagePortChannel(); - virtual void createMessageChannel( - blink::WebMessagePortChannel** channel1, - blink::WebMessagePortChannel** channel2); + virtual void createMessageChannel(blink::WebMessagePortChannel** channel1, + blink::WebMessagePortChannel** channel2); virtual blink::WebPrescientNetworking* prescientNetworking(); virtual void cacheMetadata( const blink::WebURL&, double, const char*, size_t); diff --git a/content/worker/worker_webkitplatformsupport_impl.cc b/content/worker/worker_webkitplatformsupport_impl.cc index 10bca94..3a57f94 100644 --- a/content/worker/worker_webkitplatformsupport_impl.cc +++ b/content/worker/worker_webkitplatformsupport_impl.cc @@ -142,18 +142,11 @@ bool WorkerWebKitPlatformSupportImpl::isLinkVisited( return false; } -WebMessagePortChannel* -WorkerWebKitPlatformSupportImpl::createMessagePortChannel() { - return new WebMessagePortChannelImpl(child_thread_loop_.get()); -} - void WorkerWebKitPlatformSupportImpl::createMessageChannel( blink::WebMessagePortChannel** channel1, blink::WebMessagePortChannel** channel2) { - *channel1 = new WebMessagePortChannelImpl(child_thread_loop_.get()); - *channel2 = new WebMessagePortChannelImpl(child_thread_loop_.get()); - (*channel1)->entangle(*channel2); - (*channel2)->entangle(*channel1); + WebMessagePortChannelImpl::CreatePair( + child_thread_loop_.get(), channel1, channel2); } void WorkerWebKitPlatformSupportImpl::setCookies( diff --git a/content/worker/worker_webkitplatformsupport_impl.h b/content/worker/worker_webkitplatformsupport_impl.h index 5805483..9fa56d4 100644 --- a/content/worker/worker_webkitplatformsupport_impl.h +++ b/content/worker/worker_webkitplatformsupport_impl.h @@ -47,10 +47,8 @@ class WorkerWebKitPlatformSupportImpl : public BlinkPlatformImpl, virtual unsigned long long visitedLinkHash(const char* canonicalURL, size_t length); virtual bool isLinkVisited(unsigned long long linkHash); - virtual blink::WebMessagePortChannel* createMessagePortChannel(); - virtual void createMessageChannel( - blink::WebMessagePortChannel** channel1, - blink::WebMessagePortChannel** channel2); + virtual void createMessageChannel(blink::WebMessagePortChannel** channel1, + blink::WebMessagePortChannel** channel2); virtual void setCookies(const blink::WebURL& url, const blink::WebURL& first_party_for_cookies, const blink::WebString& value); |