OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "core/timing/DOMWindowPerformance.h" | 5 #include "core/timing/DOMWindowPerformance.h" |
6 | 6 |
7 #include "core/frame/LocalDOMWindow.h" | 7 #include "core/frame/LocalDOMWindow.h" |
8 #include "core/frame/LocalFrame.h" | 8 #include "core/frame/LocalFrame.h" |
9 #include "core/timing/Performance.h" | 9 #include "core/timing/Performance.h" |
10 | 10 |
11 namespace blink { | 11 namespace blink { |
12 | 12 |
13 DOMWindowPerformance::DOMWindowPerformance(LocalDOMWindow& window) | 13 DOMWindowPerformance::DOMWindowPerformance(LocalDOMWindow& window) |
14 : DOMWindowProperty(window.frame()) | 14 : DOMWindowProperty(window.frame()) |
15 , m_window(&window) | 15 , m_window(&window) |
16 { | 16 { |
17 } | 17 } |
18 | 18 |
19 DEFINE_TRACE(DOMWindowPerformance) | 19 DEFINE_TRACE(DOMWindowPerformance) |
20 { | 20 { |
21 visitor->trace(m_window); | 21 visitor->trace(m_window); |
22 visitor->trace(m_performance); | 22 visitor->trace(m_performance); |
23 HeapSupplement<LocalDOMWindow>::trace(visitor); | 23 Supplement<LocalDOMWindow>::trace(visitor); |
24 DOMWindowProperty::trace(visitor); | 24 DOMWindowProperty::trace(visitor); |
25 } | 25 } |
26 | 26 |
27 // static | 27 // static |
28 const char* DOMWindowPerformance::supplementName() | 28 const char* DOMWindowPerformance::supplementName() |
29 { | 29 { |
30 return "DOMWindowPerformance"; | 30 return "DOMWindowPerformance"; |
31 } | 31 } |
32 | 32 |
33 // static | 33 // static |
34 DOMWindowPerformance& DOMWindowPerformance::from(LocalDOMWindow& window) | 34 DOMWindowPerformance& DOMWindowPerformance::from(LocalDOMWindow& window) |
35 { | 35 { |
36 DOMWindowPerformance* supplement = static_cast<DOMWindowPerformance*>(HeapSu
pplement<LocalDOMWindow>::from(window, supplementName())); | 36 DOMWindowPerformance* supplement = static_cast<DOMWindowPerformance*>(Supple
ment<LocalDOMWindow>::from(window, supplementName())); |
37 if (!supplement) { | 37 if (!supplement) { |
38 supplement = new DOMWindowPerformance(window); | 38 supplement = new DOMWindowPerformance(window); |
39 provideTo(window, supplementName(), supplement); | 39 provideTo(window, supplementName(), supplement); |
40 } | 40 } |
41 return *supplement; | 41 return *supplement; |
42 } | 42 } |
43 | 43 |
44 // static | 44 // static |
45 Performance* DOMWindowPerformance::performance(DOMWindow& window) | 45 Performance* DOMWindowPerformance::performance(DOMWindow& window) |
46 { | 46 { |
47 return from(toLocalDOMWindow(window)).performance(); | 47 return from(toLocalDOMWindow(window)).performance(); |
48 } | 48 } |
49 | 49 |
50 Performance* DOMWindowPerformance::performance() | 50 Performance* DOMWindowPerformance::performance() |
51 { | 51 { |
52 if (!m_performance) | 52 if (!m_performance) |
53 m_performance = Performance::create(m_window->frame()); | 53 m_performance = Performance::create(m_window->frame()); |
54 return m_performance.get(); | 54 return m_performance.get(); |
55 } | 55 } |
56 | 56 |
57 } // namespace blink | 57 } // namespace blink |
OLD | NEW |