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
3 // found in the LICENSE file.
6 #include "core/timing/DOMWindowPerformance.h"
8 #include "core/frame/LocalDOMWindow.h"
9 #include "core/frame/LocalFrame.h"
10 #include "core/timing/Performance.h"
14 DOMWindowPerformance::DOMWindowPerformance(LocalDOMWindow
& window
)
15 : DOMWindowProperty(window
.frame())
20 DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(DOMWindowPerformance
);
22 DEFINE_TRACE(DOMWindowPerformance
)
24 visitor
->trace(m_window
);
25 visitor
->trace(m_performance
);
26 WillBeHeapSupplement
<LocalDOMWindow
>::trace(visitor
);
27 DOMWindowProperty::trace(visitor
);
31 const char* DOMWindowPerformance::supplementName()
33 return "DOMWindowPerformance";
37 DOMWindowPerformance
& DOMWindowPerformance::from(LocalDOMWindow
& window
)
39 DOMWindowPerformance
* supplement
= static_cast<DOMWindowPerformance
*>(WillBeHeapSupplement
<LocalDOMWindow
>::from(window
, supplementName()));
41 supplement
= new DOMWindowPerformance(window
);
42 provideTo(window
, supplementName(), adoptPtrWillBeNoop(supplement
));
48 Performance
* DOMWindowPerformance::performance(DOMWindow
& window
)
50 return from(toLocalDOMWindow(window
)).performance();
53 Performance
* DOMWindowPerformance::performance()
56 m_performance
= Performance::create(m_window
->frame());
57 return m_performance
.get();