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

Side by Side Diff: content/renderer/service_worker/embedded_worker_instance_client_impl.cc

Issue 2596153002: service worker: Attempt to send WorkerStopped before ProviderDestroyed. (Closed)
Patch Set: Created 3 years, 12 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/renderer/service_worker/embedded_worker_dispatcher.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2016 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/service_worker/embedded_worker_instance_client_impl.h " 5 #include "content/renderer/service_worker/embedded_worker_instance_client_impl.h "
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "content/child/scoped_child_process_reference.h" 10 #include "content/child/scoped_child_process_reference.h"
(...skipping 10 matching lines...) Expand all
21 void EmbeddedWorkerInstanceClientImpl::Create( 21 void EmbeddedWorkerInstanceClientImpl::Create(
22 EmbeddedWorkerDispatcher* dispatcher, 22 EmbeddedWorkerDispatcher* dispatcher,
23 mojo::InterfaceRequest<mojom::EmbeddedWorkerInstanceClient> request) { 23 mojo::InterfaceRequest<mojom::EmbeddedWorkerInstanceClient> request) {
24 // This won't be leaked because the lifetime will be managed internally. 24 // This won't be leaked because the lifetime will be managed internally.
25 new EmbeddedWorkerInstanceClientImpl(dispatcher, std::move(request)); 25 new EmbeddedWorkerInstanceClientImpl(dispatcher, std::move(request));
26 } 26 }
27 27
28 void EmbeddedWorkerInstanceClientImpl::StopWorkerCompleted() { 28 void EmbeddedWorkerInstanceClientImpl::StopWorkerCompleted() {
29 DCHECK(embedded_worker_id_); 29 DCHECK(embedded_worker_id_);
30 DCHECK(stop_callback_); 30 DCHECK(stop_callback_);
31 TRACE_EVENT0("ServiceWorker",
32 "EmbeddedWorkerInstanceClientImpl::StopWorkerCompleted");
33 // TODO(falken): The signals to the browser should be in the order:
34 // (1) WorkerStopped (via stop_callback_)
35 // (2) ProviderDestroyed (via UnregisterWorker destroying
36 // WebEmbeddedWorkerImpl)
37 // But this ordering is currently not guaranteed since the Mojo pipes are
38 // different. https://crbug.com/676526
39 stop_callback_.Run();
40 stop_callback_.Reset();
31 dispatcher_->UnregisterWorker(embedded_worker_id_.value()); 41 dispatcher_->UnregisterWorker(embedded_worker_id_.value());
32 embedded_worker_id_.reset(); 42 embedded_worker_id_.reset();
33 stop_callback_.Run();
34 TRACE_EVENT0("ServiceWorker",
35 "EmbeddedWorkerInstanceClientImpl::StopWorkerCompleted");
36 stop_callback_.Reset();
37 wrapper_ = nullptr; 43 wrapper_ = nullptr;
38 } 44 }
39 45
40 void EmbeddedWorkerInstanceClientImpl::StartWorker( 46 void EmbeddedWorkerInstanceClientImpl::StartWorker(
41 const EmbeddedWorkerStartParams& params, 47 const EmbeddedWorkerStartParams& params,
42 mojom::ServiceWorkerEventDispatcherRequest dispatcher_request) { 48 mojom::ServiceWorkerEventDispatcherRequest dispatcher_request) {
43 DCHECK(ChildThreadImpl::current()); 49 DCHECK(ChildThreadImpl::current());
44 DCHECK(!wrapper_); 50 DCHECK(!wrapper_);
45 TRACE_EVENT0("ServiceWorker", 51 TRACE_EVENT0("ServiceWorker",
46 "EmbeddedWorkerInstanceClientImpl::StartWorker"); 52 "EmbeddedWorkerInstanceClientImpl::StartWorker");
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 } 89 }
84 90
85 EmbeddedWorkerInstanceClientImpl::~EmbeddedWorkerInstanceClientImpl() {} 91 EmbeddedWorkerInstanceClientImpl::~EmbeddedWorkerInstanceClientImpl() {}
86 92
87 void EmbeddedWorkerInstanceClientImpl::OnError() { 93 void EmbeddedWorkerInstanceClientImpl::OnError() {
88 // Removes myself if it's owned by myself. 94 // Removes myself if it's owned by myself.
89 temporal_self_.reset(); 95 temporal_self_.reset();
90 } 96 }
91 97
92 } // namespace content 98 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/service_worker/embedded_worker_dispatcher.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698