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

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

Issue 365653002: Oilpan: move 2D Canvas and WebGL objects to the heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Have Nullable<T>::trace() use TraceIfNeeded<>. Created 6 years, 5 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
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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 47
48 namespace WebCore { 48 namespace WebCore {
49 49
50 void V8HTMLCanvasElement::getContextMethodCustom(const v8::FunctionCallbackInfo< v8::Value>& info) 50 void V8HTMLCanvasElement::getContextMethodCustom(const v8::FunctionCallbackInfo< v8::Value>& info)
51 { 51 {
52 v8::Handle<v8::Object> holder = info.Holder(); 52 v8::Handle<v8::Object> holder = info.Holder();
53 v8::Isolate* isolate = info.GetIsolate(); 53 v8::Isolate* isolate = info.GetIsolate();
54 HTMLCanvasElement* impl = V8HTMLCanvasElement::toNative(holder); 54 HTMLCanvasElement* impl = V8HTMLCanvasElement::toNative(holder);
55 TOSTRING_VOID(V8StringResource<>, contextIdResource, info[0]); 55 TOSTRING_VOID(V8StringResource<>, contextIdResource, info[0]);
56 String contextId = contextIdResource; 56 String contextId = contextIdResource;
57 RefPtr<CanvasContextAttributes> attributes; 57 RefPtrWillBeRawPtr<CanvasContextAttributes> attributes = nullptr;
58 if (contextId == "webgl" || contextId == "experimental-webgl") { 58 if (contextId == "webgl" || contextId == "experimental-webgl") {
59 RefPtr<WebGLContextAttributes> webGLAttributes = WebGLContextAttributes: :create(); 59 RefPtrWillBeRawPtr<WebGLContextAttributes> webGLAttributes = WebGLContex tAttributes::create();
60 if (info.Length() > 1 && info[1]->IsObject()) { 60 if (info.Length() > 1 && info[1]->IsObject()) {
61 v8::Handle<v8::Object> jsAttributes = info[1]->ToObject(); 61 v8::Handle<v8::Object> jsAttributes = info[1]->ToObject();
62 v8::Handle<v8::String> alpha = v8AtomicString(isolate, "alpha"); 62 v8::Handle<v8::String> alpha = v8AtomicString(isolate, "alpha");
63 if (jsAttributes->Has(alpha) && !isUndefinedOrNull(jsAttributes->Get (alpha))) 63 if (jsAttributes->Has(alpha) && !isUndefinedOrNull(jsAttributes->Get (alpha)))
64 webGLAttributes->setAlpha(jsAttributes->Get(alpha)->BooleanValue ()); 64 webGLAttributes->setAlpha(jsAttributes->Get(alpha)->BooleanValue ());
65 v8::Handle<v8::String> depth = v8AtomicString(isolate, "depth"); 65 v8::Handle<v8::String> depth = v8AtomicString(isolate, "depth");
66 if (jsAttributes->Has(depth) && !isUndefinedOrNull(jsAttributes->Get (depth))) 66 if (jsAttributes->Has(depth) && !isUndefinedOrNull(jsAttributes->Get (depth)))
67 webGLAttributes->setDepth(jsAttributes->Get(depth)->BooleanValue ()); 67 webGLAttributes->setDepth(jsAttributes->Get(depth)->BooleanValue ());
68 v8::Handle<v8::String> stencil = v8AtomicString(isolate, "stencil"); 68 v8::Handle<v8::String> stencil = v8AtomicString(isolate, "stencil");
69 if (jsAttributes->Has(stencil) && !isUndefinedOrNull(jsAttributes->G et(stencil))) 69 if (jsAttributes->Has(stencil) && !isUndefinedOrNull(jsAttributes->G et(stencil)))
70 webGLAttributes->setStencil(jsAttributes->Get(stencil)->BooleanV alue()); 70 webGLAttributes->setStencil(jsAttributes->Get(stencil)->BooleanV alue());
71 v8::Handle<v8::String> antialias = v8AtomicString(isolate, "antialia s"); 71 v8::Handle<v8::String> antialias = v8AtomicString(isolate, "antialia s");
72 if (jsAttributes->Has(antialias) && !isUndefinedOrNull(jsAttributes- >Get(antialias))) 72 if (jsAttributes->Has(antialias) && !isUndefinedOrNull(jsAttributes- >Get(antialias)))
73 webGLAttributes->setAntialias(jsAttributes->Get(antialias)->Bool eanValue()); 73 webGLAttributes->setAntialias(jsAttributes->Get(antialias)->Bool eanValue());
74 v8::Handle<v8::String> premultipliedAlpha = v8AtomicString(isolate, "premultipliedAlpha"); 74 v8::Handle<v8::String> premultipliedAlpha = v8AtomicString(isolate, "premultipliedAlpha");
75 if (jsAttributes->Has(premultipliedAlpha) && !isUndefinedOrNull(jsAt tributes->Get(premultipliedAlpha))) 75 if (jsAttributes->Has(premultipliedAlpha) && !isUndefinedOrNull(jsAt tributes->Get(premultipliedAlpha)))
76 webGLAttributes->setPremultipliedAlpha(jsAttributes->Get(premult ipliedAlpha)->BooleanValue()); 76 webGLAttributes->setPremultipliedAlpha(jsAttributes->Get(premult ipliedAlpha)->BooleanValue());
77 v8::Handle<v8::String> preserveDrawingBuffer = v8AtomicString(isolat e, "preserveDrawingBuffer"); 77 v8::Handle<v8::String> preserveDrawingBuffer = v8AtomicString(isolat e, "preserveDrawingBuffer");
78 if (jsAttributes->Has(preserveDrawingBuffer) && !isUndefinedOrNull(j sAttributes->Get(preserveDrawingBuffer))) 78 if (jsAttributes->Has(preserveDrawingBuffer) && !isUndefinedOrNull(j sAttributes->Get(preserveDrawingBuffer)))
79 webGLAttributes->setPreserveDrawingBuffer(jsAttributes->Get(pres erveDrawingBuffer)->BooleanValue()); 79 webGLAttributes->setPreserveDrawingBuffer(jsAttributes->Get(pres erveDrawingBuffer)->BooleanValue());
80 v8::Handle<v8::String> failIfMajorPerformanceCaveat = v8AtomicString (isolate, "failIfMajorPerformanceCaveat"); 80 v8::Handle<v8::String> failIfMajorPerformanceCaveat = v8AtomicString (isolate, "failIfMajorPerformanceCaveat");
81 if (jsAttributes->Has(failIfMajorPerformanceCaveat) && !isUndefinedO rNull(jsAttributes->Get(failIfMajorPerformanceCaveat))) 81 if (jsAttributes->Has(failIfMajorPerformanceCaveat) && !isUndefinedO rNull(jsAttributes->Get(failIfMajorPerformanceCaveat)))
82 webGLAttributes->setFailIfMajorPerformanceCaveat(jsAttributes->G et(failIfMajorPerformanceCaveat)->BooleanValue()); 82 webGLAttributes->setFailIfMajorPerformanceCaveat(jsAttributes->G et(failIfMajorPerformanceCaveat)->BooleanValue());
83 } 83 }
84 attributes = webGLAttributes; 84 attributes = webGLAttributes;
85 } else { 85 } else {
86 RefPtr<Canvas2DContextAttributes> canvas2DAttributes = Canvas2DContextAt tributes::create(); 86 RefPtrWillBeRawPtr<Canvas2DContextAttributes> canvas2DAttributes = Canva s2DContextAttributes::create();
87 if (info.Length() > 1 && info[1]->IsObject()) { 87 if (info.Length() > 1 && info[1]->IsObject()) {
88 v8::Handle<v8::Object> jsAttributes = info[1]->ToObject(); 88 v8::Handle<v8::Object> jsAttributes = info[1]->ToObject();
89 v8::Handle<v8::String> alpha = v8AtomicString(isolate, "alpha"); 89 v8::Handle<v8::String> alpha = v8AtomicString(isolate, "alpha");
90 if (jsAttributes->Has(alpha) && !isUndefinedOrNull(jsAttributes->Get (alpha))) 90 if (jsAttributes->Has(alpha) && !isUndefinedOrNull(jsAttributes->Get (alpha)))
91 canvas2DAttributes->setAlpha(jsAttributes->Get(alpha)->BooleanVa lue()); 91 canvas2DAttributes->setAlpha(jsAttributes->Get(alpha)->BooleanVa lue());
92 } 92 }
93 attributes = canvas2DAttributes; 93 attributes = canvas2DAttributes;
94 } 94 }
95 CanvasRenderingContext* result = impl->getContext(contextId, attributes.get( )); 95 CanvasRenderingContext* result = impl->getContext(contextId, attributes.get( ));
96 if (!result) { 96 if (!result) {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 quality = info[1]->NumberValue(); 142 quality = info[1]->NumberValue();
143 qualityPtr = &quality; 143 qualityPtr = &quality;
144 } 144 }
145 145
146 String result = canvas->toDataURL(type, qualityPtr, exceptionState); 146 String result = canvas->toDataURL(type, qualityPtr, exceptionState);
147 exceptionState.throwIfNeeded(); 147 exceptionState.throwIfNeeded();
148 v8SetReturnValueStringOrUndefined(info, result, info.GetIsolate()); 148 v8SetReturnValueStringOrUndefined(info, result, info.GetIsolate());
149 } 149 }
150 150
151 } // namespace WebCore 151 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698