| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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_INJECTEDSCRIPTNATIVE_H_ | 5 #ifndef V8_INSPECTOR_INJECTEDSCRIPTNATIVE_H_ |
| 6 #define V8_INSPECTOR_INJECTEDSCRIPTNATIVE_H_ | 6 #define V8_INSPECTOR_INJECTEDSCRIPTNATIVE_H_ |
| 7 | 7 |
| 8 #include "src/inspector/protocol/Protocol.h" | 8 #include "src/inspector/protocol/Protocol.h" |
| 9 | 9 |
| 10 #include "include/v8.h" | 10 #include "include/v8.h" |
| 11 | 11 |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 namespace v8_inspector { | 14 namespace v8_inspector { |
| 15 | 15 |
| 16 class InjectedScriptNative final { | 16 class InjectedScriptNative final { |
| 17 public: | 17 public: |
| 18 explicit InjectedScriptNative(v8::Isolate*); | 18 explicit InjectedScriptNative(v8::Isolate*); |
| 19 ~InjectedScriptNative(); | 19 ~InjectedScriptNative(); |
| 20 | 20 |
| 21 void setOnInjectedScriptHost(v8::Local<v8::Object>); | 21 void setOnInjectedScriptHost(v8::Local<v8::Object>); |
| 22 static InjectedScriptNative* fromInjectedScriptHost(v8::Local<v8::Object>); | 22 static InjectedScriptNative* fromInjectedScriptHost(v8::Isolate* isolate, |
| 23 v8::Local<v8::Object>); |
| 23 | 24 |
| 24 int bind(v8::Local<v8::Value>, const String16& groupName); | 25 int bind(v8::Local<v8::Value>, const String16& groupName); |
| 25 void unbind(int id); | 26 void unbind(int id); |
| 26 v8::Local<v8::Value> objectForId(int id); | 27 v8::Local<v8::Value> objectForId(int id); |
| 27 | 28 |
| 28 void releaseObjectGroup(const String16& groupName); | 29 void releaseObjectGroup(const String16& groupName); |
| 29 String16 groupName(int objectId) const; | 30 String16 groupName(int objectId) const; |
| 30 | 31 |
| 31 private: | 32 private: |
| 32 void addObjectToGroup(int objectId, const String16& groupName); | 33 void addObjectToGroup(int objectId, const String16& groupName); |
| 33 | 34 |
| 34 int m_lastBoundObjectId; | 35 int m_lastBoundObjectId; |
| 35 v8::Isolate* m_isolate; | 36 v8::Isolate* m_isolate; |
| 36 protocol::HashMap<int, std::unique_ptr<v8::Global<v8::Value>>> | 37 protocol::HashMap<int, std::unique_ptr<v8::Global<v8::Value>>> |
| 37 m_idToWrappedObject; | 38 m_idToWrappedObject; |
| 38 typedef protocol::HashMap<int, String16> IdToObjectGroupName; | 39 typedef protocol::HashMap<int, String16> IdToObjectGroupName; |
| 39 IdToObjectGroupName m_idToObjectGroupName; | 40 IdToObjectGroupName m_idToObjectGroupName; |
| 40 typedef protocol::HashMap<String16, std::vector<int>> NameToObjectGroup; | 41 typedef protocol::HashMap<String16, std::vector<int>> NameToObjectGroup; |
| 41 NameToObjectGroup m_nameToObjectGroup; | 42 NameToObjectGroup m_nameToObjectGroup; |
| 42 }; | 43 }; |
| 43 | 44 |
| 44 } // namespace v8_inspector | 45 } // namespace v8_inspector |
| 45 | 46 |
| 46 #endif // V8_INSPECTOR_INJECTEDSCRIPTNATIVE_H_ | 47 #endif // V8_INSPECTOR_INJECTEDSCRIPTNATIVE_H_ |
| OLD | NEW |