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

Side by Side Diff: third_party/WebKit/Source/platform/v8_inspector/V8HeapProfilerAgentImpl.cpp

Issue 2205913002: [DevTools] Split a part of V8Inspector into V8Debugger. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@v8-inspector-rename
Patch Set: context scope! Created 4 years, 4 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium 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 "platform/v8_inspector/V8HeapProfilerAgentImpl.h" 5 #include "platform/v8_inspector/V8HeapProfilerAgentImpl.h"
6 6
7 #include "platform/v8_inspector/InjectedScript.h" 7 #include "platform/v8_inspector/InjectedScript.h"
8 #include "platform/v8_inspector/V8Debugger.h"
8 #include "platform/v8_inspector/V8InspectorImpl.h" 9 #include "platform/v8_inspector/V8InspectorImpl.h"
9 #include "platform/v8_inspector/V8InspectorSessionImpl.h" 10 #include "platform/v8_inspector/V8InspectorSessionImpl.h"
10 #include "platform/v8_inspector/V8StringUtil.h" 11 #include "platform/v8_inspector/V8StringUtil.h"
11 #include "platform/v8_inspector/public/V8InspectorClient.h" 12 #include "platform/v8_inspector/public/V8InspectorClient.h"
12 #include <v8-profiler.h> 13 #include <v8-profiler.h>
13 #include <v8-version.h> 14 #include <v8-version.h>
14 15
15 namespace blink { 16 namespace blink {
16 17
17 namespace { 18 namespace {
(...skipping 25 matching lines...) Expand all
43 protocol::HeapProfiler::Frontend* m_frontend; 44 protocol::HeapProfiler::Frontend* m_frontend;
44 }; 45 };
45 46
46 class GlobalObjectNameResolver final : public v8::HeapProfiler::ObjectNameResolv er { 47 class GlobalObjectNameResolver final : public v8::HeapProfiler::ObjectNameResolv er {
47 public: 48 public:
48 explicit GlobalObjectNameResolver(V8InspectorSessionImpl* session) 49 explicit GlobalObjectNameResolver(V8InspectorSessionImpl* session)
49 : m_offset(0), m_strings(10000), m_session(session) {} 50 : m_offset(0), m_strings(10000), m_session(session) {}
50 51
51 const char* GetName(v8::Local<v8::Object> object) override 52 const char* GetName(v8::Local<v8::Object> object) override
52 { 53 {
53 int contextId = V8InspectorImpl::contextId(object->CreationContext()); 54 int contextId = V8Debugger::contextId(object->CreationContext());
54 if (!contextId) 55 if (!contextId)
55 return ""; 56 return "";
56 ErrorString errorString; 57 ErrorString errorString;
57 InjectedScript* injectedScript = m_session->findInjectedScript(&errorStr ing, contextId); 58 InjectedScript* injectedScript = m_session->findInjectedScript(&errorStr ing, contextId);
58 if (!injectedScript) 59 if (!injectedScript)
59 return ""; 60 return "";
60 String16 name = injectedScript->context()->origin(); 61 String16 name = injectedScript->context()->origin();
61 size_t length = name.length(); 62 size_t length = name.length();
62 if (m_offset + length + 1 >= m_strings.size()) 63 if (m_offset + length + 1 >= m_strings.size())
63 return ""; 64 return "";
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 *errorString = "Cannot access v8 sampled heap profile."; 396 *errorString = "Cannot access v8 sampled heap profile.";
396 return; 397 return;
397 } 398 }
398 v8::AllocationProfile::Node* root = v8Profile->GetRootNode(); 399 v8::AllocationProfile::Node* root = v8Profile->GetRootNode();
399 *profile = protocol::HeapProfiler::SamplingHeapProfile::create() 400 *profile = protocol::HeapProfiler::SamplingHeapProfile::create()
400 .setHead(buildSampingHeapProfileNode(root)).build(); 401 .setHead(buildSampingHeapProfileNode(root)).build();
401 #endif 402 #endif
402 } 403 }
403 404
404 } // namespace blink 405 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698