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

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

Issue 1865913005: Nuke WebPassOwnPtr<T> and replace it with std::unique_ptr<T>. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "base/macros.h" 5 #include "base/macros.h"
6 #include "content/child/service_worker/service_worker_dispatcher.h" 6 #include "content/child/service_worker/service_worker_dispatcher.h"
7 #include "content/child/service_worker/service_worker_handle_reference.h" 7 #include "content/child/service_worker/service_worker_handle_reference.h"
8 #include "content/child/service_worker/service_worker_provider_context.h" 8 #include "content/child/service_worker/service_worker_provider_context.h"
9 #include "content/child/service_worker/web_service_worker_impl.h" 9 #include "content/child/service_worker/web_service_worker_impl.h"
10 #include "content/child/service_worker/web_service_worker_registration_impl.h" 10 #include "content/child/service_worker/web_service_worker_registration_impl.h"
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 MockWebServiceWorkerProviderClientImpl(int provider_id, 118 MockWebServiceWorkerProviderClientImpl(int provider_id,
119 ServiceWorkerDispatcher* dispatcher) 119 ServiceWorkerDispatcher* dispatcher)
120 : provider_id_(provider_id), dispatcher_(dispatcher) { 120 : provider_id_(provider_id), dispatcher_(dispatcher) {
121 dispatcher_->AddProviderClient(provider_id, this); 121 dispatcher_->AddProviderClient(provider_id, this);
122 } 122 }
123 123
124 ~MockWebServiceWorkerProviderClientImpl() override { 124 ~MockWebServiceWorkerProviderClientImpl() override {
125 dispatcher_->RemoveProviderClient(provider_id_); 125 dispatcher_->RemoveProviderClient(provider_id_);
126 } 126 }
127 127
128 void setController( 128 void setController(std::unique_ptr<blink::WebServiceWorker::Handle> handle,
129 blink::WebPassOwnPtr<blink::WebServiceWorker::Handle> handle, 129 bool shouldNotifyControllerChange) override {
130 bool shouldNotifyControllerChange) override {
131 // WebPassOwnPtr cannot be owned in Chromium, so drop the handle here. 130 // WebPassOwnPtr cannot be owned in Chromium, so drop the handle here.
132 // The destruction releases ServiceWorkerHandleReference. 131 // The destruction releases ServiceWorkerHandleReference.
133 is_set_controlled_called_ = true; 132 is_set_controlled_called_ = true;
134 } 133 }
135 134
136 void dispatchMessageEvent( 135 void dispatchMessageEvent(
137 blink::WebPassOwnPtr<blink::WebServiceWorker::Handle> handle, 136 std::unique_ptr<blink::WebServiceWorker::Handle> handle,
138 const blink::WebString& message, 137 const blink::WebString& message,
139 const blink::WebMessagePortChannelArray& channels) override { 138 const blink::WebMessagePortChannelArray& channels) override {
140 // WebPassOwnPtr cannot be owned in Chromium, so drop the handle here. 139 // WebPassOwnPtr cannot be owned in Chromium, so drop the handle here.
141 // The destruction releases ServiceWorkerHandleReference. 140 // The destruction releases ServiceWorkerHandleReference.
142 is_dispatch_message_event_called_ = true; 141 is_dispatch_message_event_called_ = true;
143 } 142 }
144 143
145 bool is_set_controlled_called() const { return is_set_controlled_called_; } 144 bool is_set_controlled_called() const { return is_set_controlled_called_; }
146 145
147 bool is_dispatch_message_event_called() const { 146 bool is_dispatch_message_event_called() const {
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 ipc_sink()->GetMessageAt(0)->type()); 514 ipc_sink()->GetMessageAt(0)->type());
516 EXPECT_EQ(ServiceWorkerHostMsg_DecrementServiceWorkerRefCount::ID, 515 EXPECT_EQ(ServiceWorkerHostMsg_DecrementServiceWorkerRefCount::ID,
517 ipc_sink()->GetMessageAt(1)->type()); 516 ipc_sink()->GetMessageAt(1)->type());
518 EXPECT_EQ(ServiceWorkerHostMsg_DecrementServiceWorkerRefCount::ID, 517 EXPECT_EQ(ServiceWorkerHostMsg_DecrementServiceWorkerRefCount::ID,
519 ipc_sink()->GetMessageAt(2)->type()); 518 ipc_sink()->GetMessageAt(2)->type());
520 EXPECT_EQ(ServiceWorkerHostMsg_DecrementRegistrationRefCount::ID, 519 EXPECT_EQ(ServiceWorkerHostMsg_DecrementRegistrationRefCount::ID,
521 ipc_sink()->GetMessageAt(3)->type()); 520 ipc_sink()->GetMessageAt(3)->type());
522 } 521 }
523 522
524 } // namespace content 523 } // namespace content
OLDNEW
« no previous file with comments | « content/child/service_worker/service_worker_dispatcher.cc ('k') | content/child/service_worker/web_service_worker_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698