OLD | NEW |
---|---|
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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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, V8InjectedScriptHost::toInternalPointe r(host.get()), 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) | |
76 callbackData->hostPtr = new WrapperPersistent<InjectedScriptHost>(host.get() ); | |
77 #else | |
75 callbackData->host = host.get(); | 78 callbackData->host = host.get(); |
zerny-chromium
2014/09/01 14:13:37
Is this field never used in the oilpan build?
wibling-chromium
2014/09/02 11:19:37
No, AFAICT it is only used to keep the object aliv
| |
79 #endif | |
76 callbackData->handle.set(isolate, wrapper); | 80 callbackData->handle.set(isolate, wrapper); |
77 callbackData->handle.setWeak(callbackData, &InjectedScriptManager::setWeakCa llback); | 81 callbackData->handle.setWeak(callbackData, &InjectedScriptManager::setWeakCa llback); |
78 | 82 |
79 #if ENABLE(OILPAN) | 83 #if ENABLE(OILPAN) |
80 V8DOMWrapper::setNativeInfoWithPersistentHandle(wrapper, &V8InjectedScriptHo st::wrapperTypeInfo, V8InjectedScriptHost::toInternalPointer(host), &callbackDat a->host); | 84 V8DOMWrapper::setNativeInfoWithPersistentHandle(wrapper, &V8InjectedScriptHo st::wrapperTypeInfo, V8InjectedScriptHost::toInternalPointer(host), callbackData ->hostPtr); |
81 #else | 85 #else |
82 V8DOMWrapper::setNativeInfo(wrapper, &V8InjectedScriptHost::wrapperTypeInfo, V8InjectedScriptHost::toInternalPointer(host.get())); | 86 V8DOMWrapper::setNativeInfo(wrapper, &V8InjectedScriptHost::wrapperTypeInfo, V8InjectedScriptHost::toInternalPointer(host.get())); |
83 #endif | 87 #endif |
84 ASSERT(V8DOMWrapper::isDOMWrapper(wrapper)); | 88 ASSERT(V8DOMWrapper::isDOMWrapper(wrapper)); |
85 return wrapper; | 89 return wrapper; |
86 } | 90 } |
87 | 91 |
88 ScriptValue InjectedScriptManager::createInjectedScript(const String& scriptSour ce, ScriptState* inspectedScriptState, int id) | 92 ScriptValue InjectedScriptManager::createInjectedScript(const String& scriptSour ce, ScriptState* inspectedScriptState, int id) |
89 { | 93 { |
90 v8::Isolate* isolate = inspectedScriptState->isolate(); | 94 v8::Isolate* isolate = inspectedScriptState->isolate(); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
127 return BindingSecurity::shouldAllowAccessToFrame(scriptState->isolate(), fra me, DoNotReportSecurityError); | 131 return BindingSecurity::shouldAllowAccessToFrame(scriptState->isolate(), fra me, DoNotReportSecurityError); |
128 } | 132 } |
129 | 133 |
130 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) |
131 { | 135 { |
132 InjectedScriptManager::CallbackData* callbackData = data.GetParameter(); | 136 InjectedScriptManager::CallbackData* callbackData = data.GetParameter(); |
133 callbackData->injectedScriptManager->removeCallbackData(callbackData); | 137 callbackData->injectedScriptManager->removeCallbackData(callbackData); |
134 } | 138 } |
135 | 139 |
136 } // namespace blink | 140 } // namespace blink |
OLD | NEW |