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 11 matching lines...) Expand all Loading... | |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 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 #include "modules/crypto/DOMWindowCrypto.h" | |
| 33 | 32 |
| 34 #include "core/page/DOMWindow.h" | 33 #include "modules/performance/WorkerContextPerformance.h" |
| 35 #include "core/page/Frame.h" | 34 |
| 36 #include "modules/crypto/Crypto.h" | 35 #include "core/dom/ScriptExecutionContext.h" |
| 36 #include "core/workers/WorkerContext.h" | |
| 37 #include "modules/performance/WorkerPerformance.h" | |
| 37 | 38 |
| 38 namespace WebCore { | 39 namespace WebCore { |
| 39 | 40 |
| 40 DOMWindowCrypto::DOMWindowCrypto(DOMWindow* window) | 41 WorkerContextPerformance::WorkerContextPerformance() |
|
levin
2013/06/13 19:55:22
How is it deleted?
abarth-chromium
2013/06/13 20:18:19
class WorkerContextPerformance : public Supplement
levin
2013/06/13 22:19:08
I was looking for a destructor on Supplement and I
| |
| 41 : DOMWindowProperty(window->frame()) | |
| 42 { | 42 { |
| 43 } | 43 } |
| 44 | 44 |
| 45 DOMWindowCrypto::~DOMWindowCrypto() | 45 WorkerContextPerformance::~WorkerContextPerformance() |
| 46 { | 46 { |
| 47 } | 47 } |
| 48 | 48 |
| 49 const char* DOMWindowCrypto::supplementName() | 49 const char* WorkerContextPerformance::supplementName() |
| 50 { | 50 { |
| 51 return "DOMWindowCrypto"; | 51 return "WorkerContextPerformance"; |
| 52 } | 52 } |
| 53 | 53 |
| 54 // static | 54 WorkerContextPerformance* WorkerContextPerformance::from(ScriptExecutionContext* context) |
| 55 DOMWindowCrypto* DOMWindowCrypto::from(DOMWindow* window) | |
| 56 { | 55 { |
| 57 DOMWindowCrypto* supplement = static_cast<DOMWindowCrypto*>(Supplement<DOMWi ndow>::from(window, supplementName())); | 56 WorkerContextPerformance* supplement = static_cast<WorkerContextPerformance* >(Supplement<ScriptExecutionContext>::from(context, supplementName())); |
| 58 if (!supplement) { | 57 if (!supplement) { |
| 59 supplement = new DOMWindowCrypto(window); | 58 supplement = new WorkerContextPerformance(); |
| 60 provideTo(window, supplementName(), adoptPtr(supplement)); | 59 provideTo(context, supplementName(), adoptPtr(supplement)); |
| 61 } | 60 } |
| 62 return supplement; | 61 return supplement; |
| 63 } | 62 } |
| 64 | 63 |
| 65 // static | 64 WorkerPerformance* WorkerContextPerformance::performance(ScriptExecutionContext* context) |
| 66 Crypto* DOMWindowCrypto::crypto(DOMWindow* window) | |
| 67 { | 65 { |
| 68 return DOMWindowCrypto::from(window)->crypto(); | 66 return from(context)->getPerformance(context); |
| 69 } | 67 } |
| 70 | 68 |
| 71 Crypto* DOMWindowCrypto::crypto() const | 69 WorkerPerformance* WorkerContextPerformance::getPerformance(ScriptExecutionConte xt* context) |
| 72 { | 70 { |
| 73 if (!m_crypto && frame()) | 71 if (!m_performance) |
| 74 m_crypto = Crypto::create(); | 72 m_performance = WorkerPerformance::create(context); |
| 75 return m_crypto.get(); | 73 return m_performance.get(); |
| 76 } | 74 } |
| 77 | 75 |
| 78 } // namespace WebCore | 76 } // namespace WebCore |
| OLD | NEW |