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

Unified Diff: src/inspector/v8-console.h

Issue 2916803005: [inspector] Create InjectedScript per session in each context (Closed)
Patch Set: rebased Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/inspector/inspected-context.cc ('k') | src/inspector/v8-console.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/inspector/v8-console.h
diff --git a/src/inspector/v8-console.h b/src/inspector/v8-console.h
index e31133c4e1653f39d5a5680fce02d21bdf0e93fb..52318e0e29911f26dc0df3429620f1b0db6f55c4 100644
--- a/src/inspector/v8-console.h
+++ b/src/inspector/v8-console.h
@@ -19,7 +19,8 @@ class V8InspectorImpl;
// https://console.spec.whatwg.org/#console-interface
class V8Console : public v8::debug::ConsoleDelegate {
public:
- v8::Local<v8::Object> createCommandLineAPI(v8::Local<v8::Context> context);
+ v8::Local<v8::Object> createCommandLineAPI(v8::Local<v8::Context> context,
+ int sessionId);
void installMemoryGetter(v8::Local<v8::Context> context,
v8::Local<v8::Object> console);
@@ -79,12 +80,20 @@ class V8Console : public v8::debug::ConsoleDelegate {
static_cast<V8Console*>(info.Data().As<v8::External>()->Value());
(console->*func)(info);
}
+ using CommandLineAPIData = std::pair<V8Console*, int>;
+ template <void (V8Console::*func)(const v8::FunctionCallbackInfo<v8::Value>&,
+ int)>
+ static void call(const v8::FunctionCallbackInfo<v8::Value>& info) {
+ CommandLineAPIData* data = static_cast<CommandLineAPIData*>(
+ info.Data().As<v8::External>()->Value());
+ (data->first->*func)(info, data->second);
+ }
template <void (V8Console::*func)(const v8::debug::ConsoleCallArguments&)>
static void call(const v8::FunctionCallbackInfo<v8::Value>& info) {
- V8Console* console =
- static_cast<V8Console*>(info.Data().As<v8::External>()->Value());
+ CommandLineAPIData* data = static_cast<CommandLineAPIData*>(
+ info.Data().As<v8::External>()->Value());
v8::debug::ConsoleCallArguments args(info);
- (console->*func)(args);
+ (data->first->*func)(args);
}
// TODO(foolip): There is no spec for the Memory Info API, see blink-dev:
@@ -93,31 +102,43 @@ class V8Console : public v8::debug::ConsoleDelegate {
void memorySetterCallback(const v8::FunctionCallbackInfo<v8::Value>&);
// CommandLineAPI
- void keysCallback(const v8::FunctionCallbackInfo<v8::Value>&);
- void valuesCallback(const v8::FunctionCallbackInfo<v8::Value>&);
- void debugFunctionCallback(const v8::FunctionCallbackInfo<v8::Value>&);
- void undebugFunctionCallback(const v8::FunctionCallbackInfo<v8::Value>&);
- void monitorFunctionCallback(const v8::FunctionCallbackInfo<v8::Value>&);
- void unmonitorFunctionCallback(const v8::FunctionCallbackInfo<v8::Value>&);
- void lastEvaluationResultCallback(const v8::FunctionCallbackInfo<v8::Value>&);
- void inspectCallback(const v8::FunctionCallbackInfo<v8::Value>&);
- void copyCallback(const v8::FunctionCallbackInfo<v8::Value>&);
+ void keysCallback(const v8::FunctionCallbackInfo<v8::Value>&, int sessionId);
+ void valuesCallback(const v8::FunctionCallbackInfo<v8::Value>&,
+ int sessionId);
+ void debugFunctionCallback(const v8::FunctionCallbackInfo<v8::Value>&,
+ int sessionId);
+ void undebugFunctionCallback(const v8::FunctionCallbackInfo<v8::Value>&,
+ int sessionId);
+ void monitorFunctionCallback(const v8::FunctionCallbackInfo<v8::Value>&,
+ int sessionId);
+ void unmonitorFunctionCallback(const v8::FunctionCallbackInfo<v8::Value>&,
+ int sessionId);
+ void lastEvaluationResultCallback(const v8::FunctionCallbackInfo<v8::Value>&,
+ int sessionId);
+ void inspectCallback(const v8::FunctionCallbackInfo<v8::Value>&,
+ int sessionId);
+ void copyCallback(const v8::FunctionCallbackInfo<v8::Value>&, int sessionId);
void inspectedObject(const v8::FunctionCallbackInfo<v8::Value>&,
- unsigned num);
- void inspectedObject0(const v8::FunctionCallbackInfo<v8::Value>& info) {
- inspectedObject(info, 0);
+ int sessionId, unsigned num);
+ void inspectedObject0(const v8::FunctionCallbackInfo<v8::Value>& info,
+ int sessionId) {
+ inspectedObject(info, sessionId, 0);
}
- void inspectedObject1(const v8::FunctionCallbackInfo<v8::Value>& info) {
- inspectedObject(info, 1);
+ void inspectedObject1(const v8::FunctionCallbackInfo<v8::Value>& info,
+ int sessionId) {
+ inspectedObject(info, sessionId, 1);
}
- void inspectedObject2(const v8::FunctionCallbackInfo<v8::Value>& info) {
- inspectedObject(info, 2);
+ void inspectedObject2(const v8::FunctionCallbackInfo<v8::Value>& info,
+ int sessionId) {
+ inspectedObject(info, sessionId, 2);
}
- void inspectedObject3(const v8::FunctionCallbackInfo<v8::Value>& info) {
- inspectedObject(info, 3);
+ void inspectedObject3(const v8::FunctionCallbackInfo<v8::Value>& info,
+ int sessionId) {
+ inspectedObject(info, sessionId, 3);
}
- void inspectedObject4(const v8::FunctionCallbackInfo<v8::Value>& info) {
- inspectedObject(info, 4);
+ void inspectedObject4(const v8::FunctionCallbackInfo<v8::Value>& info,
+ int sessionId) {
+ inspectedObject(info, sessionId, 4);
}
V8InspectorImpl* m_inspector;
« no previous file with comments | « src/inspector/inspected-context.cc ('k') | src/inspector/v8-console.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698