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

Side by Side Diff: Source/core/inspector/InspectorHeapProfilerAgent.cpp

Issue 300393002: Merge DevTools Refactor CL to Blink36 (Closed) Base URL: svn://svn.chromium.org/blink/branches/dart/1985
Patch Set: PTAL Created 6 years, 6 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
OLDNEW
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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 unsigned id = heapSnapshotObjectId.toUInt(&ok); 278 unsigned id = heapSnapshotObjectId.toUInt(&ok);
279 if (!ok) { 279 if (!ok) {
280 *error = "Invalid heap snapshot object id"; 280 *error = "Invalid heap snapshot object id";
281 return; 281 return;
282 } 282 }
283 ScriptObject heapObject = ScriptProfiler::objectByHeapObjectId(id); 283 ScriptObject heapObject = ScriptProfiler::objectByHeapObjectId(id);
284 if (heapObject.isEmpty()) { 284 if (heapObject.isEmpty()) {
285 *error = "Object is not available"; 285 *error = "Object is not available";
286 return; 286 return;
287 } 287 }
288 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(h eapObject.scriptState()); 288 InjectedScript& injectedScript = m_injectedScriptManager->injectedScriptFor( heapObject.scriptState());
289 if (injectedScript.isEmpty()) { 289 if (injectedScript.isEmpty()) {
290 *error = "Object is not available. Inspected context is gone"; 290 *error = "Object is not available. Inspected context is gone";
291 return; 291 return;
292 } 292 }
293 result = injectedScript.wrapObject(heapObject, objectGroup ? *objectGroup : ""); 293 result = injectedScript.wrapObject(heapObject, objectGroup ? *objectGroup : "");
294 if (!result) 294 if (!result)
295 *error = "Failed to wrap object"; 295 *error = "Failed to wrap object";
296 } 296 }
297 297
298 void InspectorHeapProfilerAgent::getHeapObjectId(ErrorString* errorString, const String& objectId, String* heapSnapshotObjectId) 298 void InspectorHeapProfilerAgent::getHeapObjectId(ErrorString* errorString, const String& objectId, String* heapSnapshotObjectId)
299 { 299 {
300 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForOb jectId(objectId); 300 InjectedScript& injectedScript = m_injectedScriptManager->injectedScriptForO bjectId(objectId);
301 if (injectedScript.isEmpty()) { 301 if (injectedScript.isEmpty()) {
302 *errorString = "Inspected context has gone"; 302 *errorString = "Inspected context has gone";
303 return; 303 return;
304 } 304 }
305 ScriptValue value = injectedScript.findObjectById(objectId); 305 if (!injectedScript.isJavaScript()) {
306 *errorString = "The heap profiler does not yet work for Dart.";
307 return;
308 }
309
310 V8InjectedScript& v8InjectedScript = static_cast<V8InjectedScript&>(injected Script);
311
312 ScriptValue value = v8InjectedScript.findObjectById(objectId);
306 V8ScriptState::Scope scope(injectedScript.scriptState()->v8ScriptState()); 313 V8ScriptState::Scope scope(injectedScript.scriptState()->v8ScriptState());
314
307 if (value.isEmpty() || value.isUndefined()) { 315 if (value.isEmpty() || value.isUndefined()) {
308 *errorString = "Object with given id not found"; 316 *errorString = "Object with given id not found";
309 return; 317 return;
310 } 318 }
311 unsigned id = ScriptProfiler::getHeapObjectId(value); 319 unsigned id = ScriptProfiler::getHeapObjectId(value);
312 *heapSnapshotObjectId = String::number(id); 320 *heapSnapshotObjectId = String::number(id);
313 } 321 }
314 322
315 } // namespace WebCore 323 } // namespace WebCore
316 324
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorDebuggerAgent.cpp ('k') | Source/core/inspector/InspectorRuntimeAgent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698