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

Side by Side Diff: Source/core/inspector/InspectorCanvasAgent.cpp

Issue 293963003: Remove ScriptObject (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 | 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 13 matching lines...) Expand all
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "config.h" 31 #include "config.h"
32 #include "core/inspector/InspectorCanvasAgent.h" 32 #include "core/inspector/InspectorCanvasAgent.h"
33 33
34 #include "bindings/v8/ScriptObject.h"
35 #include "bindings/v8/ScriptProfiler.h" 34 #include "bindings/v8/ScriptProfiler.h"
35 #include "bindings/v8/ScriptValue.h"
36 #include "core/html/HTMLCanvasElement.h" 36 #include "core/html/HTMLCanvasElement.h"
37 #include "core/inspector/BindingVisitors.h" 37 #include "core/inspector/BindingVisitors.h"
38 #include "core/inspector/InjectedScript.h" 38 #include "core/inspector/InjectedScript.h"
39 #include "core/inspector/InjectedScriptCanvasModule.h" 39 #include "core/inspector/InjectedScriptCanvasModule.h"
40 #include "core/inspector/InjectedScriptManager.h" 40 #include "core/inspector/InjectedScriptManager.h"
41 #include "core/inspector/InspectorPageAgent.h" 41 #include "core/inspector/InspectorPageAgent.h"
42 #include "core/inspector/InspectorState.h" 42 #include "core/inspector/InspectorState.h"
43 #include "core/inspector/InstrumentingAgents.h" 43 #include "core/inspector/InstrumentingAgents.h"
44 #include "core/loader/DocumentLoader.h" 44 #include "core/loader/DocumentLoader.h"
45 #include "core/frame/DOMWindow.h" 45 #include "core/frame/DOMWindow.h"
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 module.resourceState(errorString, traceLogId, resourceId, &result); 180 module.resourceState(errorString, traceLogId, resourceId, &result);
181 } 181 }
182 182
183 void InspectorCanvasAgent::evaluateTraceLogCallArgument(ErrorString* errorString , const TraceLogId& traceLogId, int callIndex, int argumentIndex, const String* objectGroup, RefPtr<RemoteObject>& result, RefPtr<ResourceState>& resourceState) 183 void InspectorCanvasAgent::evaluateTraceLogCallArgument(ErrorString* errorString , const TraceLogId& traceLogId, int callIndex, int argumentIndex, const String* objectGroup, RefPtr<RemoteObject>& result, RefPtr<ResourceState>& resourceState)
184 { 184 {
185 InjectedScriptCanvasModule module = injectedScriptCanvasModule(errorString, traceLogId); 185 InjectedScriptCanvasModule module = injectedScriptCanvasModule(errorString, traceLogId);
186 if (!module.isEmpty()) 186 if (!module.isEmpty())
187 module.evaluateTraceLogCallArgument(errorString, traceLogId, callIndex, argumentIndex, objectGroup ? *objectGroup : String(), &result, &resourceState); 187 module.evaluateTraceLogCallArgument(errorString, traceLogId, callIndex, argumentIndex, objectGroup ? *objectGroup : String(), &result, &resourceState);
188 } 188 }
189 189
190 ScriptObject InspectorCanvasAgent::wrapCanvas2DRenderingContextForInstrumentatio n(const ScriptObject& context) 190 ScriptValue InspectorCanvasAgent::wrapCanvas2DRenderingContextForInstrumentation (const ScriptValue& context)
191 { 191 {
192 ErrorString error; 192 ErrorString error;
193 InjectedScriptCanvasModule module = injectedScriptCanvasModule(&error, conte xt); 193 InjectedScriptCanvasModule module = injectedScriptCanvasModule(&error, conte xt);
194 if (module.isEmpty()) 194 if (module.isEmpty())
195 return ScriptObject(); 195 return ScriptValue();
196 return notifyRenderingContextWasWrapped(module.wrapCanvas2DContext(context)) ; 196 return notifyRenderingContextWasWrapped(module.wrapCanvas2DContext(context)) ;
197 } 197 }
198 198
199 ScriptObject InspectorCanvasAgent::wrapWebGLRenderingContextForInstrumentation(c onst ScriptObject& glContext) 199 ScriptValue InspectorCanvasAgent::wrapWebGLRenderingContextForInstrumentation(co nst ScriptValue& glContext)
200 { 200 {
201 ErrorString error; 201 ErrorString error;
202 InjectedScriptCanvasModule module = injectedScriptCanvasModule(&error, glCon text); 202 InjectedScriptCanvasModule module = injectedScriptCanvasModule(&error, glCon text);
203 if (module.isEmpty()) 203 if (module.isEmpty())
204 return ScriptObject(); 204 return ScriptValue();
205 return notifyRenderingContextWasWrapped(module.wrapWebGLContext(glContext)); 205 return notifyRenderingContextWasWrapped(module.wrapWebGLContext(glContext));
206 } 206 }
207 207
208 ScriptObject InspectorCanvasAgent::notifyRenderingContextWasWrapped(const Script Object& wrappedContext) 208 ScriptValue InspectorCanvasAgent::notifyRenderingContextWasWrapped(const ScriptV alue& wrappedContext)
209 { 209 {
210 ASSERT(m_frontend); 210 ASSERT(m_frontend);
211 ScriptState* scriptState = wrappedContext.scriptState(); 211 ScriptState* scriptState = wrappedContext.scriptState();
212 DOMWindow* domWindow = 0; 212 DOMWindow* domWindow = 0;
213 if (scriptState) 213 if (scriptState)
214 domWindow = scriptState->domWindow(); 214 domWindow = scriptState->domWindow();
215 LocalFrame* frame = domWindow ? domWindow->frame() : 0; 215 LocalFrame* frame = domWindow ? domWindow->frame() : 0;
216 if (frame && !m_framesWithUninstrumentedCanvases.contains(frame)) 216 if (frame && !m_framesWithUninstrumentedCanvases.contains(frame))
217 m_framesWithUninstrumentedCanvases.set(frame, false); 217 m_framesWithUninstrumentedCanvases.set(frame, false);
218 String frameId = m_pageAgent->frameId(frame); 218 String frameId = m_pageAgent->frameId(frame);
219 if (!frameId.isEmpty()) 219 if (!frameId.isEmpty())
220 m_frontend->contextCreated(frameId); 220 m_frontend->contextCreated(frameId);
221 return wrappedContext; 221 return wrappedContext;
222 } 222 }
223 223
224 InjectedScriptCanvasModule InspectorCanvasAgent::injectedScriptCanvasModule(Erro rString* errorString, ScriptState* scriptState) 224 InjectedScriptCanvasModule InspectorCanvasAgent::injectedScriptCanvasModule(Erro rString* errorString, ScriptState* scriptState)
225 { 225 {
226 if (!checkIsEnabled(errorString)) 226 if (!checkIsEnabled(errorString))
227 return InjectedScriptCanvasModule(); 227 return InjectedScriptCanvasModule();
228 InjectedScriptCanvasModule module = InjectedScriptCanvasModule::moduleForSta te(m_injectedScriptManager, scriptState); 228 InjectedScriptCanvasModule module = InjectedScriptCanvasModule::moduleForSta te(m_injectedScriptManager, scriptState);
229 if (module.isEmpty()) { 229 if (module.isEmpty()) {
230 ASSERT_NOT_REACHED(); 230 ASSERT_NOT_REACHED();
231 *errorString = "Internal error: no Canvas module"; 231 *errorString = "Internal error: no Canvas module";
232 } 232 }
233 return module; 233 return module;
234 } 234 }
235 235
236 InjectedScriptCanvasModule InspectorCanvasAgent::injectedScriptCanvasModule(Erro rString* errorString, const ScriptObject& scriptObject) 236 InjectedScriptCanvasModule InspectorCanvasAgent::injectedScriptCanvasModule(Erro rString* errorString, const ScriptValue& scriptValue)
237 { 237 {
238 if (!checkIsEnabled(errorString)) 238 if (!checkIsEnabled(errorString))
239 return InjectedScriptCanvasModule(); 239 return InjectedScriptCanvasModule();
240 if (scriptObject.isEmpty()) { 240 if (scriptValue.isEmpty()) {
241 ASSERT_NOT_REACHED(); 241 ASSERT_NOT_REACHED();
242 *errorString = "Internal error: original ScriptObject has no value"; 242 *errorString = "Internal error: original ScriptValue has no value";
243 return InjectedScriptCanvasModule(); 243 return InjectedScriptCanvasModule();
244 } 244 }
245 return injectedScriptCanvasModule(errorString, scriptObject.scriptState()); 245 return injectedScriptCanvasModule(errorString, scriptValue.scriptState());
246 } 246 }
247 247
248 InjectedScriptCanvasModule InspectorCanvasAgent::injectedScriptCanvasModule(Erro rString* errorString, const String& objectId) 248 InjectedScriptCanvasModule InspectorCanvasAgent::injectedScriptCanvasModule(Erro rString* errorString, const String& objectId)
249 { 249 {
250 if (!checkIsEnabled(errorString)) 250 if (!checkIsEnabled(errorString))
251 return InjectedScriptCanvasModule(); 251 return InjectedScriptCanvasModule();
252 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForOb jectId(objectId); 252 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForOb jectId(objectId);
253 if (injectedScript.isEmpty()) { 253 if (injectedScript.isEmpty()) {
254 *errorString = "Inspected frame has gone"; 254 *errorString = "Inspected frame has gone";
255 return InjectedScriptCanvasModule(); 255 return InjectedScriptCanvasModule();
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 ErrorString error; 341 ErrorString error;
342 for (FramesWithUninstrumentedCanvases::const_iterator it = m_framesWithUnins trumentedCanvases.begin(); it != m_framesWithUninstrumentedCanvases.end(); ++it) { 342 for (FramesWithUninstrumentedCanvases::const_iterator it = m_framesWithUnins trumentedCanvases.begin(); it != m_framesWithUninstrumentedCanvases.end(); ++it) {
343 InjectedScriptCanvasModule module = injectedScriptCanvasModule(&error, S criptState::forMainWorld(it->key)); 343 InjectedScriptCanvasModule module = injectedScriptCanvasModule(&error, S criptState::forMainWorld(it->key));
344 if (!module.isEmpty()) 344 if (!module.isEmpty())
345 module.markFrameEnd(); 345 module.markFrameEnd();
346 } 346 }
347 } 347 }
348 348
349 } // namespace WebCore 349 } // namespace WebCore
350 350
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorCanvasAgent.h ('k') | Source/core/inspector/InspectorConsoleAgent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698