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

Side by Side Diff: Source/bindings/core/v8/custom/V8InjectedScriptManager.cpp

Issue 537403002: bindings: Renames from/toInternalPointer, etc. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Synced. Created 6 years, 3 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 void InjectedScriptManager::removeCallbackData(InjectedScriptManager::CallbackDa ta* callbackData) 58 void InjectedScriptManager::removeCallbackData(InjectedScriptManager::CallbackDa ta* callbackData)
59 { 59 {
60 ASSERT(m_callbackDataSet.contains(callbackData)); 60 ASSERT(m_callbackDataSet.contains(callbackData));
61 m_callbackDataSet.remove(callbackData); 61 m_callbackDataSet.remove(callbackData);
62 } 62 }
63 63
64 static v8::Local<v8::Object> createInjectedScriptHostV8Wrapper(PassRefPtrWillBeR awPtr<InjectedScriptHost> host, InjectedScriptManager* injectedScriptManager, v8 ::Handle<v8::Object> creationContext, v8::Isolate* isolate) 64 static v8::Local<v8::Object> createInjectedScriptHostV8Wrapper(PassRefPtrWillBeR awPtr<InjectedScriptHost> host, InjectedScriptManager* injectedScriptManager, v8 ::Handle<v8::Object> creationContext, v8::Isolate* isolate)
65 { 65 {
66 ASSERT(host); 66 ASSERT(host);
67 67
68 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext , &V8InjectedScriptHost::wrapperTypeInfo, V8InjectedScriptHost::toInternalPointe r(host.get()), isolate); 68 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext , &V8InjectedScriptHost::wrapperTypeInfo, host->toScriptWrappableBase(), isolate );
69 if (UNLIKELY(wrapper.IsEmpty())) 69 if (UNLIKELY(wrapper.IsEmpty()))
70 return wrapper; 70 return wrapper;
71 71
72 // Create a weak reference to the v8 wrapper of InspectorBackend to deref 72 // Create a weak reference to the v8 wrapper of InspectorBackend to deref
73 // InspectorBackend when the wrapper is garbage collected. 73 // InspectorBackend when the wrapper is garbage collected.
74 InjectedScriptManager::CallbackData* callbackData = injectedScriptManager->c reateCallbackData(injectedScriptManager); 74 InjectedScriptManager::CallbackData* callbackData = injectedScriptManager->c reateCallbackData(injectedScriptManager);
75 #if ENABLE(OILPAN) 75 #if ENABLE(OILPAN)
76 callbackData->hostPtr = new WrapperPersistent<InjectedScriptHost>(host.get() ); 76 callbackData->hostPtr = new WrapperPersistent<InjectedScriptHost>(host.get() );
77 #else 77 #else
78 callbackData->host = host.get(); 78 callbackData->host = host.get();
79 #endif 79 #endif
80 callbackData->handle.set(isolate, wrapper); 80 callbackData->handle.set(isolate, wrapper);
81 callbackData->handle.setWeak(callbackData, &InjectedScriptManager::setWeakCa llback); 81 callbackData->handle.setWeak(callbackData, &InjectedScriptManager::setWeakCa llback);
82 82
83 #if ENABLE(OILPAN) 83 #if ENABLE(OILPAN)
84 V8DOMWrapper::setNativeInfoWithPersistentHandle(wrapper, &V8InjectedScriptHo st::wrapperTypeInfo, V8InjectedScriptHost::toInternalPointer(host.get()), callba ckData->hostPtr); 84 V8DOMWrapper::setNativeInfoWithPersistentHandle(wrapper, &V8InjectedScriptHo st::wrapperTypeInfo, host->toScriptWrappableBase(), callbackData->hostPtr);
85 #else 85 #else
86 V8DOMWrapper::setNativeInfo(wrapper, &V8InjectedScriptHost::wrapperTypeInfo, V8InjectedScriptHost::toInternalPointer(host.get())); 86 V8DOMWrapper::setNativeInfo(wrapper, &V8InjectedScriptHost::wrapperTypeInfo, host->toScriptWrappableBase());
87 #endif 87 #endif
88 ASSERT(V8DOMWrapper::isDOMWrapper(wrapper)); 88 ASSERT(V8DOMWrapper::isDOMWrapper(wrapper));
89 return wrapper; 89 return wrapper;
90 } 90 }
91 91
92 ScriptValue InjectedScriptManager::createInjectedScript(const String& scriptSour ce, ScriptState* inspectedScriptState, int id) 92 ScriptValue InjectedScriptManager::createInjectedScript(const String& scriptSour ce, ScriptState* inspectedScriptState, int id)
93 { 93 {
94 v8::Isolate* isolate = inspectedScriptState->isolate(); 94 v8::Isolate* isolate = inspectedScriptState->isolate();
95 ScriptState::Scope scope(inspectedScriptState); 95 ScriptState::Scope scope(inspectedScriptState);
96 96
(...skipping 22 matching lines...) Expand all
119 119
120 bool InjectedScriptManager::canAccessInspectedWindow(ScriptState* scriptState) 120 bool InjectedScriptManager::canAccessInspectedWindow(ScriptState* scriptState)
121 { 121 {
122 ScriptState::Scope scope(scriptState); 122 ScriptState::Scope scope(scriptState);
123 v8::Local<v8::Object> global = scriptState->context()->Global(); 123 v8::Local<v8::Object> global = scriptState->context()->Global();
124 if (global.IsEmpty()) 124 if (global.IsEmpty())
125 return false; 125 return false;
126 v8::Handle<v8::Object> holder = V8Window::findInstanceInPrototypeChain(globa l, scriptState->isolate()); 126 v8::Handle<v8::Object> holder = V8Window::findInstanceInPrototypeChain(globa l, scriptState->isolate());
127 if (holder.IsEmpty()) 127 if (holder.IsEmpty())
128 return false; 128 return false;
129 LocalFrame* frame = V8Window::toNative(holder)->frame(); 129 LocalFrame* frame = V8Window::toImpl(holder)->frame();
130 130
131 return BindingSecurity::shouldAllowAccessToFrame(scriptState->isolate(), fra me, DoNotReportSecurityError); 131 return BindingSecurity::shouldAllowAccessToFrame(scriptState->isolate(), fra me, DoNotReportSecurityError);
132 } 132 }
133 133
134 void InjectedScriptManager::setWeakCallback(const v8::WeakCallbackData<v8::Objec t, InjectedScriptManager::CallbackData>& data) 134 void InjectedScriptManager::setWeakCallback(const v8::WeakCallbackData<v8::Objec t, InjectedScriptManager::CallbackData>& data)
135 { 135 {
136 InjectedScriptManager::CallbackData* callbackData = data.GetParameter(); 136 InjectedScriptManager::CallbackData* callbackData = data.GetParameter();
137 callbackData->injectedScriptManager->removeCallbackData(callbackData); 137 callbackData->injectedScriptManager->removeCallbackData(callbackData);
138 } 138 }
139 139
140 } // namespace blink 140 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698