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

Side by Side Diff: src/inspector/v8-heap-profiler-agent-impl.cc

Issue 2522593005: v8 inspector: do not upon empty object ids in heap profiler. (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/inspector/v8-heap-profiler-agent-impl.h" 5 #include "src/inspector/v8-heap-profiler-agent-impl.h"
6 6
7 #include "src/inspector/injected-script.h" 7 #include "src/inspector/injected-script.h"
8 #include "src/inspector/protocol/Protocol.h" 8 #include "src/inspector/protocol/Protocol.h"
9 #include "src/inspector/string-util.h" 9 #include "src/inspector/string-util.h"
10 #include "src/inspector/v8-debugger.h" 10 #include "src/inspector/v8-debugger.h"
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 237
238 v8::HandleScope handles(m_isolate); 238 v8::HandleScope handles(m_isolate);
239 v8::Local<v8::Object> heapObject = objectByHeapObjectId(m_isolate, id); 239 v8::Local<v8::Object> heapObject = objectByHeapObjectId(m_isolate, id);
240 if (heapObject.IsEmpty()) return Response::Error("Object is not available"); 240 if (heapObject.IsEmpty()) return Response::Error("Object is not available");
241 241
242 if (!m_session->inspector()->client()->isInspectableHeapObject(heapObject)) 242 if (!m_session->inspector()->client()->isInspectableHeapObject(heapObject))
243 return Response::Error("Object is not available"); 243 return Response::Error("Object is not available");
244 244
245 *result = m_session->wrapObject(heapObject->CreationContext(), heapObject, 245 *result = m_session->wrapObject(heapObject->CreationContext(), heapObject,
246 objectGroup.fromMaybe(""), false); 246 objectGroup.fromMaybe(""), false);
247 if (!result) return Response::Error("Object is not available"); 247 if (!*result) return Response::Error("Object is not available");
248 return Response::OK(); 248 return Response::OK();
249 } 249 }
250 250
251 Response V8HeapProfilerAgentImpl::addInspectedHeapObject( 251 Response V8HeapProfilerAgentImpl::addInspectedHeapObject(
252 const String16& inspectedHeapObjectId) { 252 const String16& inspectedHeapObjectId) {
253 bool ok; 253 bool ok;
254 int id = inspectedHeapObjectId.toInteger(&ok); 254 int id = inspectedHeapObjectId.toInteger(&ok);
255 if (!ok) return Response::Error("Invalid heap snapshot object id"); 255 if (!ok) return Response::Error("Invalid heap snapshot object id");
256 256
257 v8::HandleScope handles(m_isolate); 257 v8::HandleScope handles(m_isolate);
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 if (!v8Profile) 373 if (!v8Profile)
374 return Response::Error("Cannot access v8 sampled heap profile."); 374 return Response::Error("Cannot access v8 sampled heap profile.");
375 v8::AllocationProfile::Node* root = v8Profile->GetRootNode(); 375 v8::AllocationProfile::Node* root = v8Profile->GetRootNode();
376 *profile = protocol::HeapProfiler::SamplingHeapProfile::create() 376 *profile = protocol::HeapProfiler::SamplingHeapProfile::create()
377 .setHead(buildSampingHeapProfileNode(root)) 377 .setHead(buildSampingHeapProfileNode(root))
378 .build(); 378 .build();
379 return Response::OK(); 379 return Response::OK();
380 } 380 }
381 381
382 } // namespace v8_inspector 382 } // namespace v8_inspector
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698