| 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 12 matching lines...) Expand all Loading... |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 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/WorkerContextPerformance.h" | 33 #include "modules/performance/WorkerGlobalScopePerformance.h" |
| 34 | 34 |
| 35 #include "core/dom/ScriptExecutionContext.h" | 35 #include "core/dom/ScriptExecutionContext.h" |
| 36 #include "core/workers/WorkerContext.h" | 36 #include "core/workers/WorkerGlobalScope.h" |
| 37 #include "modules/performance/WorkerPerformance.h" | 37 #include "modules/performance/WorkerPerformance.h" |
| 38 | 38 |
| 39 namespace WebCore { | 39 namespace WebCore { |
| 40 | 40 |
| 41 WorkerContextPerformance::WorkerContextPerformance() | 41 WorkerGlobalScopePerformance::WorkerGlobalScopePerformance() |
| 42 { | 42 { |
| 43 } | 43 } |
| 44 | 44 |
| 45 WorkerContextPerformance::~WorkerContextPerformance() | 45 WorkerGlobalScopePerformance::~WorkerGlobalScopePerformance() |
| 46 { | 46 { |
| 47 } | 47 } |
| 48 | 48 |
| 49 const char* WorkerContextPerformance::supplementName() | 49 const char* WorkerGlobalScopePerformance::supplementName() |
| 50 { | 50 { |
| 51 return "WorkerContextPerformance"; | 51 return "WorkerGlobalScopePerformance"; |
| 52 } | 52 } |
| 53 | 53 |
| 54 WorkerContextPerformance* WorkerContextPerformance::from(ScriptExecutionContext*
context) | 54 WorkerGlobalScopePerformance* WorkerGlobalScopePerformance::from(ScriptExecution
Context* context) |
| 55 { | 55 { |
| 56 WorkerContextPerformance* supplement = static_cast<WorkerContextPerformance*
>(Supplement<ScriptExecutionContext>::from(context, supplementName())); | 56 WorkerGlobalScopePerformance* supplement = static_cast<WorkerGlobalScopePerf
ormance*>(Supplement<ScriptExecutionContext>::from(context, supplementName())); |
| 57 if (!supplement) { | 57 if (!supplement) { |
| 58 supplement = new WorkerContextPerformance(); | 58 supplement = new WorkerGlobalScopePerformance(); |
| 59 provideTo(context, supplementName(), adoptPtr(supplement)); | 59 provideTo(context, supplementName(), adoptPtr(supplement)); |
| 60 } | 60 } |
| 61 return supplement; | 61 return supplement; |
| 62 } | 62 } |
| 63 | 63 |
| 64 WorkerPerformance* WorkerContextPerformance::performance(ScriptExecutionContext*
context) | 64 WorkerPerformance* WorkerGlobalScopePerformance::performance(ScriptExecutionCont
ext* context) |
| 65 { | 65 { |
| 66 return from(context)->getPerformance(context); | 66 return from(context)->getPerformance(context); |
| 67 } | 67 } |
| 68 | 68 |
| 69 WorkerPerformance* WorkerContextPerformance::getPerformance(ScriptExecutionConte
xt* context) | 69 WorkerPerformance* WorkerGlobalScopePerformance::getPerformance(ScriptExecutionC
ontext* context) |
| 70 { | 70 { |
| 71 if (!m_performance) | 71 if (!m_performance) |
| 72 m_performance = WorkerPerformance::create(context); | 72 m_performance = WorkerPerformance::create(context); |
| 73 return m_performance.get(); | 73 return m_performance.get(); |
| 74 } | 74 } |
| 75 | 75 |
| 76 } // namespace WebCore | 76 } // namespace WebCore |
| OLD | NEW |