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

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

Issue 1859293002: [DevTools] Move Console to v8_inspector (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 4 years, 8 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/InspectedContext.h" 5 #include "platform/v8_inspector/InspectedContext.h"
6 6
7 #include "platform/v8_inspector/InjectedScript.h" 7 #include "platform/v8_inspector/InjectedScript.h"
8 #include "platform/v8_inspector/V8Console.h"
8 #include "platform/v8_inspector/V8DebuggerImpl.h" 9 #include "platform/v8_inspector/V8DebuggerImpl.h"
10 #include "platform/v8_inspector/V8StringUtil.h"
9 #include "platform/v8_inspector/public/V8ContextInfo.h" 11 #include "platform/v8_inspector/public/V8ContextInfo.h"
10 #include "platform/v8_inspector/public/V8DebuggerClient.h" 12 #include "platform/v8_inspector/public/V8DebuggerClient.h"
11 13
12 namespace blink { 14 namespace blink {
13 15
14 void InspectedContext::weakCallback(const v8::WeakCallbackInfo<InspectedContext> & data) 16 void InspectedContext::weakCallback(const v8::WeakCallbackInfo<InspectedContext> & data)
15 { 17 {
16 data.GetParameter()->m_debugger->discardInspectedContext(data.GetParameter() ->m_contextGroupId, data.GetParameter()->m_contextId); 18 data.GetParameter()->m_debugger->discardInspectedContext(data.GetParameter() ->m_contextGroupId, data.GetParameter()->m_contextId);
17 } 19 }
18 20
19 InspectedContext::InspectedContext(V8DebuggerImpl* debugger, const V8ContextInfo & info, int contextId) 21 InspectedContext::InspectedContext(V8DebuggerImpl* debugger, const V8ContextInfo & info, int contextId)
20 : m_debugger(debugger) 22 : m_debugger(debugger)
21 , m_context(info.context->GetIsolate(), info.context) 23 , m_context(info.context->GetIsolate(), info.context)
22 , m_contextId(contextId) 24 , m_contextId(contextId)
23 , m_contextGroupId(info.contextGroupId) 25 , m_contextGroupId(info.contextGroupId)
24 , m_isDefault(info.isDefault) 26 , m_isDefault(info.isDefault)
25 , m_origin(info.origin) 27 , m_origin(info.origin)
26 , m_humanReadableName(info.humanReadableName) 28 , m_humanReadableName(info.humanReadableName)
27 , m_frameId(info.frameId) 29 , m_frameId(info.frameId)
28 , m_reported(false) 30 , m_reported(false)
29 { 31 {
30 m_context.SetWeak(this, &InspectedContext::weakCallback, v8::WeakCallbackTyp e::kParameter); 32 m_context.SetWeak(this, &InspectedContext::weakCallback, v8::WeakCallbackTyp e::kParameter);
33
34 v8::Isolate* isolate = m_debugger->isolate();
35 v8::Local<v8::Object> global = info.context->Global();
36 v8::Local<v8::Object> console;
37 if (!V8Console::create(info.context, this, info.hasMemoryOnConsole).ToLocal( &console))
38 return;
39 if (!global->Set(info.context, toV8StringInternalized(isolate, "console"), c onsole).FromMaybe(false))
40 return;
31 } 41 }
32 42
33 InspectedContext::~InspectedContext() 43 InspectedContext::~InspectedContext()
34 { 44 {
35 } 45 }
36 46
37 v8::Local<v8::Context> InspectedContext::context() const 47 v8::Local<v8::Context> InspectedContext::context() const
38 { 48 {
39 return m_context.Get(isolate()); 49 return m_context.Get(isolate());
40 } 50 }
(...skipping 13 matching lines...) Expand all
54 return; 64 return;
55 m_injectedScript = InjectedScript::create(this, injectedScriptHost); 65 m_injectedScript = InjectedScript::create(this, injectedScriptHost);
56 } 66 }
57 67
58 void InspectedContext::discardInjectedScript() 68 void InspectedContext::discardInjectedScript()
59 { 69 {
60 m_injectedScript.clear(); 70 m_injectedScript.clear();
61 } 71 }
62 72
63 } // namespace blink 73 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698