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

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

Issue 202203009: Rename |imp| => |impl| in bindings generation (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: custom/v8 too Created 6 years, 9 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 #include "core/inspector/InspectorCanvasInstrumentation.h" 45 #include "core/inspector/InspectorCanvasInstrumentation.h"
46 #include "wtf/MathExtras.h" 46 #include "wtf/MathExtras.h"
47 #include "wtf/text/WTFString.h" 47 #include "wtf/text/WTFString.h"
48 48
49 namespace WebCore { 49 namespace WebCore {
50 50
51 void V8HTMLCanvasElement::getContextMethodCustom(const v8::FunctionCallbackInfo< v8::Value>& info) 51 void V8HTMLCanvasElement::getContextMethodCustom(const v8::FunctionCallbackInfo< v8::Value>& info)
52 { 52 {
53 v8::Handle<v8::Object> holder = info.Holder(); 53 v8::Handle<v8::Object> holder = info.Holder();
54 v8::Isolate* isolate = info.GetIsolate(); 54 v8::Isolate* isolate = info.GetIsolate();
55 HTMLCanvasElement* imp = V8HTMLCanvasElement::toNative(holder); 55 HTMLCanvasElement* impl = V8HTMLCanvasElement::toNative(holder);
56 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, contextIdResource, info[0]); 56 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, contextIdResource, info[0]);
57 String contextId = contextIdResource; 57 String contextId = contextIdResource;
58 RefPtr<CanvasContextAttributes> attributes; 58 RefPtr<CanvasContextAttributes> attributes;
59 if (contextId == "webgl" || contextId == "experimental-webgl" || contextId = = "webkit-3d") { 59 if (contextId == "webgl" || contextId == "experimental-webgl" || contextId = = "webkit-3d") {
60 RefPtr<WebGLContextAttributes> webGLAttributes = WebGLContextAttributes: :create(); 60 RefPtr<WebGLContextAttributes> webGLAttributes = WebGLContextAttributes: :create();
61 if (info.Length() > 1 && info[1]->IsObject()) { 61 if (info.Length() > 1 && info[1]->IsObject()) {
62 v8::Handle<v8::Object> jsAttributes = info[1]->ToObject(); 62 v8::Handle<v8::Object> jsAttributes = info[1]->ToObject();
63 v8::Handle<v8::String> alpha = v8AtomicString(isolate, "alpha"); 63 v8::Handle<v8::String> alpha = v8AtomicString(isolate, "alpha");
64 if (jsAttributes->Has(alpha)) 64 if (jsAttributes->Has(alpha))
65 webGLAttributes->setAlpha(jsAttributes->Get(alpha)->BooleanValue ()); 65 webGLAttributes->setAlpha(jsAttributes->Get(alpha)->BooleanValue ());
(...skipping 20 matching lines...) Expand all
86 } else { 86 } else {
87 RefPtr<Canvas2DContextAttributes> canvas2DAttributes = Canvas2DContextAt tributes::create(); 87 RefPtr<Canvas2DContextAttributes> canvas2DAttributes = Canvas2DContextAt tributes::create();
88 if (info.Length() > 1 && info[1]->IsObject()) { 88 if (info.Length() > 1 && info[1]->IsObject()) {
89 v8::Handle<v8::Object> jsAttributes = info[1]->ToObject(); 89 v8::Handle<v8::Object> jsAttributes = info[1]->ToObject();
90 v8::Handle<v8::String> alpha = v8AtomicString(isolate, "alpha"); 90 v8::Handle<v8::String> alpha = v8AtomicString(isolate, "alpha");
91 if (jsAttributes->Has(alpha)) 91 if (jsAttributes->Has(alpha))
92 canvas2DAttributes->setAlpha(jsAttributes->Get(alpha)->BooleanVa lue()); 92 canvas2DAttributes->setAlpha(jsAttributes->Get(alpha)->BooleanVa lue());
93 } 93 }
94 attributes = canvas2DAttributes; 94 attributes = canvas2DAttributes;
95 } 95 }
96 CanvasRenderingContext* result = imp->getContext(contextId, attributes.get() ); 96 CanvasRenderingContext* result = impl->getContext(contextId, attributes.get( ));
97 if (!result) { 97 if (!result) {
98 v8SetReturnValueNull(info); 98 v8SetReturnValueNull(info);
99 return; 99 return;
100 } 100 }
101 if (result->is2d()) { 101 if (result->is2d()) {
102 v8::Handle<v8::Value> v8Result = toV8(toCanvasRenderingContext2D(result) , info.Holder(), info.GetIsolate()); 102 v8::Handle<v8::Value> v8Result = toV8(toCanvasRenderingContext2D(result) , info.Holder(), info.GetIsolate());
103 if (InspectorInstrumentation::canvasAgentEnabled(&imp->document())) { 103 if (InspectorInstrumentation::canvasAgentEnabled(&impl->document())) {
104 ScriptState* scriptState = ScriptState::forContext(isolate->GetCurre ntContext()); 104 ScriptState* scriptState = ScriptState::forContext(isolate->GetCurre ntContext());
105 ScriptObject context(scriptState, v8::Handle<v8::Object>::Cast(v8Res ult)); 105 ScriptObject context(scriptState, v8::Handle<v8::Object>::Cast(v8Res ult));
106 ScriptObject wrapped = InspectorInstrumentation::wrapCanvas2DRenderi ngContextForInstrumentation(&imp->document(), context); 106 ScriptObject wrapped = InspectorInstrumentation::wrapCanvas2DRenderi ngContextForInstrumentation(&impl->document(), context);
107 if (!wrapped.hasNoValue()) { 107 if (!wrapped.hasNoValue()) {
108 v8SetReturnValue(info, wrapped.v8Value()); 108 v8SetReturnValue(info, wrapped.v8Value());
109 return; 109 return;
110 } 110 }
111 } 111 }
112 v8SetReturnValue(info, v8Result); 112 v8SetReturnValue(info, v8Result);
113 return; 113 return;
114 } 114 }
115 if (result->is3d()) { 115 if (result->is3d()) {
116 v8::Handle<v8::Value> v8Result = toV8(toWebGLRenderingContext(result), i nfo.Holder(), info.GetIsolate()); 116 v8::Handle<v8::Value> v8Result = toV8(toWebGLRenderingContext(result), i nfo.Holder(), info.GetIsolate());
117 if (InspectorInstrumentation::canvasAgentEnabled(&imp->document())) { 117 if (InspectorInstrumentation::canvasAgentEnabled(&impl->document())) {
118 ScriptState* scriptState = ScriptState::forContext(isolate->GetCurre ntContext()); 118 ScriptState* scriptState = ScriptState::forContext(isolate->GetCurre ntContext());
119 ScriptObject glContext(scriptState, v8::Handle<v8::Object>::Cast(v8R esult)); 119 ScriptObject glContext(scriptState, v8::Handle<v8::Object>::Cast(v8R esult));
120 ScriptObject wrapped = InspectorInstrumentation::wrapWebGLRenderingC ontextForInstrumentation(&imp->document(), glContext); 120 ScriptObject wrapped = InspectorInstrumentation::wrapWebGLRenderingC ontextForInstrumentation(&impl->document(), glContext);
121 if (!wrapped.hasNoValue()) { 121 if (!wrapped.hasNoValue()) {
122 v8SetReturnValue(info, wrapped.v8Value()); 122 v8SetReturnValue(info, wrapped.v8Value());
123 return; 123 return;
124 } 124 }
125 } 125 }
126 v8SetReturnValue(info, v8Result); 126 v8SetReturnValue(info, v8Result);
127 return; 127 return;
128 } 128 }
129 ASSERT_NOT_REACHED(); 129 ASSERT_NOT_REACHED();
130 v8SetReturnValueNull(info); 130 v8SetReturnValueNull(info);
(...skipping 12 matching lines...) Expand all
143 quality = info[1]->NumberValue(); 143 quality = info[1]->NumberValue();
144 qualityPtr = &quality; 144 qualityPtr = &quality;
145 } 145 }
146 146
147 String result = canvas->toDataURL(type, qualityPtr, exceptionState); 147 String result = canvas->toDataURL(type, qualityPtr, exceptionState);
148 exceptionState.throwIfNeeded(); 148 exceptionState.throwIfNeeded();
149 v8SetReturnValueStringOrUndefined(info, result, info.GetIsolate()); 149 v8SetReturnValueStringOrUndefined(info, result, info.GetIsolate());
150 } 150 }
151 151
152 } // namespace WebCore 152 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/custom/V8HTMLAllCollectionCustom.cpp ('k') | Source/bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698