Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "config.h" | 31 #include "config.h" |
| 32 | 32 |
| 33 #include "modules/performance/WorkerGlobalScopePerformance.h" | 33 #include "modules/performance/WorkerGlobalScopePerformance.h" |
| 34 | 34 |
| 35 #include "core/workers/WorkerGlobalScope.h" | 35 #include "core/workers/WorkerGlobalScope.h" |
| 36 #include "heap/ThreadState.h" | |
|
Mads Ager (chromium)
2014/02/26 13:09:08
Why do you need ThreadState here?
sof
2014/02/26 14:36:25
Removed.
| |
| 36 #include "modules/performance/WorkerPerformance.h" | 37 #include "modules/performance/WorkerPerformance.h" |
| 37 | 38 |
| 38 namespace WebCore { | 39 namespace WebCore { |
| 39 | 40 |
| 40 WorkerGlobalScopePerformance::WorkerGlobalScopePerformance() | 41 WorkerGlobalScopePerformance::WorkerGlobalScopePerformance() |
| 41 { | 42 { |
| 42 } | 43 } |
| 43 | 44 |
| 44 WorkerGlobalScopePerformance::~WorkerGlobalScopePerformance() | 45 WorkerGlobalScopePerformance::~WorkerGlobalScopePerformance() |
| 45 { | 46 { |
| 46 } | 47 } |
| 47 | 48 |
| 48 const char* WorkerGlobalScopePerformance::supplementName() | 49 const char* WorkerGlobalScopePerformance::supplementName() |
| 49 { | 50 { |
| 50 return "WorkerGlobalScopePerformance"; | 51 return "WorkerGlobalScopePerformance"; |
| 51 } | 52 } |
| 52 | 53 |
| 53 WorkerGlobalScopePerformance& WorkerGlobalScopePerformance::from(WorkerGlobalSco pe& context) | 54 WorkerGlobalScopePerformance& WorkerGlobalScopePerformance::from(WorkerGlobalSco pe& context) |
| 54 { | 55 { |
| 55 WorkerGlobalScopePerformance* supplement = static_cast<WorkerGlobalScopePerf ormance*>(WorkerSupplement::from(context, supplementName())); | 56 WorkerGlobalScopePerformance* supplement = static_cast<WorkerGlobalScopePerf ormance*>(WorkerSupplement::from(context, supplementName())); |
| 56 if (!supplement) { | 57 if (!supplement) { |
| 57 supplement = new WorkerGlobalScopePerformance(); | 58 supplement = new WorkerGlobalScopePerformance(); |
| 58 provideTo(context, supplementName(), adoptPtr(supplement)); | 59 provideTo(context, supplementName(), adoptPtrWillBeNoop(supplement)); |
| 59 } | 60 } |
| 60 return *supplement; | 61 return *supplement; |
| 61 } | 62 } |
| 62 | 63 |
| 63 WorkerPerformance* WorkerGlobalScopePerformance::performance(WorkerGlobalScope& context) | 64 WorkerPerformance* WorkerGlobalScopePerformance::performance(WorkerGlobalScope& context) |
| 64 { | 65 { |
| 65 return from(context).performance(); | 66 return from(context).performance(); |
| 66 } | 67 } |
| 67 | 68 |
| 68 WorkerPerformance* WorkerGlobalScopePerformance::performance() | 69 WorkerPerformance* WorkerGlobalScopePerformance::performance() |
| 69 { | 70 { |
| 70 if (!m_performance) | 71 if (!m_performance) |
| 71 m_performance = WorkerPerformance::create(); | 72 m_performance = WorkerPerformance::create(); |
| 72 return m_performance.get(); | 73 return m_performance.get(); |
| 73 } | 74 } |
| 74 | 75 |
| 76 void WorkerGlobalScopePerformance::trace(Visitor* visitor) | |
| 77 { | |
| 78 visitor->trace(m_performance); | |
| 79 } | |
| 80 | |
| 75 } // namespace WebCore | 81 } // namespace WebCore |
| OLD | NEW |