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

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

Issue 912753002: Stop Service Workers that execute JavaScript for too long. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix timeout value Created 5 years, 10 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 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_instance.h" 5 #include "content/browser/service_worker/embedded_worker_instance.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 } else { 326 } else {
327 UMA_HISTOGRAM_TIMES( 327 UMA_HISTOGRAM_TIMES(
328 "EmbeddedWorkerInstance.ScriptLoadWithoutNetworkAccess", 328 "EmbeddedWorkerInstance.ScriptLoadWithoutNetworkAccess",
329 base::TimeTicks::Now() - start_timing_); 329 base::TimeTicks::Now() - start_timing_);
330 } 330 }
331 // Reset |start_timing_| to measure the time excluding the process 331 // Reset |start_timing_| to measure the time excluding the process
332 // allocation time and the script loading time. 332 // allocation time and the script loading time.
333 start_timing_ = base::TimeTicks::Now(); 333 start_timing_ = base::TimeTicks::Now();
334 } 334 }
335 thread_id_ = thread_id; 335 thread_id_ = thread_id;
336 FOR_EACH_OBSERVER(Listener, listener_list_, OnScriptLoaded());
336 } 337 }
337 338
338 void EmbeddedWorkerInstance::OnScriptLoadFailed() { 339 void EmbeddedWorkerInstance::OnScriptLoadFailed() {
339 } 340 }
340 341
341 void EmbeddedWorkerInstance::OnScriptEvaluated(bool success) { 342 void EmbeddedWorkerInstance::OnScriptEvaluated(bool success) {
342 if (success && !start_timing_.is_null()) { 343 if (success && !start_timing_.is_null()) {
343 UMA_HISTOGRAM_TIMES("EmbeddedWorkerInstance.ScriptEvaluate", 344 UMA_HISTOGRAM_TIMES("EmbeddedWorkerInstance.ScriptEvaluate",
344 base::TimeTicks::Now() - start_timing_); 345 base::TimeTicks::Now() - start_timing_);
345 } 346 }
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 429
429 void EmbeddedWorkerInstance::RemoveListener(Listener* listener) { 430 void EmbeddedWorkerInstance::RemoveListener(Listener* listener) {
430 listener_list_.RemoveObserver(listener); 431 listener_list_.RemoveObserver(listener);
431 } 432 }
432 433
433 void EmbeddedWorkerInstance::OnNetworkAccessedForScriptLoad() { 434 void EmbeddedWorkerInstance::OnNetworkAccessedForScriptLoad() {
434 network_accessed_for_script_ = true; 435 network_accessed_for_script_ = true;
435 } 436 }
436 437
437 } // namespace content 438 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698