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

Side by Side Diff: content/browser/service_worker/embedded_worker_registry.cc

Issue 2574663002: TabManager checks if ServiceWorker exists on the suspending process (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
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/browser/service_worker/embedded_worker_registry.h" 5 #include "content/browser/service_worker/embedded_worker_registry.h"
6 6
7 #include "base/bind_helpers.h" 7 #include "base/bind_helpers.h"
8 #include "base/metrics/histogram_macros.h" 8 #include "base/metrics/histogram_macros.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "content/browser/renderer_host/render_widget_helper.h" 10 #include "content/browser/renderer_host/render_widget_helper.h"
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 const base::string16& message, 172 const base::string16& message,
173 int line_number, 173 int line_number,
174 const GURL& source_url) { 174 const GURL& source_url) {
175 EmbeddedWorkerInstance* worker = GetWorker(embedded_worker_id); 175 EmbeddedWorkerInstance* worker = GetWorker(embedded_worker_id);
176 if (!worker) 176 if (!worker)
177 return; 177 return;
178 worker->OnReportConsoleMessage(source_identifier, message_level, message, 178 worker->OnReportConsoleMessage(source_identifier, message_level, message,
179 line_number, source_url); 179 line_number, source_url);
180 } 180 }
181 181
182 bool EmbeddedWorkerRegistry::IsWorkerExists(int process_id) {
183 return base::ContainsKey(worker_process_map_, process_id);
184 }
185
182 void EmbeddedWorkerRegistry::AddChildProcessSender( 186 void EmbeddedWorkerRegistry::AddChildProcessSender(
183 int process_id, 187 int process_id,
184 IPC::Sender* sender, 188 IPC::Sender* sender,
185 MessagePortMessageFilter* message_port_message_filter) { 189 MessagePortMessageFilter* message_port_message_filter) {
186 process_sender_map_[process_id] = sender; 190 process_sender_map_[process_id] = sender;
187 process_message_port_message_filter_map_[process_id] = 191 process_message_port_message_filter_map_[process_id] =
188 message_port_message_filter; 192 message_port_message_filter;
189 DCHECK(!base::ContainsKey(worker_process_map_, process_id)); 193 DCHECK(!base::ContainsKey(worker_process_map_, process_id));
190 } 194 }
191 195
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 EmbeddedWorkerInstance* worker = GetWorker(embedded_worker_id); 324 EmbeddedWorkerInstance* worker = GetWorker(embedded_worker_id);
321 if (!worker || worker->process_id() != process_id) { 325 if (!worker || worker->process_id() != process_id) {
322 UMA_HISTOGRAM_BOOLEAN("ServiceWorker.WorkerForMessageFound", false); 326 UMA_HISTOGRAM_BOOLEAN("ServiceWorker.WorkerForMessageFound", false);
323 return nullptr; 327 return nullptr;
324 } 328 }
325 UMA_HISTOGRAM_BOOLEAN("ServiceWorker.WorkerForMessageFound", true); 329 UMA_HISTOGRAM_BOOLEAN("ServiceWorker.WorkerForMessageFound", true);
326 return worker; 330 return worker;
327 } 331 }
328 332
329 } // namespace content 333 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698