Chromium Code Reviews| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 42 #include "bindings/core/v8/V8Window.h" | 42 #include "bindings/core/v8/V8Window.h" |
| 43 #include "core/frame/LocalDOMWindow.h" | 43 #include "core/frame/LocalDOMWindow.h" |
| 44 #include "core/inspector/InjectedScriptHost.h" | 44 #include "core/inspector/InjectedScriptHost.h" |
| 45 #include "core/inspector/InjectedScriptNative.h" | 45 #include "core/inspector/InjectedScriptNative.h" |
| 46 #include "wtf/RefPtr.h" | 46 #include "wtf/RefPtr.h" |
| 47 | 47 |
| 48 namespace blink { | 48 namespace blink { |
| 49 | 49 |
| 50 InjectedScriptManager::CallbackData* InjectedScriptManager::createCallbackData(I njectedScriptManager* injectedScriptManager) | 50 InjectedScriptManager::CallbackData* InjectedScriptManager::createCallbackData(I njectedScriptManager* injectedScriptManager) |
| 51 { | 51 { |
| 52 OwnPtr<InjectedScriptManager::CallbackData> callbackData = adoptPtr(new Inje ctedScriptManager::CallbackData()); | 52 OwnPtrWillBeRawPtr<InjectedScriptManager::CallbackData> callbackData = Injec tedScriptManager::CallbackData::create(injectedScriptManager); |
| 53 InjectedScriptManager::CallbackData* callbackDataPtr = callbackData.get(); | 53 InjectedScriptManager::CallbackData* callbackDataPtr = callbackData.get(); |
| 54 callbackData->injectedScriptManager = injectedScriptManager; | |
| 55 m_callbackDataSet.add(callbackData.release()); | 54 m_callbackDataSet.add(callbackData.release()); |
| 56 return callbackDataPtr; | 55 return callbackDataPtr; |
| 57 } | 56 } |
| 58 | 57 |
| 59 void InjectedScriptManager::removeCallbackData(InjectedScriptManager::CallbackDa ta* callbackData) | 58 void InjectedScriptManager::removeCallbackData(InjectedScriptManager::CallbackDa ta* callbackData) |
| 60 { | 59 { |
| 61 ASSERT(m_callbackDataSet.contains(callbackData)); | 60 ASSERT(m_callbackDataSet.contains(callbackData)); |
| 61 callbackData->handle.clear(); | |
|
haraken
2015/03/27 13:35:48
Do we need this? (Can we rely on the GC to destruc
sof
2015/03/27 13:54:56
Having it linger until a GC caused v8 asserts on t
| |
| 62 m_callbackDataSet.remove(callbackData); | 62 m_callbackDataSet.remove(callbackData); |
| 63 } | 63 } |
| 64 | 64 |
| 65 static v8::Local<v8::Object> createInjectedScriptHostV8Wrapper(PassRefPtrWillBeR awPtr<InjectedScriptHost> host, InjectedScriptManager* injectedScriptManager, v8 ::Local<v8::Object> creationContext, v8::Isolate* isolate) | 65 static v8::Local<v8::Object> createInjectedScriptHostV8Wrapper(PassRefPtrWillBeR awPtr<InjectedScriptHost> host, InjectedScriptManager* injectedScriptManager, v8 ::Local<v8::Object> creationContext, v8::Isolate* isolate) |
| 66 { | 66 { |
| 67 ASSERT(host); | 67 ASSERT(host); |
| 68 | 68 |
| 69 v8::Local<v8::Object> wrapper = V8DOMWrapper::createWrapper(isolate, creatio nContext, &V8InjectedScriptHost::wrapperTypeInfo, host.get()); | 69 v8::Local<v8::Object> wrapper = V8DOMWrapper::createWrapper(isolate, creatio nContext, &V8InjectedScriptHost::wrapperTypeInfo, host.get()); |
| 70 if (UNLIKELY(wrapper.IsEmpty())) | 70 if (UNLIKELY(wrapper.IsEmpty())) |
| 71 return wrapper; | 71 return wrapper; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 127 return BindingSecurity::shouldAllowAccessToFrame(scriptState->isolate(), fra me, DoNotReportSecurityError); | 127 return BindingSecurity::shouldAllowAccessToFrame(scriptState->isolate(), fra me, DoNotReportSecurityError); |
| 128 } | 128 } |
| 129 | 129 |
| 130 void InjectedScriptManager::setWeakCallback(const v8::WeakCallbackData<v8::Objec t, InjectedScriptManager::CallbackData>& data) | 130 void InjectedScriptManager::setWeakCallback(const v8::WeakCallbackData<v8::Objec t, InjectedScriptManager::CallbackData>& data) |
| 131 { | 131 { |
| 132 InjectedScriptManager::CallbackData* callbackData = data.GetParameter(); | 132 InjectedScriptManager::CallbackData* callbackData = data.GetParameter(); |
| 133 callbackData->injectedScriptManager->removeCallbackData(callbackData); | 133 callbackData->injectedScriptManager->removeCallbackData(callbackData); |
| 134 } | 134 } |
| 135 | 135 |
| 136 } // namespace blink | 136 } // namespace blink |
| OLD | NEW |