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

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

Issue 2422913002: Add serializers for window.performance. (Closed)
Patch Set: remove performance.memory serialization. Created 4 years, 2 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * Copyright (C) 2012 Intel Inc. All rights reserved. 3 * Copyright (C) 2012 Intel Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 13 matching lines...) Expand all
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32 #include "core/timing/Performance.h" 32 #include "core/timing/Performance.h"
33 33
34 #include "bindings/core/v8/ScriptValue.h"
35 #include "bindings/core/v8/V8ObjectBuilder.h"
34 #include "core/dom/Document.h" 36 #include "core/dom/Document.h"
35 #include "core/frame/LocalFrame.h" 37 #include "core/frame/LocalFrame.h"
36 #include "core/inspector/InspectedFrames.h" 38 #include "core/inspector/InspectedFrames.h"
37 #include "core/inspector/InspectorWebPerfAgent.h" 39 #include "core/inspector/InspectorWebPerfAgent.h"
38 #include "core/loader/DocumentLoader.h" 40 #include "core/loader/DocumentLoader.h"
39 #include "core/origin_trials/OriginTrials.h" 41 #include "core/origin_trials/OriginTrials.h"
40 #include "core/timing/PerformanceTiming.h" 42 #include "core/timing/PerformanceTiming.h"
41 43
42 namespace blink { 44 namespace blink {
43 45
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 return; 94 return;
93 m_longTaskInspectorAgent = new InspectorWebPerfAgent(frame()); 95 m_longTaskInspectorAgent = new InspectorWebPerfAgent(frame());
94 m_longTaskInspectorAgent->enable(); 96 m_longTaskInspectorAgent->enable();
95 } else if (!hasObserverFor(PerformanceEntry::LongTask) && 97 } else if (!hasObserverFor(PerformanceEntry::LongTask) &&
96 m_longTaskInspectorAgent) { 98 m_longTaskInspectorAgent) {
97 m_longTaskInspectorAgent->disable(); 99 m_longTaskInspectorAgent->disable();
98 m_longTaskInspectorAgent = nullptr; 100 m_longTaskInspectorAgent = nullptr;
99 } 101 }
100 } 102 }
101 103
104 ScriptValue Performance::toJSONForBinding(ScriptState* scriptState) const {
105 V8ObjectBuilder result(scriptState);
106 result.add("timing", timing()->toJSONForBinding(scriptState));
107 result.add("navigation", navigation()->toJSONForBinding(scriptState));
108 return result.scriptValue();
109 }
110
102 DEFINE_TRACE(Performance) { 111 DEFINE_TRACE(Performance) {
103 visitor->trace(m_navigation); 112 visitor->trace(m_navigation);
104 visitor->trace(m_timing); 113 visitor->trace(m_timing);
105 visitor->trace(m_longTaskInspectorAgent); 114 visitor->trace(m_longTaskInspectorAgent);
106 DOMWindowProperty::trace(visitor); 115 DOMWindowProperty::trace(visitor);
107 PerformanceBase::trace(visitor); 116 PerformanceBase::trace(visitor);
108 } 117 }
109 118
110 } // namespace blink 119 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/timing/Performance.h ('k') | third_party/WebKit/Source/core/timing/Performance.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698