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

Side by Side Diff: src/inspector/v8-console.h

Issue 2793443002: Revert of [inspector] convert V8Console static methods into members (Closed)
Patch Set: Created 3 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
« no previous file with comments | « src/inspector/inspected-context.cc ('k') | src/inspector/v8-console.cc » ('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 #ifndef V8_INSPECTOR_V8CONSOLE_H_ 5 #ifndef V8_INSPECTOR_V8CONSOLE_H_
6 #define V8_INSPECTOR_V8CONSOLE_H_ 6 #define V8_INSPECTOR_V8CONSOLE_H_
7 7
8 #include "src/base/macros.h" 8 #include "src/base/macros.h"
9 9
10 #include "include/v8.h" 10 #include "include/v8.h"
11 11
12 namespace v8_inspector { 12 namespace v8_inspector {
13 13
14 class InspectedContext; 14 class InspectedContext;
15 class V8InspectorImpl; 15 class V8InspectorImpl;
16 16
17 // Console API 17 // Console API
18 // https://console.spec.whatwg.org/#console-interface 18 // https://console.spec.whatwg.org/#console-interface
19 class V8Console { 19 class V8Console {
20 public: 20 public:
21 v8::Local<v8::Object> createConsole(v8::Local<v8::Context> context); 21 static v8::Local<v8::Object> createConsole(InspectedContext*);
22 v8::Local<v8::Object> createCommandLineAPI(v8::Local<v8::Context> context); 22 static v8::Local<v8::Object> createCommandLineAPI(InspectedContext*);
23 void installMemoryGetter(v8::Local<v8::Context> context, 23 static void installMemoryGetter(V8InspectorImpl* inspector,
24 v8::Local<v8::Object> console); 24 v8::Local<v8::Context> context,
25 v8::Local<v8::Object> console);
25 26
26 class CommandLineAPIScope { 27 class CommandLineAPIScope {
27 public: 28 public:
28 CommandLineAPIScope(v8::Local<v8::Context>, 29 CommandLineAPIScope(v8::Local<v8::Context>,
29 v8::Local<v8::Object> commandLineAPI, 30 v8::Local<v8::Object> commandLineAPI,
30 v8::Local<v8::Object> global); 31 v8::Local<v8::Object> global);
31 ~CommandLineAPIScope(); 32 ~CommandLineAPIScope();
32 33
33 private: 34 private:
34 static void accessorGetterCallback( 35 static void accessorGetterCallback(
35 v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value>&); 36 v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value>&);
36 static void accessorSetterCallback(v8::Local<v8::Name>, 37 static void accessorSetterCallback(v8::Local<v8::Name>,
37 v8::Local<v8::Value>, 38 v8::Local<v8::Value>,
38 const v8::PropertyCallbackInfo<void>&); 39 const v8::PropertyCallbackInfo<void>&);
39 40
40 v8::Local<v8::Context> m_context; 41 v8::Local<v8::Context> m_context;
41 v8::Local<v8::Object> m_commandLineAPI; 42 v8::Local<v8::Object> m_commandLineAPI;
42 v8::Local<v8::Object> m_global; 43 v8::Local<v8::Object> m_global;
43 v8::Local<v8::Set> m_installedMethods; 44 v8::Local<v8::Set> m_installedMethods;
44 bool m_cleanup; 45 bool m_cleanup;
45 46
46 DISALLOW_COPY_AND_ASSIGN(CommandLineAPIScope); 47 DISALLOW_COPY_AND_ASSIGN(CommandLineAPIScope);
47 }; 48 };
48 49
49 explicit V8Console(V8InspectorImpl* inspector);
50
51 private: 50 private:
52 void debugCallback(const v8::FunctionCallbackInfo<v8::Value>&); 51 static void debugCallback(const v8::FunctionCallbackInfo<v8::Value>&);
53 void errorCallback(const v8::FunctionCallbackInfo<v8::Value>&); 52 static void errorCallback(const v8::FunctionCallbackInfo<v8::Value>&);
54 void infoCallback(const v8::FunctionCallbackInfo<v8::Value>&); 53 static void infoCallback(const v8::FunctionCallbackInfo<v8::Value>&);
55 void logCallback(const v8::FunctionCallbackInfo<v8::Value>&); 54 static void logCallback(const v8::FunctionCallbackInfo<v8::Value>&);
56 void warnCallback(const v8::FunctionCallbackInfo<v8::Value>&); 55 static void warnCallback(const v8::FunctionCallbackInfo<v8::Value>&);
57 void dirCallback(const v8::FunctionCallbackInfo<v8::Value>&); 56 static void dirCallback(const v8::FunctionCallbackInfo<v8::Value>&);
58 void dirxmlCallback(const v8::FunctionCallbackInfo<v8::Value>&); 57 static void dirxmlCallback(const v8::FunctionCallbackInfo<v8::Value>&);
59 void tableCallback(const v8::FunctionCallbackInfo<v8::Value>&); 58 static void tableCallback(const v8::FunctionCallbackInfo<v8::Value>&);
60 void traceCallback(const v8::FunctionCallbackInfo<v8::Value>&); 59 static void traceCallback(const v8::FunctionCallbackInfo<v8::Value>&);
61 void groupCallback(const v8::FunctionCallbackInfo<v8::Value>&); 60 static void groupCallback(const v8::FunctionCallbackInfo<v8::Value>&);
62 void groupCollapsedCallback(const v8::FunctionCallbackInfo<v8::Value>&); 61 static void groupCollapsedCallback(
63 void groupEndCallback(const v8::FunctionCallbackInfo<v8::Value>&); 62 const v8::FunctionCallbackInfo<v8::Value>&);
64 void clearCallback(const v8::FunctionCallbackInfo<v8::Value>&); 63 static void groupEndCallback(const v8::FunctionCallbackInfo<v8::Value>&);
65 void countCallback(const v8::FunctionCallbackInfo<v8::Value>&); 64 static void clearCallback(const v8::FunctionCallbackInfo<v8::Value>&);
66 void assertCallback(const v8::FunctionCallbackInfo<v8::Value>&); 65 static void countCallback(const v8::FunctionCallbackInfo<v8::Value>&);
67 void markTimelineCallback(const v8::FunctionCallbackInfo<v8::Value>&); 66 static void assertCallback(const v8::FunctionCallbackInfo<v8::Value>&);
68 void profileCallback(const v8::FunctionCallbackInfo<v8::Value>&); 67 static void markTimelineCallback(const v8::FunctionCallbackInfo<v8::Value>&);
69 void profileEndCallback(const v8::FunctionCallbackInfo<v8::Value>&); 68 static void profileCallback(const v8::FunctionCallbackInfo<v8::Value>&);
70 void timelineCallback(const v8::FunctionCallbackInfo<v8::Value>&); 69 static void profileEndCallback(const v8::FunctionCallbackInfo<v8::Value>&);
71 void timelineEndCallback(const v8::FunctionCallbackInfo<v8::Value>&); 70 static void timelineCallback(const v8::FunctionCallbackInfo<v8::Value>&);
72 void timeCallback(const v8::FunctionCallbackInfo<v8::Value>&); 71 static void timelineEndCallback(const v8::FunctionCallbackInfo<v8::Value>&);
73 void timeEndCallback(const v8::FunctionCallbackInfo<v8::Value>&); 72 static void timeCallback(const v8::FunctionCallbackInfo<v8::Value>&);
74 void timeStampCallback(const v8::FunctionCallbackInfo<v8::Value>&); 73 static void timeEndCallback(const v8::FunctionCallbackInfo<v8::Value>&);
75 74 static void timeStampCallback(const v8::FunctionCallbackInfo<v8::Value>&);
76 template <void (V8Console::*func)(const v8::FunctionCallbackInfo<v8::Value>&)>
77 static void call(const v8::FunctionCallbackInfo<v8::Value>& info) {
78 V8Console* console =
79 static_cast<V8Console*>(info.Data().As<v8::External>()->Value());
80 (console->*func)(info);
81 }
82
83 // TODO(foolip): There is no spec for the Memory Info API, see blink-dev: 75 // TODO(foolip): There is no spec for the Memory Info API, see blink-dev:
84 // https://groups.google.com/a/chromium.org/d/msg/blink-dev/g5YRCGpC9vs/b4OJz7 1NmPwJ 76 // https://groups.google.com/a/chromium.org/d/msg/blink-dev/g5YRCGpC9vs/b4OJz7 1NmPwJ
85 void memoryGetterCallback(const v8::FunctionCallbackInfo<v8::Value>&); 77 static void memoryGetterCallback(const v8::FunctionCallbackInfo<v8::Value>&);
86 void memorySetterCallback(const v8::FunctionCallbackInfo<v8::Value>&); 78 static void memorySetterCallback(const v8::FunctionCallbackInfo<v8::Value>&);
87 79
88 // CommandLineAPI 80 // CommandLineAPI
89 void keysCallback(const v8::FunctionCallbackInfo<v8::Value>&); 81 static void keysCallback(const v8::FunctionCallbackInfo<v8::Value>&);
90 void valuesCallback(const v8::FunctionCallbackInfo<v8::Value>&); 82 static void valuesCallback(const v8::FunctionCallbackInfo<v8::Value>&);
91 void debugFunctionCallback(const v8::FunctionCallbackInfo<v8::Value>&); 83 static void debugFunctionCallback(const v8::FunctionCallbackInfo<v8::Value>&);
92 void undebugFunctionCallback(const v8::FunctionCallbackInfo<v8::Value>&); 84 static void undebugFunctionCallback(
93 void monitorFunctionCallback(const v8::FunctionCallbackInfo<v8::Value>&); 85 const v8::FunctionCallbackInfo<v8::Value>&);
94 void unmonitorFunctionCallback(const v8::FunctionCallbackInfo<v8::Value>&); 86 static void monitorFunctionCallback(
95 void lastEvaluationResultCallback(const v8::FunctionCallbackInfo<v8::Value>&); 87 const v8::FunctionCallbackInfo<v8::Value>&);
96 void inspectCallback(const v8::FunctionCallbackInfo<v8::Value>&); 88 static void unmonitorFunctionCallback(
97 void copyCallback(const v8::FunctionCallbackInfo<v8::Value>&); 89 const v8::FunctionCallbackInfo<v8::Value>&);
98 void inspectedObject(const v8::FunctionCallbackInfo<v8::Value>&, 90 static void lastEvaluationResultCallback(
99 unsigned num); 91 const v8::FunctionCallbackInfo<v8::Value>&);
100 void inspectedObject0(const v8::FunctionCallbackInfo<v8::Value>& info) { 92 static void inspectCallback(const v8::FunctionCallbackInfo<v8::Value>&);
93 static void copyCallback(const v8::FunctionCallbackInfo<v8::Value>&);
94 static void inspectedObject(const v8::FunctionCallbackInfo<v8::Value>&,
95 unsigned num);
96 static void inspectedObject0(
97 const v8::FunctionCallbackInfo<v8::Value>& info) {
101 inspectedObject(info, 0); 98 inspectedObject(info, 0);
102 } 99 }
103 void inspectedObject1(const v8::FunctionCallbackInfo<v8::Value>& info) { 100 static void inspectedObject1(
101 const v8::FunctionCallbackInfo<v8::Value>& info) {
104 inspectedObject(info, 1); 102 inspectedObject(info, 1);
105 } 103 }
106 void inspectedObject2(const v8::FunctionCallbackInfo<v8::Value>& info) { 104 static void inspectedObject2(
105 const v8::FunctionCallbackInfo<v8::Value>& info) {
107 inspectedObject(info, 2); 106 inspectedObject(info, 2);
108 } 107 }
109 void inspectedObject3(const v8::FunctionCallbackInfo<v8::Value>& info) { 108 static void inspectedObject3(
109 const v8::FunctionCallbackInfo<v8::Value>& info) {
110 inspectedObject(info, 3); 110 inspectedObject(info, 3);
111 } 111 }
112 void inspectedObject4(const v8::FunctionCallbackInfo<v8::Value>& info) { 112 static void inspectedObject4(
113 const v8::FunctionCallbackInfo<v8::Value>& info) {
113 inspectedObject(info, 4); 114 inspectedObject(info, 4);
114 } 115 }
115
116 V8InspectorImpl* m_inspector;
117 }; 116 };
118 117
119 } // namespace v8_inspector 118 } // namespace v8_inspector
120 119
121 #endif // V8_INSPECTOR_V8CONSOLE_H_ 120 #endif // V8_INSPECTOR_V8CONSOLE_H_
OLDNEW
« 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