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

Side by Side Diff: content/renderer/shared_worker/embedded_shared_worker_stub.cc

Issue 2847983002: Use unique_ptr for Create{ServiceWorkerNetworkProvider,ApplicationCacheHost} (Closed)
Patch Set: addressed comments Created 3 years, 7 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/renderer/shared_worker/embedded_shared_worker_stub.h" 5 #include "content/renderer/shared_worker/embedded_shared_worker_stub.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/feature_list.h" 10 #include "base/feature_list.h"
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 } 208 }
209 } 209 }
210 210
211 blink::WebNotificationPresenter* 211 blink::WebNotificationPresenter*
212 EmbeddedSharedWorkerStub::NotificationPresenter() { 212 EmbeddedSharedWorkerStub::NotificationPresenter() {
213 // TODO(horo): delete this method if we have no plan to implement this. 213 // TODO(horo): delete this method if we have no plan to implement this.
214 NOTREACHED(); 214 NOTREACHED();
215 return NULL; 215 return NULL;
216 } 216 }
217 217
218 blink::WebApplicationCacheHost* 218 std::unique_ptr<blink::WebApplicationCacheHost>
219 EmbeddedSharedWorkerStub::CreateApplicationCacheHost( 219 EmbeddedSharedWorkerStub::CreateApplicationCacheHost(
220 blink::WebApplicationCacheHostClient* client) { 220 blink::WebApplicationCacheHostClient* client) {
221 app_cache_host_ = new SharedWorkerWebApplicationCacheHostImpl(client); 221 std::unique_ptr<WebApplicationCacheHostImpl> host =
222 return app_cache_host_; 222 base::MakeUnique<SharedWorkerWebApplicationCacheHostImpl>(client);
223 app_cache_host_ = host.get();
224 return std::move(host);
223 } 225 }
224 226
225 blink::WebWorkerContentSettingsClientProxy* 227 blink::WebWorkerContentSettingsClientProxy*
226 EmbeddedSharedWorkerStub::CreateWorkerContentSettingsClientProxy( 228 EmbeddedSharedWorkerStub::CreateWorkerContentSettingsClientProxy(
227 const blink::WebSecurityOrigin& origin) { 229 const blink::WebSecurityOrigin& origin) {
228 return new EmbeddedSharedWorkerContentSettingsClientProxy( 230 return new EmbeddedSharedWorkerContentSettingsClientProxy(
229 url::Origin(origin).GetURL(), origin.IsUnique(), route_id_, 231 url::Origin(origin).GetURL(), origin.IsUnique(), route_id_,
230 ChildThreadImpl::current()->thread_safe_sender()); 232 ChildThreadImpl::current()->thread_safe_sender());
231 } 233 }
232 234
233 blink::WebServiceWorkerNetworkProvider* 235 std::unique_ptr<blink::WebServiceWorkerNetworkProvider>
234 EmbeddedSharedWorkerStub::CreateServiceWorkerNetworkProvider() { 236 EmbeddedSharedWorkerStub::CreateServiceWorkerNetworkProvider() {
235 // Create a content::ServiceWorkerNetworkProvider for this data source so 237 // Create a content::ServiceWorkerNetworkProvider for this data source so
236 // we can observe its requests. 238 // we can observe its requests.
237 std::unique_ptr<ServiceWorkerNetworkProvider> provider( 239 std::unique_ptr<ServiceWorkerNetworkProvider> provider(
238 new ServiceWorkerNetworkProvider( 240 new ServiceWorkerNetworkProvider(
239 route_id_, SERVICE_WORKER_PROVIDER_FOR_SHARED_WORKER, 241 route_id_, SERVICE_WORKER_PROVIDER_FOR_SHARED_WORKER,
240 true /* is_parent_frame_secure */)); 242 true /* is_parent_frame_secure */));
241 243
242 // Blink is responsible for deleting the returned object. 244 // Blink is responsible for deleting the returned object.
243 return new WebServiceWorkerNetworkProviderImpl(std::move(provider), 245 return base::MakeUnique<WebServiceWorkerNetworkProviderImpl>(
244 IsOriginSecure(url_)); 246 std::move(provider), IsOriginSecure(url_));
245 } 247 }
246 248
247 void EmbeddedSharedWorkerStub::SendDevToolsMessage( 249 void EmbeddedSharedWorkerStub::SendDevToolsMessage(
248 int session_id, 250 int session_id,
249 int call_id, 251 int call_id,
250 const blink::WebString& message, 252 const blink::WebString& message,
251 const blink::WebString& state) { 253 const blink::WebString& state) {
252 worker_devtools_agent_->SendDevToolsMessage( 254 worker_devtools_agent_->SendDevToolsMessage(
253 session_id, call_id, message, state); 255 session_id, call_id, message, state);
254 } 256 }
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 } 317 }
316 } 318 }
317 319
318 void EmbeddedSharedWorkerStub::OnTerminateWorkerContext() { 320 void EmbeddedSharedWorkerStub::OnTerminateWorkerContext() {
319 // After this we wouldn't get any IPC for this stub. 321 // After this we wouldn't get any IPC for this stub.
320 running_ = false; 322 running_ = false;
321 impl_->TerminateWorkerContext(); 323 impl_->TerminateWorkerContext();
322 } 324 }
323 325
324 } // namespace content 326 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/shared_worker/embedded_shared_worker_stub.h ('k') | third_party/WebKit/Source/web/LocalFrameClientImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698