OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 { | 157 { |
158 m_v8HeapProfilerAgent->disable(error); | 158 m_v8HeapProfilerAgent->disable(error); |
159 stopUpdateStatsTimer(); | 159 stopUpdateStatsTimer(); |
160 } | 160 } |
161 | 161 |
162 void InspectorHeapProfilerAgent::takeHeapSnapshot(ErrorString* errorString, cons
t protocol::Maybe<bool>& reportProgress) | 162 void InspectorHeapProfilerAgent::takeHeapSnapshot(ErrorString* errorString, cons
t protocol::Maybe<bool>& reportProgress) |
163 { | 163 { |
164 m_v8HeapProfilerAgent->takeHeapSnapshot(errorString, reportProgress); | 164 m_v8HeapProfilerAgent->takeHeapSnapshot(errorString, reportProgress); |
165 } | 165 } |
166 | 166 |
167 void InspectorHeapProfilerAgent::getObjectByHeapObjectId(ErrorString* error, con
st String& heapSnapshotObjectId, const protocol::Maybe<String>& objectGroup, Own
Ptr<protocol::Runtime::RemoteObject>* result) | 167 void InspectorHeapProfilerAgent::getObjectByHeapObjectId(ErrorString* error, con
st String16& heapSnapshotObjectId, const protocol::Maybe<String16>& objectGroup,
OwnPtr<protocol::Runtime::RemoteObject>* result) |
168 { | 168 { |
169 bool ok; | 169 bool ok; |
170 unsigned id = heapSnapshotObjectId.toUInt(&ok); | 170 unsigned id = heapSnapshotObjectId.toUInt(&ok); |
171 if (!ok) { | 171 if (!ok) { |
172 *error = "Invalid heap snapshot object id"; | 172 *error = "Invalid heap snapshot object id"; |
173 return; | 173 return; |
174 } | 174 } |
175 | 175 |
176 if (!isInspectableHeapObject(id)) { | 176 if (!isInspectableHeapObject(id)) { |
177 *error = "Object is not available"; | 177 *error = "Object is not available"; |
178 return; | 178 return; |
179 } | 179 } |
180 | 180 |
181 m_v8HeapProfilerAgent->getObjectByHeapObjectId(error, heapSnapshotObjectId,
objectGroup, result); | 181 m_v8HeapProfilerAgent->getObjectByHeapObjectId(error, heapSnapshotObjectId,
objectGroup, result); |
182 } | 182 } |
183 | 183 |
184 void InspectorHeapProfilerAgent::addInspectedHeapObject(ErrorString* error, cons
t String& inspectedHeapObjectId) | 184 void InspectorHeapProfilerAgent::addInspectedHeapObject(ErrorString* error, cons
t String16& inspectedHeapObjectId) |
185 { | 185 { |
186 bool ok; | 186 bool ok; |
187 unsigned id = inspectedHeapObjectId.toUInt(&ok); | 187 unsigned id = inspectedHeapObjectId.toUInt(&ok); |
188 if (!ok) { | 188 if (!ok) { |
189 *error = "Invalid heap snapshot object id"; | 189 *error = "Invalid heap snapshot object id"; |
190 return; | 190 return; |
191 } | 191 } |
192 | 192 |
193 if (!isInspectableHeapObject(id)) { | 193 if (!isInspectableHeapObject(id)) { |
194 *error = "Object is not available"; | 194 *error = "Object is not available"; |
195 return; | 195 return; |
196 } | 196 } |
197 | 197 |
198 m_v8HeapProfilerAgent->addInspectedHeapObject(error, inspectedHeapObjectId); | 198 m_v8HeapProfilerAgent->addInspectedHeapObject(error, inspectedHeapObjectId); |
199 } | 199 } |
200 | 200 |
201 void InspectorHeapProfilerAgent::getHeapObjectId(ErrorString* errorString, const
String& objectId, String* heapSnapshotObjectId) | 201 void InspectorHeapProfilerAgent::getHeapObjectId(ErrorString* errorString, const
String16& objectId, String16* heapSnapshotObjectId) |
202 { | 202 { |
203 m_v8HeapProfilerAgent->getHeapObjectId(errorString, objectId, heapSnapshotOb
jectId); | 203 m_v8HeapProfilerAgent->getHeapObjectId(errorString, objectId, heapSnapshotOb
jectId); |
204 } | 204 } |
205 | 205 |
206 bool InspectorHeapProfilerAgent::isInspectableHeapObject(unsigned id) | 206 bool InspectorHeapProfilerAgent::isInspectableHeapObject(unsigned id) |
207 { | 207 { |
208 v8::HandleScope scope(m_isolate); | 208 v8::HandleScope scope(m_isolate); |
209 v8::HeapProfiler* profiler = m_isolate->GetHeapProfiler(); | 209 v8::HeapProfiler* profiler = m_isolate->GetHeapProfiler(); |
210 v8::Local<v8::Value> value = profiler->FindObjectById(id); | 210 v8::Local<v8::Value> value = profiler->FindObjectById(id); |
211 if (value.IsEmpty() || !value->IsObject()) | 211 if (value.IsEmpty() || !value->IsObject()) |
(...skipping 13 matching lines...) Expand all Loading... |
225 { | 225 { |
226 m_v8HeapProfilerAgent->startSampling(errorString); | 226 m_v8HeapProfilerAgent->startSampling(errorString); |
227 } | 227 } |
228 | 228 |
229 void InspectorHeapProfilerAgent::stopSampling(ErrorString* errorString, OwnPtr<p
rotocol::HeapProfiler::SamplingHeapProfile>* profile) | 229 void InspectorHeapProfilerAgent::stopSampling(ErrorString* errorString, OwnPtr<p
rotocol::HeapProfiler::SamplingHeapProfile>* profile) |
230 { | 230 { |
231 m_v8HeapProfilerAgent->stopSampling(errorString, profile); | 231 m_v8HeapProfilerAgent->stopSampling(errorString, profile); |
232 } | 232 } |
233 | 233 |
234 } // namespace blink | 234 } // namespace blink |
OLD | NEW |