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

Side by Side Diff: Source/bindings/core/v8/ScriptProfiler.cpp

Issue 683013002: Extract a DOMWindow interface from LocalDOMWindow and use it in the idl. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix incorrect assumption Created 6 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2011, Google Inc. All rights reserved. 2 * Copyright (c) 2011, 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 20 matching lines...) Expand all
31 #include "config.h" 31 #include "config.h"
32 #include "bindings/core/v8/ScriptProfiler.h" 32 #include "bindings/core/v8/ScriptProfiler.h"
33 33
34 #include "bindings/core/v8/RetainedDOMInfo.h" 34 #include "bindings/core/v8/RetainedDOMInfo.h"
35 #include "bindings/core/v8/ScriptValue.h" 35 #include "bindings/core/v8/ScriptValue.h"
36 #include "bindings/core/v8/V8Binding.h" 36 #include "bindings/core/v8/V8Binding.h"
37 #include "bindings/core/v8/V8Node.h" 37 #include "bindings/core/v8/V8Node.h"
38 #include "bindings/core/v8/V8Window.h" 38 #include "bindings/core/v8/V8Window.h"
39 #include "bindings/core/v8/WrapperTypeInfo.h" 39 #include "bindings/core/v8/WrapperTypeInfo.h"
40 #include "core/dom/Document.h" 40 #include "core/dom/Document.h"
41 #include "core/frame/LocalDOMWindow.h"
41 #include "core/inspector/BindingVisitors.h" 42 #include "core/inspector/BindingVisitors.h"
42 #include "wtf/ThreadSpecific.h" 43 #include "wtf/ThreadSpecific.h"
43 44
44 #include <v8-profiler.h> 45 #include <v8-profiler.h>
45 #include <v8.h> 46 #include <v8.h>
46 47
47 namespace blink { 48 namespace blink {
48 49
49 typedef HashMap<String, double> ProfileNameIdleTimeMap; 50 typedef HashMap<String, double> ProfileNameIdleTimeMap;
50 51
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 } 159 }
159 private: 160 private:
160 ScriptProfiler::HeapSnapshotProgress* m_progress; 161 ScriptProfiler::HeapSnapshotProgress* m_progress;
161 bool m_firstReport; 162 bool m_firstReport;
162 }; 163 };
163 164
164 class GlobalObjectNameResolver final : public v8::HeapProfiler::ObjectNameResolv er { 165 class GlobalObjectNameResolver final : public v8::HeapProfiler::ObjectNameResolv er {
165 public: 166 public:
166 virtual const char* GetName(v8::Handle<v8::Object> object) override 167 virtual const char* GetName(v8::Handle<v8::Object> object) override
167 { 168 {
168 LocalDOMWindow* window = toDOMWindow(object, v8::Isolate::GetCurrent()); 169 DOMWindow* window = toDOMWindow(object, v8::Isolate::GetCurrent());
169 if (!window) 170 if (!window)
170 return 0; 171 return 0;
171 CString url = window->document()->url().string().utf8(); 172 CString url = toLocalDOMWindow(window)->document()->url().string().utf8( );
172 m_strings.append(url); 173 m_strings.append(url);
173 return url.data(); 174 return url.data();
174 } 175 }
175 176
176 private: 177 private:
177 Vector<CString> m_strings; 178 Vector<CString> m_strings;
178 }; 179 };
179 180
180 } // namespace 181 } // namespace
181 182
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 } 310 }
310 311
311 void ScriptProfiler::setIdle(bool isIdle) 312 void ScriptProfiler::setIdle(bool isIdle)
312 { 313 {
313 v8::Isolate* isolate = v8::Isolate::GetCurrent(); 314 v8::Isolate* isolate = v8::Isolate::GetCurrent();
314 if (v8::CpuProfiler* profiler = isolate->GetCpuProfiler()) 315 if (v8::CpuProfiler* profiler = isolate->GetCpuProfiler())
315 profiler->SetIdle(isIdle); 316 profiler->SetIdle(isIdle);
316 } 317 }
317 318
318 } // namespace blink 319 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698