| 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 #include "platform/v8_inspector/InjectedScriptNative.h" | 5 #include "platform/v8_inspector/InjectedScriptNative.h" |
| 6 | 6 |
| 7 #include "platform/inspector_protocol/Values.h" | 7 #include "platform/inspector_protocol/Values.h" |
| 8 | 8 |
| 9 namespace blink { | 9 namespace blink { |
| 10 | 10 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 DCHECK(value->IsExternal()); | 36 DCHECK(value->IsExternal()); |
| 37 v8::Local<v8::External> external = value.As<v8::External>(); | 37 v8::Local<v8::External> external = value.As<v8::External>(); |
| 38 return static_cast<InjectedScriptNative*>(external->Value()); | 38 return static_cast<InjectedScriptNative*>(external->Value()); |
| 39 } | 39 } |
| 40 | 40 |
| 41 int InjectedScriptNative::bind(v8::Local<v8::Value> value, const String16& group
Name) | 41 int InjectedScriptNative::bind(v8::Local<v8::Value> value, const String16& group
Name) |
| 42 { | 42 { |
| 43 if (m_lastBoundObjectId <= 0) | 43 if (m_lastBoundObjectId <= 0) |
| 44 m_lastBoundObjectId = 1; | 44 m_lastBoundObjectId = 1; |
| 45 int id = m_lastBoundObjectId++; | 45 int id = m_lastBoundObjectId++; |
| 46 m_idToWrappedObject.set(id, adoptPtr(new v8::Global<v8::Value>(m_isolate, va
lue))); | 46 m_idToWrappedObject.set(id, wrapUnique(new v8::Global<v8::Value>(m_isolate,
value))); |
| 47 addObjectToGroup(id, groupName); | 47 addObjectToGroup(id, groupName); |
| 48 return id; | 48 return id; |
| 49 } | 49 } |
| 50 | 50 |
| 51 void InjectedScriptNative::unbind(int id) | 51 void InjectedScriptNative::unbind(int id) |
| 52 { | 52 { |
| 53 m_idToWrappedObject.remove(id); | 53 m_idToWrappedObject.remove(id); |
| 54 m_idToObjectGroupName.remove(id); | 54 m_idToObjectGroupName.remove(id); |
| 55 } | 55 } |
| 56 | 56 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 | 88 |
| 89 String16 InjectedScriptNative::groupName(int objectId) const | 89 String16 InjectedScriptNative::groupName(int objectId) const |
| 90 { | 90 { |
| 91 if (objectId <= 0) | 91 if (objectId <= 0) |
| 92 return String16(); | 92 return String16(); |
| 93 return m_idToObjectGroupName.get(objectId); | 93 return m_idToObjectGroupName.get(objectId); |
| 94 } | 94 } |
| 95 | 95 |
| 96 } // namespace blink | 96 } // namespace blink |
| 97 | 97 |
| OLD | NEW |