Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(867)

Side by Side Diff: third_party/WebKit/Source/core/timing/DOMWindowPerformance.cpp

Issue 2615633011: Remove ContextClient from DOMWindowPerformance (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/timing/DOMWindowPerformance.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 : ContextClient(window.frame()), m_window(&window) {} 14 : Supplement<LocalDOMWindow>(window) {}
15 15
16 DEFINE_TRACE(DOMWindowPerformance) { 16 DEFINE_TRACE(DOMWindowPerformance) {
17 visitor->trace(m_window);
18 visitor->trace(m_performance); 17 visitor->trace(m_performance);
19 Supplement<LocalDOMWindow>::trace(visitor); 18 Supplement<LocalDOMWindow>::trace(visitor);
20 ContextClient::trace(visitor);
21 } 19 }
22 20
23 // static 21 // static
24 const char* DOMWindowPerformance::supplementName() { 22 const char* DOMWindowPerformance::supplementName() {
25 return "DOMWindowPerformance"; 23 return "DOMWindowPerformance";
26 } 24 }
27 25
28 // static 26 // static
29 DOMWindowPerformance& DOMWindowPerformance::from(LocalDOMWindow& window) { 27 DOMWindowPerformance& DOMWindowPerformance::from(LocalDOMWindow& window) {
30 DOMWindowPerformance* supplement = static_cast<DOMWindowPerformance*>( 28 DOMWindowPerformance* supplement = static_cast<DOMWindowPerformance*>(
31 Supplement<LocalDOMWindow>::from(window, supplementName())); 29 Supplement<LocalDOMWindow>::from(window, supplementName()));
32 if (!supplement) { 30 if (!supplement) {
33 supplement = new DOMWindowPerformance(window); 31 supplement = new DOMWindowPerformance(window);
34 provideTo(window, supplementName(), supplement); 32 provideTo(window, supplementName(), supplement);
35 } 33 }
36 return *supplement; 34 return *supplement;
37 } 35 }
38 36
39 // static 37 // static
40 Performance* DOMWindowPerformance::performance(DOMWindow& window) { 38 Performance* DOMWindowPerformance::performance(DOMWindow& window) {
41 return from(toLocalDOMWindow(window)).performance(); 39 return from(toLocalDOMWindow(window)).performance();
42 } 40 }
43 41
44 Performance* DOMWindowPerformance::performance() { 42 Performance* DOMWindowPerformance::performance() {
45 if (!m_performance) 43 if (!m_performance)
46 m_performance = Performance::create(m_window->frame()); 44 m_performance = Performance::create(host()->frame());
47 return m_performance.get(); 45 return m_performance.get();
48 } 46 }
49 47
50 } // namespace blink 48 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/timing/DOMWindowPerformance.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698