OLD | NEW |
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 #ifndef V8Console_h | 5 #ifndef V8Console_h |
6 #define V8Console_h | 6 #define V8Console_h |
7 | 7 |
| 8 #include "platform/inspector_protocol/Allocator.h" |
8 #include <v8.h> | 9 #include <v8.h> |
9 | 10 |
10 namespace blink { | 11 namespace blink { |
11 | 12 |
12 class InspectedContext; | 13 class InspectedContext; |
13 | 14 |
14 // Console API | 15 // Console API |
15 // https://console.spec.whatwg.org/#console-interface | 16 // https://console.spec.whatwg.org/#console-interface |
16 class V8Console { | 17 class V8Console { |
17 public: | 18 public: |
18 static v8::Local<v8::Object> createConsole(InspectedContext*, bool hasMemory
Attribute); | 19 static v8::Local<v8::Object> createConsole(InspectedContext*, bool hasMemory
Attribute); |
| 20 static void clearInspectedContextIfNeeded(v8::Local<v8::Context>, v8::Local<
v8::Object> console); |
19 static v8::Local<v8::Object> createCommandLineAPI(InspectedContext*); | 21 static v8::Local<v8::Object> createCommandLineAPI(InspectedContext*); |
20 static void clearInspectedContextIfNeeded(v8::Local<v8::Context>, v8::Local<
v8::Object> console); | 22 |
| 23 class CommandLineAPIScope { |
| 24 PROTOCOL_DISALLOW_COPY(CommandLineAPIScope); |
| 25 public: |
| 26 CommandLineAPIScope(v8::Local<v8::Context>, v8::Local<v8::Object> comman
dLineAPI, v8::Local<v8::Object> global); |
| 27 ~CommandLineAPIScope(); |
| 28 |
| 29 private: |
| 30 static void accessorGetterCallback(v8::Local<v8::Name>, const v8::Proper
tyCallbackInfo<v8::Value>&); |
| 31 static void accessorSetterCallback(v8::Local<v8::Name>, v8::Local<v8::Va
lue>, const v8::PropertyCallbackInfo<void>&); |
| 32 |
| 33 v8::Local<v8::Context> m_context; |
| 34 v8::Local<v8::Object> m_commandLineAPI; |
| 35 v8::Local<v8::Object> m_global; |
| 36 v8::Local<v8::Set> m_installedMethods; |
| 37 bool m_cleanup; |
| 38 }; |
21 | 39 |
22 private: | 40 private: |
23 static void debugCallback(const v8::FunctionCallbackInfo<v8::Value>&); | 41 static void debugCallback(const v8::FunctionCallbackInfo<v8::Value>&); |
24 static void errorCallback(const v8::FunctionCallbackInfo<v8::Value>&); | 42 static void errorCallback(const v8::FunctionCallbackInfo<v8::Value>&); |
25 static void infoCallback(const v8::FunctionCallbackInfo<v8::Value>&); | 43 static void infoCallback(const v8::FunctionCallbackInfo<v8::Value>&); |
26 static void logCallback(const v8::FunctionCallbackInfo<v8::Value>&); | 44 static void logCallback(const v8::FunctionCallbackInfo<v8::Value>&); |
27 static void warnCallback(const v8::FunctionCallbackInfo<v8::Value>&); | 45 static void warnCallback(const v8::FunctionCallbackInfo<v8::Value>&); |
28 static void dirCallback(const v8::FunctionCallbackInfo<v8::Value>&); | 46 static void dirCallback(const v8::FunctionCallbackInfo<v8::Value>&); |
29 static void dirxmlCallback(const v8::FunctionCallbackInfo<v8::Value>&); | 47 static void dirxmlCallback(const v8::FunctionCallbackInfo<v8::Value>&); |
30 static void tableCallback(const v8::FunctionCallbackInfo<v8::Value>&); | 48 static void tableCallback(const v8::FunctionCallbackInfo<v8::Value>&); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 static void inspectedObject0(const v8::FunctionCallbackInfo<v8::Value>& info
) { inspectedObject(info, 0); } | 80 static void inspectedObject0(const v8::FunctionCallbackInfo<v8::Value>& info
) { inspectedObject(info, 0); } |
63 static void inspectedObject1(const v8::FunctionCallbackInfo<v8::Value>& info
) { inspectedObject(info, 1); } | 81 static void inspectedObject1(const v8::FunctionCallbackInfo<v8::Value>& info
) { inspectedObject(info, 1); } |
64 static void inspectedObject2(const v8::FunctionCallbackInfo<v8::Value>& info
) { inspectedObject(info, 2); } | 82 static void inspectedObject2(const v8::FunctionCallbackInfo<v8::Value>& info
) { inspectedObject(info, 2); } |
65 static void inspectedObject3(const v8::FunctionCallbackInfo<v8::Value>& info
) { inspectedObject(info, 3); } | 83 static void inspectedObject3(const v8::FunctionCallbackInfo<v8::Value>& info
) { inspectedObject(info, 3); } |
66 static void inspectedObject4(const v8::FunctionCallbackInfo<v8::Value>& info
) { inspectedObject(info, 4); } | 84 static void inspectedObject4(const v8::FunctionCallbackInfo<v8::Value>& info
) { inspectedObject(info, 4); } |
67 }; | 85 }; |
68 | 86 |
69 } // namespace blink | 87 } // namespace blink |
70 | 88 |
71 #endif // V8Console_h | 89 #endif // V8Console_h |
OLD | NEW |