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

Side by Side Diff: third_party/WebKit/Source/platform/v8_inspector/InjectedScriptNative.cpp

Issue 2001893002: DevTools: expose raw pointers in protocol collections, s/ASSERT/DCHECK/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
OLDNEW
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 15 matching lines...) Expand all
26 injectedScriptHost->SetPrivate(m_isolate->GetCurrentContext(), privateKey, e xternal); 26 injectedScriptHost->SetPrivate(m_isolate->GetCurrentContext(), privateKey, e xternal);
27 } 27 }
28 28
29 InjectedScriptNative* InjectedScriptNative::fromInjectedScriptHost(v8::Local<v8: :Object> injectedScriptObject) 29 InjectedScriptNative* InjectedScriptNative::fromInjectedScriptHost(v8::Local<v8: :Object> injectedScriptObject)
30 { 30 {
31 v8::Isolate* isolate = injectedScriptObject->GetIsolate(); 31 v8::Isolate* isolate = injectedScriptObject->GetIsolate();
32 v8::HandleScope handleScope(isolate); 32 v8::HandleScope handleScope(isolate);
33 v8::Local<v8::Context> context = isolate->GetCurrentContext(); 33 v8::Local<v8::Context> context = isolate->GetCurrentContext();
34 v8::Local<v8::Private> privateKey = v8::Private::ForApi(isolate, v8::String: :NewFromUtf8(isolate, privateKeyName, v8::NewStringType::kInternalized).ToLocalC hecked()); 34 v8::Local<v8::Private> privateKey = v8::Private::ForApi(isolate, v8::String: :NewFromUtf8(isolate, privateKeyName, v8::NewStringType::kInternalized).ToLocalC hecked());
35 v8::Local<v8::Value> value = injectedScriptObject->GetPrivate(context, priva teKey).ToLocalChecked(); 35 v8::Local<v8::Value> value = injectedScriptObject->GetPrivate(context, priva teKey).ToLocalChecked();
36 ASSERT(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, adoptPtr(new v8::Global<v8::Value>(m_isolate, va lue)));
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698