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

Side by Side Diff: Source/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp

Issue 23819007: Have Node::document() return a reference instead of a pointer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 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) 2007-2009 Google Inc. All rights reserved. 2 * Copyright (C) 2007-2009 Google Inc. All rights reserved.
3 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. 3 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 } 87 }
88 attributes = canvas2DAttributes; 88 attributes = canvas2DAttributes;
89 } 89 }
90 CanvasRenderingContext* result = imp->getContext(contextId, attributes.get() ); 90 CanvasRenderingContext* result = imp->getContext(contextId, attributes.get() );
91 if (!result) { 91 if (!result) {
92 v8SetReturnValueNull(args); 92 v8SetReturnValueNull(args);
93 return; 93 return;
94 } 94 }
95 if (result->is2d()) { 95 if (result->is2d()) {
96 v8::Handle<v8::Value> v8Result = toV8(static_cast<CanvasRenderingContext 2D*>(result), args.Holder(), args.GetIsolate()); 96 v8::Handle<v8::Value> v8Result = toV8(static_cast<CanvasRenderingContext 2D*>(result), args.Holder(), args.GetIsolate());
97 if (InspectorInstrumentation::canvasAgentEnabled(imp->document())) { 97 if (InspectorInstrumentation::canvasAgentEnabled(&imp->document())) {
98 ScriptState* scriptState = ScriptState::forContext(v8::Context::GetC urrent()); 98 ScriptState* scriptState = ScriptState::forContext(v8::Context::GetC urrent());
99 ScriptObject context(scriptState, v8::Handle<v8::Object>::Cast(v8Res ult)); 99 ScriptObject context(scriptState, v8::Handle<v8::Object>::Cast(v8Res ult));
100 ScriptObject wrapped = InspectorInstrumentation::wrapCanvas2DRenderi ngContextForInstrumentation(imp->document(), context); 100 ScriptObject wrapped = InspectorInstrumentation::wrapCanvas2DRenderi ngContextForInstrumentation(&imp->document(), context);
101 if (!wrapped.hasNoValue()) { 101 if (!wrapped.hasNoValue()) {
102 v8SetReturnValue(args, wrapped.v8Value()); 102 v8SetReturnValue(args, wrapped.v8Value());
103 return; 103 return;
104 } 104 }
105 } 105 }
106 v8SetReturnValue(args, v8Result); 106 v8SetReturnValue(args, v8Result);
107 return; 107 return;
108 } 108 }
109 if (result->is3d()) { 109 if (result->is3d()) {
110 v8::Handle<v8::Value> v8Result = toV8(static_cast<WebGLRenderingContext* >(result), args.Holder(), args.GetIsolate()); 110 v8::Handle<v8::Value> v8Result = toV8(static_cast<WebGLRenderingContext* >(result), args.Holder(), args.GetIsolate());
111 if (InspectorInstrumentation::canvasAgentEnabled(imp->document())) { 111 if (InspectorInstrumentation::canvasAgentEnabled(&imp->document())) {
112 ScriptState* scriptState = ScriptState::forContext(v8::Context::GetC urrent()); 112 ScriptState* scriptState = ScriptState::forContext(v8::Context::GetC urrent());
113 ScriptObject glContext(scriptState, v8::Handle<v8::Object>::Cast(v8R esult)); 113 ScriptObject glContext(scriptState, v8::Handle<v8::Object>::Cast(v8R esult));
114 ScriptObject wrapped = InspectorInstrumentation::wrapWebGLRenderingC ontextForInstrumentation(imp->document(), glContext); 114 ScriptObject wrapped = InspectorInstrumentation::wrapWebGLRenderingC ontextForInstrumentation(&imp->document(), glContext);
115 if (!wrapped.hasNoValue()) { 115 if (!wrapped.hasNoValue()) {
116 v8SetReturnValue(args, wrapped.v8Value()); 116 v8SetReturnValue(args, wrapped.v8Value());
117 return; 117 return;
118 } 118 }
119 } 119 }
120 v8SetReturnValue(args, v8Result); 120 v8SetReturnValue(args, v8Result);
121 return; 121 return;
122 } 122 }
123 ASSERT_NOT_REACHED(); 123 ASSERT_NOT_REACHED();
124 v8SetReturnValueNull(args); 124 v8SetReturnValueNull(args);
(...skipping 12 matching lines...) Expand all
137 quality = args[1]->NumberValue(); 137 quality = args[1]->NumberValue();
138 qualityPtr = &quality; 138 qualityPtr = &quality;
139 } 139 }
140 140
141 String result = canvas->toDataURL(type, qualityPtr, es); 141 String result = canvas->toDataURL(type, qualityPtr, es);
142 es.throwIfNeeded(); 142 es.throwIfNeeded();
143 v8SetReturnValueStringOrUndefined(args, result, args.GetIsolate()); 143 v8SetReturnValueStringOrUndefined(args, result, args.GetIsolate());
144 } 144 }
145 145
146 } // namespace WebCore 146 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/V8GCController.cpp ('k') | Source/bindings/v8/custom/V8InjectedScriptHostCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698