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

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

Issue 1146993005: DevTools: remove unused constant declarations and redundant parameter (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 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
« no previous file with comments | « no previous file | Source/core/inspector/InjectedScriptManager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 29 matching lines...) Expand all
40 #include "bindings/core/v8/V8ObjectConstructor.h" 40 #include "bindings/core/v8/V8ObjectConstructor.h"
41 #include "bindings/core/v8/V8ScriptRunner.h" 41 #include "bindings/core/v8/V8ScriptRunner.h"
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()
51 { 51 {
52 OwnPtrWillBeRawPtr<InjectedScriptManager::CallbackData> callbackData = Injec tedScriptManager::CallbackData::create(injectedScriptManager); 52 OwnPtrWillBeRawPtr<InjectedScriptManager::CallbackData> callbackData = Injec tedScriptManager::CallbackData::create(this);
53 InjectedScriptManager::CallbackData* callbackDataPtr = callbackData.get(); 53 InjectedScriptManager::CallbackData* callbackDataPtr = callbackData.get();
54 m_callbackDataSet.add(callbackData.release()); 54 m_callbackDataSet.add(callbackData.release());
55 return callbackDataPtr; 55 return callbackDataPtr;
56 } 56 }
57 57
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 callbackData->dispose(); 61 callbackData->dispose();
62 m_callbackDataSet.remove(callbackData); 62 m_callbackDataSet.remove(callbackData);
63 } 63 }
64 64
65 static v8::Local<v8::Object> createInjectedScriptHostV8Wrapper(v8::Isolate* isol ate, PassRefPtrWillBeRawPtr<InjectedScriptHost> host, InjectedScriptManager* inj ectedScriptManager, v8::Local<v8::Object> creationContext) 65 static v8::Local<v8::Object> createInjectedScriptHostV8Wrapper(v8::Isolate* isol ate, PassRefPtrWillBeRawPtr<InjectedScriptHost> host, InjectedScriptManager* inj ectedScriptManager, v8::Local<v8::Object> creationContext)
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;
72 72
73 // Create a weak reference to the v8 wrapper of InspectorBackend to deref 73 // Create a weak reference to the v8 wrapper of InspectorBackend to deref
74 // InspectorBackend when the wrapper is garbage collected. 74 // InspectorBackend when the wrapper is garbage collected.
75 InjectedScriptManager::CallbackData* callbackData = injectedScriptManager->c reateCallbackData(injectedScriptManager); 75 InjectedScriptManager::CallbackData* callbackData = injectedScriptManager->c reateCallbackData();
76 callbackData->host = host.get(); 76 callbackData->host = host.get();
77 callbackData->handle.set(isolate, wrapper); 77 callbackData->handle.set(isolate, wrapper);
78 callbackData->handle.setWeak(callbackData, &InjectedScriptManager::setWeakCa llback); 78 callbackData->handle.setWeak(callbackData, &InjectedScriptManager::setWeakCa llback);
79 79
80 V8DOMWrapper::setNativeInfo(wrapper, &V8InjectedScriptHost::wrapperTypeInfo, host.get()); 80 V8DOMWrapper::setNativeInfo(wrapper, &V8InjectedScriptHost::wrapperTypeInfo, host.get());
81 ASSERT(V8DOMWrapper::hasInternalFieldsSet(wrapper)); 81 ASSERT(V8DOMWrapper::hasInternalFieldsSet(wrapper));
82 return wrapper; 82 return wrapper;
83 } 83 }
84 84
85 ScriptValue InjectedScriptManager::createInjectedScript(const String& scriptSour ce, ScriptState* inspectedScriptState, int id, InjectedScriptNative* injectedScr iptNative) 85 ScriptValue InjectedScriptManager::createInjectedScript(const String& scriptSour ce, ScriptState* inspectedScriptState, int id, InjectedScriptNative* injectedScr iptNative)
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 return BindingSecurity::shouldAllowAccessToFrame(scriptState->isolate(), fra me, DoNotReportSecurityError); 129 return BindingSecurity::shouldAllowAccessToFrame(scriptState->isolate(), fra me, DoNotReportSecurityError);
130 } 130 }
131 131
132 void InjectedScriptManager::setWeakCallback(const v8::WeakCallbackInfo<InjectedS criptManager::CallbackData>& data) 132 void InjectedScriptManager::setWeakCallback(const v8::WeakCallbackInfo<InjectedS criptManager::CallbackData>& data)
133 { 133 {
134 InjectedScriptManager::CallbackData* callbackData = data.GetParameter(); 134 InjectedScriptManager::CallbackData* callbackData = data.GetParameter();
135 callbackData->injectedScriptManager->removeCallbackData(callbackData); 135 callbackData->injectedScriptManager->removeCallbackData(callbackData);
136 } 136 }
137 137
138 } // namespace blink 138 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | Source/core/inspector/InjectedScriptManager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698