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

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

Issue 293963003: Remove ScriptObject (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « Source/bindings/v8/ScriptProfiler.h ('k') | Source/bindings/v8/ScriptValue.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 16 matching lines...) Expand all
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "config.h" 31 #include "config.h"
32 #include "bindings/v8/ScriptProfiler.h" 32 #include "bindings/v8/ScriptProfiler.h"
33 33
34 #include "V8Node.h" 34 #include "V8Node.h"
35 #include "V8Window.h" 35 #include "V8Window.h"
36 #include "bindings/v8/RetainedDOMInfo.h" 36 #include "bindings/v8/RetainedDOMInfo.h"
37 #include "bindings/v8/ScriptObject.h" 37 #include "bindings/v8/ScriptValue.h"
38 #include "bindings/v8/V8Binding.h" 38 #include "bindings/v8/V8Binding.h"
39 #include "bindings/v8/WrapperTypeInfo.h" 39 #include "bindings/v8/WrapperTypeInfo.h"
40 #include "core/dom/Document.h" 40 #include "core/dom/Document.h"
41 #include "core/inspector/BindingVisitors.h" 41 #include "core/inspector/BindingVisitors.h"
42 42
43 #include <v8-profiler.h> 43 #include <v8-profiler.h>
44 #include <v8.h> 44 #include <v8.h>
45 45
46 #include "wtf/ThreadSpecific.h" 46 #include "wtf/ThreadSpecific.h"
47 47
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 } 93 }
94 94
95 return ScriptProfile::create(profile, idleTime); 95 return ScriptProfile::create(profile, idleTime);
96 } 96 }
97 97
98 void ScriptProfiler::collectGarbage() 98 void ScriptProfiler::collectGarbage()
99 { 99 {
100 v8::V8::LowMemoryNotification(); 100 v8::V8::LowMemoryNotification();
101 } 101 }
102 102
103 ScriptObject ScriptProfiler::objectByHeapObjectId(unsigned id) 103 ScriptValue ScriptProfiler::objectByHeapObjectId(unsigned id)
104 { 104 {
105 v8::Isolate* isolate = v8::Isolate::GetCurrent(); 105 v8::Isolate* isolate = v8::Isolate::GetCurrent();
106 v8::HeapProfiler* profiler = isolate->GetHeapProfiler(); 106 v8::HeapProfiler* profiler = isolate->GetHeapProfiler();
107 v8::HandleScope handleScope(isolate); 107 v8::HandleScope handleScope(isolate);
108 v8::Handle<v8::Value> value = profiler->FindObjectById(id); 108 v8::Handle<v8::Value> value = profiler->FindObjectById(id);
109 if (value.IsEmpty() || !value->IsObject()) 109 if (value.IsEmpty() || !value->IsObject())
110 return ScriptObject(); 110 return ScriptValue();
111 111
112 v8::Handle<v8::Object> object = value.As<v8::Object>(); 112 v8::Handle<v8::Object> object = value.As<v8::Object>();
113 113
114 if (object->InternalFieldCount() >= v8DefaultWrapperInternalFieldCount) { 114 if (object->InternalFieldCount() >= v8DefaultWrapperInternalFieldCount) {
115 v8::Handle<v8::Value> wrapper = object->GetInternalField(v8DOMWrapperObj ectIndex); 115 v8::Handle<v8::Value> wrapper = object->GetInternalField(v8DOMWrapperObj ectIndex);
116 // Skip wrapper boilerplates which are like regular wrappers but don't h ave 116 // Skip wrapper boilerplates which are like regular wrappers but don't h ave
117 // native object. 117 // native object.
118 if (!wrapper.IsEmpty() && wrapper->IsUndefined()) 118 if (!wrapper.IsEmpty() && wrapper->IsUndefined())
119 return ScriptObject(); 119 return ScriptValue();
120 } 120 }
121 121
122 ScriptState* scriptState = ScriptState::from(object->CreationContext()); 122 ScriptState* scriptState = ScriptState::from(object->CreationContext());
123 return ScriptObject(scriptState, object); 123 return ScriptValue(scriptState, object);
124 } 124 }
125 125
126 unsigned ScriptProfiler::getHeapObjectId(const ScriptValue& value) 126 unsigned ScriptProfiler::getHeapObjectId(const ScriptValue& value)
127 { 127 {
128 v8::Isolate* isolate = v8::Isolate::GetCurrent(); 128 v8::Isolate* isolate = v8::Isolate::GetCurrent();
129 v8::HeapProfiler* profiler = isolate->GetHeapProfiler(); 129 v8::HeapProfiler* profiler = isolate->GetHeapProfiler();
130 v8::SnapshotObjectId id = profiler->GetObjectId(value.v8Value()); 130 v8::SnapshotObjectId id = profiler->GetObjectId(value.v8Value());
131 return id; 131 return id;
132 } 132 }
133 133
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 } 301 }
302 302
303 void ScriptProfiler::setIdle(bool isIdle) 303 void ScriptProfiler::setIdle(bool isIdle)
304 { 304 {
305 v8::Isolate* isolate = v8::Isolate::GetCurrent(); 305 v8::Isolate* isolate = v8::Isolate::GetCurrent();
306 if (v8::CpuProfiler* profiler = isolate->GetCpuProfiler()) 306 if (v8::CpuProfiler* profiler = isolate->GetCpuProfiler())
307 profiler->SetIdle(isIdle); 307 profiler->SetIdle(isIdle);
308 } 308 }
309 309
310 } // namespace WebCore 310 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/ScriptProfiler.h ('k') | Source/bindings/v8/ScriptValue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698