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 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 } else { | 328 } else { |
329 UMA_HISTOGRAM_TIMES( | 329 UMA_HISTOGRAM_TIMES( |
330 "EmbeddedWorkerInstance.ScriptLoadWithoutNetworkAccess", | 330 "EmbeddedWorkerInstance.ScriptLoadWithoutNetworkAccess", |
331 base::TimeTicks::Now() - start_timing_); | 331 base::TimeTicks::Now() - start_timing_); |
332 } | 332 } |
333 // Reset |start_timing_| to measure the time excluding the process | 333 // Reset |start_timing_| to measure the time excluding the process |
334 // allocation time and the script loading time. | 334 // allocation time and the script loading time. |
335 start_timing_ = base::TimeTicks::Now(); | 335 start_timing_ = base::TimeTicks::Now(); |
336 } | 336 } |
337 thread_id_ = thread_id; | 337 thread_id_ = thread_id; |
| 338 FOR_EACH_OBSERVER(Listener, listener_list_, OnScriptLoaded()); |
338 } | 339 } |
339 | 340 |
340 void EmbeddedWorkerInstance::OnScriptLoadFailed() { | 341 void EmbeddedWorkerInstance::OnScriptLoadFailed() { |
341 } | 342 } |
342 | 343 |
343 void EmbeddedWorkerInstance::OnScriptEvaluated(bool success) { | 344 void EmbeddedWorkerInstance::OnScriptEvaluated(bool success) { |
344 if (success && !start_timing_.is_null()) { | 345 if (success && !start_timing_.is_null()) { |
345 UMA_HISTOGRAM_TIMES("EmbeddedWorkerInstance.ScriptEvaluate", | 346 UMA_HISTOGRAM_TIMES("EmbeddedWorkerInstance.ScriptEvaluate", |
346 base::TimeTicks::Now() - start_timing_); | 347 base::TimeTicks::Now() - start_timing_); |
347 } | 348 } |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 | 431 |
431 void EmbeddedWorkerInstance::RemoveListener(Listener* listener) { | 432 void EmbeddedWorkerInstance::RemoveListener(Listener* listener) { |
432 listener_list_.RemoveObserver(listener); | 433 listener_list_.RemoveObserver(listener); |
433 } | 434 } |
434 | 435 |
435 void EmbeddedWorkerInstance::OnNetworkAccessedForScriptLoad() { | 436 void EmbeddedWorkerInstance::OnNetworkAccessedForScriptLoad() { |
436 network_accessed_for_script_ = true; | 437 network_accessed_for_script_ = true; |
437 } | 438 } |
438 | 439 |
439 } // namespace content | 440 } // namespace content |
OLD | NEW |