OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |