| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 InjectedScriptNative_h | 5 #ifndef InjectedScriptNative_h |
| 6 #define InjectedScriptNative_h | 6 #define InjectedScriptNative_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/V8GlobalValueMap.h" | 8 #include "bindings/core/v8/V8GlobalValueMap.h" |
| 9 #include "wtf/Forward.h" | 9 #include "wtf/Forward.h" |
| 10 #include "wtf/HashMap.h" | 10 #include "wtf/HashMap.h" |
| 11 #include "wtf/RefCounted.h" | 11 #include "wtf/RefCounted.h" |
| 12 #include <v8.h> | 12 #include <v8.h> |
| 13 | 13 |
| 14 namespace blink { | 14 namespace blink { |
| 15 | 15 |
| 16 class InjectedScriptNative final : public RefCounted<InjectedScriptNative> { | 16 class InjectedScriptNative final : public RefCounted<InjectedScriptNative> { |
| 17 public: | 17 public: |
| 18 explicit InjectedScriptNative(v8::Isolate*); | 18 explicit InjectedScriptNative(v8::Isolate*); |
| 19 ~InjectedScriptNative(); | 19 ~InjectedScriptNative(); |
| 20 | 20 |
| 21 void setOnInjectedScriptHost(v8::Handle<v8::Object>); | 21 void setOnInjectedScriptHost(v8::Local<v8::Object>); |
| 22 static InjectedScriptNative* fromInjectedScriptHost(v8::Handle<v8::Object>); | 22 static InjectedScriptNative* fromInjectedScriptHost(v8::Local<v8::Object>); |
| 23 | 23 |
| 24 int bind(v8::Local<v8::Value>, const String& groupName); | 24 int bind(v8::Local<v8::Value>, const String& groupName); |
| 25 void unbind(int id); | 25 void unbind(int id); |
| 26 v8::Local<v8::Value> objectForId(int id); | 26 v8::Local<v8::Value> objectForId(int id); |
| 27 | 27 |
| 28 void releaseObjectGroup(const String& groupName); | 28 void releaseObjectGroup(const String& groupName); |
| 29 String groupName(int objectId) const; | 29 String groupName(int objectId) const; |
| 30 | 30 |
| 31 private: | 31 private: |
| 32 void addObjectToGroup(int objectId, const String& groupName); | 32 void addObjectToGroup(int objectId, const String& groupName); |
| 33 | 33 |
| 34 int m_lastBoundObjectId; | 34 int m_lastBoundObjectId; |
| 35 v8::Isolate* m_isolate; | 35 v8::Isolate* m_isolate; |
| 36 V8GlobalValueMap<int, v8::Value, v8::kNotWeak> m_idToWrappedObject; | 36 V8GlobalValueMap<int, v8::Value, v8::kNotWeak> m_idToWrappedObject; |
| 37 typedef HashMap<int, String> IdToObjectGroupName; | 37 typedef HashMap<int, String> IdToObjectGroupName; |
| 38 IdToObjectGroupName m_idToObjectGroupName; | 38 IdToObjectGroupName m_idToObjectGroupName; |
| 39 typedef HashMap<String, Vector<int>> NameToObjectGroup; | 39 typedef HashMap<String, Vector<int>> NameToObjectGroup; |
| 40 NameToObjectGroup m_nameToObjectGroup; | 40 NameToObjectGroup m_nameToObjectGroup; |
| 41 }; | 41 }; |
| 42 | 42 |
| 43 } // namespace blink | 43 } // namespace blink |
| 44 | 44 |
| 45 #endif | 45 #endif |
| OLD | NEW |