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

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

Issue 2596153002: service worker: Attempt to send WorkerStopped before ProviderDestroyed. (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | content/renderer/service_worker/embedded_worker_instance_client_impl.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/renderer/service_worker/embedded_worker_dispatcher.h" 5 #include "content/renderer/service_worker/embedded_worker_dispatcher.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/metrics/histogram_macros.h" 10 #include "base/metrics/histogram_macros.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 OnResumeAfterDownload) 51 OnResumeAfterDownload)
52 IPC_MESSAGE_HANDLER(EmbeddedWorkerMsg_AddMessageToConsole, 52 IPC_MESSAGE_HANDLER(EmbeddedWorkerMsg_AddMessageToConsole,
53 OnAddMessageToConsole) 53 OnAddMessageToConsole)
54 IPC_MESSAGE_UNHANDLED(handled = false) 54 IPC_MESSAGE_UNHANDLED(handled = false)
55 IPC_END_MESSAGE_MAP() 55 IPC_END_MESSAGE_MAP()
56 return handled; 56 return handled;
57 } 57 }
58 58
59 void EmbeddedWorkerDispatcher::WorkerContextDestroyed( 59 void EmbeddedWorkerDispatcher::WorkerContextDestroyed(
60 int embedded_worker_id) { 60 int embedded_worker_id) {
61 UnregisterWorker(embedded_worker_id);
62 RenderThreadImpl::current()->thread_safe_sender()->Send( 61 RenderThreadImpl::current()->thread_safe_sender()->Send(
63 new EmbeddedWorkerHostMsg_WorkerStopped(embedded_worker_id)); 62 new EmbeddedWorkerHostMsg_WorkerStopped(embedded_worker_id));
63 UnregisterWorker(embedded_worker_id);
64 } 64 }
65 65
66 void EmbeddedWorkerDispatcher::OnStartWorker( 66 void EmbeddedWorkerDispatcher::OnStartWorker(
67 const EmbeddedWorkerStartParams& params) { 67 const EmbeddedWorkerStartParams& params) {
68 DCHECK(!workers_.Lookup(params.embedded_worker_id)); 68 DCHECK(!workers_.Lookup(params.embedded_worker_id));
69 TRACE_EVENT0("ServiceWorker", "EmbeddedWorkerDispatcher::OnStartWorker"); 69 TRACE_EVENT0("ServiceWorker", "EmbeddedWorkerDispatcher::OnStartWorker");
70 std::unique_ptr<WorkerWrapper> wrapper = StartWorkerContext( 70 std::unique_ptr<WorkerWrapper> wrapper = StartWorkerContext(
71 params, base::MakeUnique<ServiceWorkerContextClient>( 71 params, base::MakeUnique<ServiceWorkerContextClient>(
72 params.embedded_worker_id, params.service_worker_version_id, 72 params.embedded_worker_id, params.service_worker_version_id,
73 params.scope, params.script_url, 73 params.scope, params.script_url,
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 void EmbeddedWorkerDispatcher::RecordStopWorkerTimer(int embedded_worker_id) { 174 void EmbeddedWorkerDispatcher::RecordStopWorkerTimer(int embedded_worker_id) {
175 WorkerWrapper* wrapper = workers_.Lookup(embedded_worker_id); 175 WorkerWrapper* wrapper = workers_.Lookup(embedded_worker_id);
176 DCHECK(wrapper); 176 DCHECK(wrapper);
177 // This should eventually call WorkerContextDestroyed. (We may need to post 177 // This should eventually call WorkerContextDestroyed. (We may need to post
178 // a delayed task to forcibly abort the worker context if we find it 178 // a delayed task to forcibly abort the worker context if we find it
179 // necessary) 179 // necessary)
180 stop_worker_times_[embedded_worker_id] = base::TimeTicks::Now(); 180 stop_worker_times_[embedded_worker_id] = base::TimeTicks::Now();
181 } 181 }
182 182
183 } // namespace content 183 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/renderer/service_worker/embedded_worker_instance_client_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698