| Index: third_party/WebKit/Source/platform/v8_inspector/V8Console.cpp
|
| diff --git a/third_party/WebKit/Source/platform/v8_inspector/V8Console.cpp b/third_party/WebKit/Source/platform/v8_inspector/V8Console.cpp
|
| index 701a60c58d37a387cb9aa5b8d6920b21165763b8..7e0c2f4f9fa6c26a56822c0c59cddbd0bb491ce7 100644
|
| --- a/third_party/WebKit/Source/platform/v8_inspector/V8Console.cpp
|
| +++ b/third_party/WebKit/Source/platform/v8_inspector/V8Console.cpp
|
| @@ -10,6 +10,7 @@
|
| #include "platform/v8_inspector/V8DebuggerImpl.h"
|
| #include "platform/v8_inspector/V8InspectorSessionImpl.h"
|
| #include "platform/v8_inspector/V8ProfilerAgentImpl.h"
|
| +#include "platform/v8_inspector/V8RuntimeAgentImpl.h"
|
| #include "platform/v8_inspector/V8StackTraceImpl.h"
|
| #include "platform/v8_inspector/V8StringUtil.h"
|
| #include "platform/v8_inspector/public/ConsoleAPITypes.h"
|
| @@ -202,6 +203,15 @@ public:
|
| }
|
| return nullptr;
|
| }
|
| +
|
| + V8RuntimeAgentImpl* runtimeAgent()
|
| + {
|
| + if (V8InspectorSessionImpl* session = currentSession()) {
|
| + if (session && session->runtimeAgentImpl()->enabled())
|
| + return session->runtimeAgentImpl();
|
| + }
|
| + return nullptr;
|
| + }
|
| private:
|
| const v8::FunctionCallbackInfo<v8::Value>& m_info;
|
| v8::Isolate* m_isolate;
|
| @@ -572,6 +582,20 @@ void V8Console::unmonitorFunctionCallback(const v8::FunctionCallbackInfo<v8::Val
|
| setFunctionBreakpoint(helper, function, V8DebuggerAgentImpl::MonitorCommandBreakpointSource, String16(), false);
|
| }
|
|
|
| +void V8Console::inspectedObject(const v8::FunctionCallbackInfo<v8::Value>& info, unsigned num)
|
| +{
|
| + ASSERT(num < V8RuntimeAgentImpl::inspectedObjectBufferSize);
|
| + ConsoleHelper helper(info);
|
| + if (V8RuntimeAgentImpl* runtimeAgent = helper.runtimeAgent()) {
|
| + V8RuntimeAgent::Inspectable* object = runtimeAgent->inspectedObject(num);
|
| + v8::Isolate* isolate = info.GetIsolate();
|
| + if (object)
|
| + info.GetReturnValue().Set(object->get(isolate->GetCurrentContext()));
|
| + else
|
| + info.GetReturnValue().Set(v8::Undefined(isolate));
|
| + }
|
| +}
|
| +
|
| v8::MaybeLocal<v8::Object> V8Console::createConsole(v8::Local<v8::Context> context, InspectedContext* inspectedContext, bool hasMemoryAttribute)
|
| {
|
| v8::Isolate* isolate = context->GetIsolate();
|
| @@ -639,6 +663,11 @@ v8::Local<v8::Object> V8Console::createCommandLineAPI(v8::Local<v8::Context> con
|
| createBoundFunctionProperty(context, commandLineAPI, commandLineAPI, "undebug", V8Console::undebugFunctionCallback);
|
| createBoundFunctionProperty(context, commandLineAPI, commandLineAPI, "monitor", V8Console::monitorFunctionCallback);
|
| createBoundFunctionProperty(context, commandLineAPI, commandLineAPI, "unmonitor", V8Console::unmonitorFunctionCallback);
|
| + createBoundFunctionProperty(context, commandLineAPI, commandLineAPI, "$0", V8Console::firstInspectedObject);
|
| + createBoundFunctionProperty(context, commandLineAPI, commandLineAPI, "$1", V8Console::secondInspectedObject);
|
| + createBoundFunctionProperty(context, commandLineAPI, commandLineAPI, "$2", V8Console::thirdInspectedObject);
|
| + createBoundFunctionProperty(context, commandLineAPI, commandLineAPI, "$3", V8Console::fourthInspectedObject);
|
| + createBoundFunctionProperty(context, commandLineAPI, commandLineAPI, "$4", V8Console::fifthInspectedObject);
|
|
|
| commandLineAPI->SetPrivate(context, inspectedContextPrivateKey(isolate), v8::External::New(isolate, inspectedContext));
|
| return commandLineAPI;
|
|
|