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" | |
36 #include "modules/performance/WorkerPerformance.h" | 37 #include "modules/performance/WorkerPerformance.h" |
37 | 38 |
38 namespace WebCore { | 39 namespace WebCore { |
39 | 40 |
41 #if 0 | |
Mads Ager (chromium)
2014/02/26 08:00:36
Remove the code. :)
sof
2014/02/26 09:11:21
Oops; experimental sins removed.
| |
42 class WorkerPerformanceCleanupTask : public ThreadState::CleanupTask { | |
43 public: | |
44 static PassOwnPtr<WorkerPerformanceCleanupTask> create(const RawPtr<WorkerGl obalScopePerformance>& p) | |
45 { | |
46 return adoptPtr(new WorkerPerformanceCleanupTask(p)); | |
47 } | |
48 | |
49 virtual void preCleanup() | |
50 { | |
51 m_performance->detach(); | |
52 } | |
53 | |
54 private: | |
55 explicit WorkerPerformanceCleanupTask(const RawPtr<WorkerGlobalScopePerforma nce>& p) : m_performance(p) { } | |
56 | |
57 RawPtr<WorkerGlobalScopePerformance> m_performance; | |
58 }; | |
59 #endif | |
60 | |
40 WorkerGlobalScopePerformance::WorkerGlobalScopePerformance() | 61 WorkerGlobalScopePerformance::WorkerGlobalScopePerformance() |
41 { | 62 { |
42 } | 63 } |
43 | 64 |
44 WorkerGlobalScopePerformance::~WorkerGlobalScopePerformance() | 65 WorkerGlobalScopePerformance::~WorkerGlobalScopePerformance() |
45 { | 66 { |
46 } | 67 } |
47 | 68 |
48 const char* WorkerGlobalScopePerformance::supplementName() | 69 const char* WorkerGlobalScopePerformance::supplementName() |
49 { | 70 { |
50 return "WorkerGlobalScopePerformance"; | 71 return "WorkerGlobalScopePerformance"; |
51 } | 72 } |
52 | 73 |
53 WorkerGlobalScopePerformance& WorkerGlobalScopePerformance::from(WorkerGlobalSco pe& context) | 74 WorkerGlobalScopePerformance& WorkerGlobalScopePerformance::from(WorkerGlobalSco pe& context) |
54 { | 75 { |
55 WorkerGlobalScopePerformance* supplement = static_cast<WorkerGlobalScopePerf ormance*>(WorkerSupplement::from(context, supplementName())); | 76 WorkerGlobalScopePerformance* supplement = static_cast<WorkerGlobalScopePerf ormance*>(WorkerSupplement::from(context, supplementName())); |
56 if (!supplement) { | 77 if (!supplement) { |
57 supplement = new WorkerGlobalScopePerformance(); | 78 supplement = new WorkerGlobalScopePerformance(); |
58 provideTo(context, supplementName(), adoptPtr(supplement)); | 79 provideTo(context, supplementName(), adoptPtrWillBeNoop(supplement)); |
59 } | 80 } |
60 return *supplement; | 81 return *supplement; |
61 } | 82 } |
62 | 83 |
63 WorkerPerformance* WorkerGlobalScopePerformance::performance(WorkerGlobalScope& context) | 84 WorkerPerformance* WorkerGlobalScopePerformance::performance(WorkerGlobalScope& context) |
64 { | 85 { |
65 return from(context).performance(); | 86 return from(context).performance(); |
66 } | 87 } |
67 | 88 |
68 WorkerPerformance* WorkerGlobalScopePerformance::performance() | 89 WorkerPerformance* WorkerGlobalScopePerformance::performance() |
69 { | 90 { |
70 if (!m_performance) | 91 if (!m_performance) |
71 m_performance = WorkerPerformance::create(); | 92 m_performance = WorkerPerformance::create(); |
72 return m_performance.get(); | 93 return m_performance.get(); |
73 } | 94 } |
74 | 95 |
96 void WorkerGlobalScopePerformance::trace(Visitor* visitor) | |
97 { | |
98 visitor->trace(m_performance); | |
99 } | |
100 | |
75 } // namespace WebCore | 101 } // namespace WebCore |
OLD | NEW |