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

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

Issue 2467853003: [inspector] migrate Runtime to new style (Closed)
Patch Set: addressed comments Created 4 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
« no previous file with comments | « src/inspector/v8-debugger-agent-impl.cc ('k') | src/inspector/v8-inspector-session-impl.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 // 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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 return Response::Error("Object is not available"); 262 return Response::Error("Object is not available");
263 m_session->addInspectedObject(wrapUnique(new InspectableHeapObject(id))); 263 m_session->addInspectedObject(wrapUnique(new InspectableHeapObject(id)));
264 return Response::OK(); 264 return Response::OK();
265 } 265 }
266 266
267 Response V8HeapProfilerAgentImpl::getHeapObjectId( 267 Response V8HeapProfilerAgentImpl::getHeapObjectId(
268 const String16& objectId, String16* heapSnapshotObjectId) { 268 const String16& objectId, String16* heapSnapshotObjectId) {
269 v8::HandleScope handles(m_isolate); 269 v8::HandleScope handles(m_isolate);
270 v8::Local<v8::Value> value; 270 v8::Local<v8::Value> value;
271 v8::Local<v8::Context> context; 271 v8::Local<v8::Context> context;
272 protocol::ErrorString errorString; 272 Response response =
273 if (!m_session->unwrapObject(&errorString, objectId, &value, &context, 273 m_session->unwrapObject(objectId, &value, &context, nullptr);
274 nullptr) || 274 if (!response.isSuccess()) return response;
275 value->IsUndefined()) 275 if (value->IsUndefined()) return Response::InternalError();
276 return Response::Error(errorString);
277 276
278 v8::SnapshotObjectId id = m_isolate->GetHeapProfiler()->GetObjectId(value); 277 v8::SnapshotObjectId id = m_isolate->GetHeapProfiler()->GetObjectId(value);
279 *heapSnapshotObjectId = String16::fromInteger(static_cast<size_t>(id)); 278 *heapSnapshotObjectId = String16::fromInteger(static_cast<size_t>(id));
280 return Response::OK(); 279 return Response::OK();
281 } 280 }
282 281
283 void V8HeapProfilerAgentImpl::requestHeapStatsUpdate() { 282 void V8HeapProfilerAgentImpl::requestHeapStatsUpdate() {
284 HeapStatsStream stream(&m_frontend); 283 HeapStatsStream stream(&m_frontend);
285 v8::SnapshotObjectId lastSeenObjectId = 284 v8::SnapshotObjectId lastSeenObjectId =
286 m_isolate->GetHeapProfiler()->GetHeapStats(&stream); 285 m_isolate->GetHeapProfiler()->GetHeapStats(&stream);
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 if (!v8Profile) 373 if (!v8Profile)
375 return Response::Error("Cannot access v8 sampled heap profile."); 374 return Response::Error("Cannot access v8 sampled heap profile.");
376 v8::AllocationProfile::Node* root = v8Profile->GetRootNode(); 375 v8::AllocationProfile::Node* root = v8Profile->GetRootNode();
377 *profile = protocol::HeapProfiler::SamplingHeapProfile::create() 376 *profile = protocol::HeapProfiler::SamplingHeapProfile::create()
378 .setHead(buildSampingHeapProfileNode(root)) 377 .setHead(buildSampingHeapProfileNode(root))
379 .build(); 378 .build();
380 return Response::OK(); 379 return Response::OK();
381 } 380 }
382 381
383 } // namespace v8_inspector 382 } // namespace v8_inspector
OLDNEW
« no previous file with comments | « src/inspector/v8-debugger-agent-impl.cc ('k') | src/inspector/v8-inspector-session-impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698