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

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

Issue 2480293004: Mandate unique_ptr for base::IDMap in IDMapOwnPointer mode. (Closed)
Patch Set: Make changes requested by danakj, fix a few more headers Created 4 years 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 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_provider_impl.h" 5 #include "content/child/service_worker/web_service_worker_provider_impl.h"
6 6
7 #include <memory>
8 #include <utility>
9
7 #include "content/child/service_worker/service_worker_dispatcher.h" 10 #include "content/child/service_worker/service_worker_dispatcher.h"
8 #include "content/child/service_worker/service_worker_handle_reference.h" 11 #include "content/child/service_worker/service_worker_handle_reference.h"
9 #include "content/child/service_worker/service_worker_provider_context.h" 12 #include "content/child/service_worker/service_worker_provider_context.h"
10 #include "content/child/service_worker/web_service_worker_impl.h" 13 #include "content/child/service_worker/web_service_worker_impl.h"
11 #include "content/child/thread_safe_sender.h" 14 #include "content/child/thread_safe_sender.h"
12 #include "content/common/service_worker/service_worker_utils.h" 15 #include "content/common/service_worker/service_worker_utils.h"
13 #include "third_party/WebKit/public/platform/WebURL.h" 16 #include "third_party/WebKit/public/platform/WebURL.h"
14 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor kerProviderClient.h" 17 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor kerProviderClient.h"
15 18
16 using blink::WebURL; 19 using blink::WebURL;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 GetDispatcher()->GetOrCreateServiceWorker( 53 GetDispatcher()->GetOrCreateServiceWorker(
51 ServiceWorkerHandleReference::Create(context_->controller()->info(), 54 ServiceWorkerHandleReference::Create(context_->controller()->info(),
52 thread_safe_sender_.get())); 55 thread_safe_sender_.get()));
53 client->setController(WebServiceWorkerImpl::CreateHandle(controller), 56 client->setController(WebServiceWorkerImpl::CreateHandle(controller),
54 false /* shouldNotifyControllerChange */); 57 false /* shouldNotifyControllerChange */);
55 } 58 }
56 59
57 void WebServiceWorkerProviderImpl::registerServiceWorker( 60 void WebServiceWorkerProviderImpl::registerServiceWorker(
58 const WebURL& pattern, 61 const WebURL& pattern,
59 const WebURL& script_url, 62 const WebURL& script_url,
60 WebServiceWorkerRegistrationCallbacks* callbacks) { 63 std::unique_ptr<WebServiceWorkerRegistrationCallbacks> callbacks) {
61 GetDispatcher()->RegisterServiceWorker( 64 GetDispatcher()->RegisterServiceWorker(context_->provider_id(), pattern,
62 context_->provider_id(), pattern, script_url, callbacks); 65 script_url, std::move(callbacks));
63 } 66 }
64 67
65 void WebServiceWorkerProviderImpl::getRegistration( 68 void WebServiceWorkerProviderImpl::getRegistration(
66 const blink::WebURL& document_url, 69 const blink::WebURL& document_url,
67 WebServiceWorkerGetRegistrationCallbacks* callbacks) { 70 std::unique_ptr<WebServiceWorkerGetRegistrationCallbacks> callbacks) {
68 GetDispatcher()->GetRegistration( 71 GetDispatcher()->GetRegistration(context_->provider_id(), document_url,
69 context_->provider_id(), document_url, callbacks); 72 std::move(callbacks));
70 } 73 }
71 74
72 void WebServiceWorkerProviderImpl::getRegistrations( 75 void WebServiceWorkerProviderImpl::getRegistrations(
73 WebServiceWorkerGetRegistrationsCallbacks* callbacks) { 76 std::unique_ptr<WebServiceWorkerGetRegistrationsCallbacks> callbacks) {
74 GetDispatcher()->GetRegistrations( 77 GetDispatcher()->GetRegistrations(context_->provider_id(),
75 context_->provider_id(), callbacks); 78 std::move(callbacks));
76 } 79 }
77 80
78 void WebServiceWorkerProviderImpl::getRegistrationForReady( 81 void WebServiceWorkerProviderImpl::getRegistrationForReady(
79 WebServiceWorkerGetRegistrationForReadyCallbacks* callbacks) { 82 std::unique_ptr<WebServiceWorkerGetRegistrationForReadyCallbacks>
80 GetDispatcher()->GetRegistrationForReady(context_->provider_id(), callbacks); 83 callbacks) {
84 GetDispatcher()->GetRegistrationForReady(context_->provider_id(),
85 std::move(callbacks));
81 } 86 }
82 87
83 bool WebServiceWorkerProviderImpl::validateScopeAndScriptURL( 88 bool WebServiceWorkerProviderImpl::validateScopeAndScriptURL(
84 const blink::WebURL& scope, 89 const blink::WebURL& scope,
85 const blink::WebURL& script_url, 90 const blink::WebURL& script_url,
86 blink::WebString* error_message) { 91 blink::WebString* error_message) {
87 std::string error; 92 std::string error;
88 bool has_error = ServiceWorkerUtils::ContainsDisallowedCharacter( 93 bool has_error = ServiceWorkerUtils::ContainsDisallowedCharacter(
89 scope, script_url, &error); 94 scope, script_url, &error);
90 if (has_error) 95 if (has_error)
(...skipping 12 matching lines...) Expand all
103 ServiceWorkerDispatcher::GetThreadSpecificInstance(); 108 ServiceWorkerDispatcher::GetThreadSpecificInstance();
104 if (dispatcher) 109 if (dispatcher)
105 dispatcher->RemoveProviderClient(context_->provider_id()); 110 dispatcher->RemoveProviderClient(context_->provider_id());
106 } 111 }
107 112
108 ServiceWorkerDispatcher* WebServiceWorkerProviderImpl::GetDispatcher() { 113 ServiceWorkerDispatcher* WebServiceWorkerProviderImpl::GetDispatcher() {
109 return ServiceWorkerDispatcher::GetThreadSpecificInstance(); 114 return ServiceWorkerDispatcher::GetThreadSpecificInstance();
110 } 115 }
111 116
112 } // namespace content 117 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698