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

Side by Side Diff: content/child/service_worker/web_service_worker_impl.cc

Issue 1815363002: Add RetainedRef uses where needed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 unified diff | Download patch
« no previous file with comments | « content/child/fileapi/webfilesystem_impl.cc ('k') | content/public/test/browser_test_utils.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/child/service_worker/web_service_worker_impl.h" 5 #include "content/child/service_worker/web_service_worker_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "content/child/service_worker/service_worker_dispatcher.h" 10 #include "content/child/service_worker/service_worker_dispatcher.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 ServiceWorkerDispatcher* dispatcher = 115 ServiceWorkerDispatcher* dispatcher =
116 ServiceWorkerDispatcher::GetThreadSpecificInstance(); 116 ServiceWorkerDispatcher::GetThreadSpecificInstance();
117 DCHECK(dispatcher); 117 DCHECK(dispatcher);
118 118
119 // This may send channels for MessagePorts, and all internal book-keeping 119 // This may send channels for MessagePorts, and all internal book-keeping
120 // messages for MessagePort (e.g. QueueMessages) are sent from main thread 120 // messages for MessagePort (e.g. QueueMessages) are sent from main thread
121 // (with thread hopping), so we need to do the same thread hopping here not 121 // (with thread hopping), so we need to do the same thread hopping here not
122 // to overtake those messages. 122 // to overtake those messages.
123 dispatcher->main_thread_task_runner()->PostTask( 123 dispatcher->main_thread_task_runner()->PostTask(
124 FROM_HERE, 124 FROM_HERE,
125 base::Bind(&SendPostMessageToWorkerOnMainThread, thread_safe_sender_, 125 base::Bind(&SendPostMessageToWorkerOnMainThread,
126 base::RetainedRef(thread_safe_sender_),
126 handle_ref_->handle_id(), provider_impl->provider_id(), 127 handle_ref_->handle_id(), provider_impl->provider_id(),
127 // We cast WebString to string16 before crossing 128 // We cast WebString to string16 before crossing
128 // threads for thread-safety. 129 // threads for thread-safety.
129 static_cast<base::string16>(message), 130 static_cast<base::string16>(message),
130 url::Origin(source_origin), 131 url::Origin(source_origin),
131 base::Passed(make_scoped_ptr(channels)))); 132 base::Passed(make_scoped_ptr(channels))));
132 } 133 }
133 134
134 void WebServiceWorkerImpl::terminate() { 135 void WebServiceWorkerImpl::terminate() {
135 thread_safe_sender_->Send( 136 thread_safe_sender_->Send(
(...skipping 10 matching lines...) Expand all
146 } 147 }
147 148
148 WebServiceWorkerImpl::~WebServiceWorkerImpl() { 149 WebServiceWorkerImpl::~WebServiceWorkerImpl() {
149 ServiceWorkerDispatcher* dispatcher = 150 ServiceWorkerDispatcher* dispatcher =
150 ServiceWorkerDispatcher::GetThreadSpecificInstance(); 151 ServiceWorkerDispatcher::GetThreadSpecificInstance();
151 if (dispatcher) 152 if (dispatcher)
152 dispatcher->RemoveServiceWorker(handle_ref_->handle_id()); 153 dispatcher->RemoveServiceWorker(handle_ref_->handle_id());
153 } 154 }
154 155
155 } // namespace content 156 } // namespace content
OLDNEW
« no previous file with comments | « content/child/fileapi/webfilesystem_impl.cc ('k') | content/public/test/browser_test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698