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

Side by Side Diff: third_party/WebKit/Source/modules/csspaint/CSSPaintDefinition.cpp

Issue 2050123002: Remove OwnPtr from Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments from Kent; merge. Created 4 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "modules/csspaint/CSSPaintDefinition.h" 5 #include "modules/csspaint/CSSPaintDefinition.h"
6 6
7 #include "bindings/core/v8/ScriptState.h" 7 #include "bindings/core/v8/ScriptState.h"
8 #include "bindings/core/v8/V8Binding.h" 8 #include "bindings/core/v8/V8Binding.h"
9 #include "bindings/core/v8/V8BindingMacros.h" 9 #include "bindings/core/v8/V8BindingMacros.h"
10 #include "bindings/core/v8/V8ObjectConstructor.h" 10 #include "bindings/core/v8/V8ObjectConstructor.h"
11 #include "core/dom/ExecutionContext.h" 11 #include "core/dom/ExecutionContext.h"
12 #include "modules/csspaint/Geometry.h" 12 #include "modules/csspaint/Geometry.h"
13 #include "modules/csspaint/PaintRenderingContext2D.h" 13 #include "modules/csspaint/PaintRenderingContext2D.h"
14 #include "platform/graphics/ImageBuffer.h" 14 #include "platform/graphics/ImageBuffer.h"
15 #include "platform/graphics/PaintGeneratedImage.h" 15 #include "platform/graphics/PaintGeneratedImage.h"
16 #include "platform/graphics/RecordingImageBufferSurface.h" 16 #include "platform/graphics/RecordingImageBufferSurface.h"
17 #include "wtf/PtrUtil.h"
17 18
18 namespace blink { 19 namespace blink {
19 20
20 CSSPaintDefinition* CSSPaintDefinition::create(ScriptState* scriptState, v8::Loc al<v8::Function> constructor, v8::Local<v8::Function> paint, Vector<CSSPropertyI D>& nativeInvalidationProperties, Vector<AtomicString>& customInvalidationProper ties) 21 CSSPaintDefinition* CSSPaintDefinition::create(ScriptState* scriptState, v8::Loc al<v8::Function> constructor, v8::Local<v8::Function> paint, Vector<CSSPropertyI D>& nativeInvalidationProperties, Vector<AtomicString>& customInvalidationProper ties)
21 { 22 {
22 return new CSSPaintDefinition(scriptState, constructor, paint, nativeInvalid ationProperties, customInvalidationProperties); 23 return new CSSPaintDefinition(scriptState, constructor, paint, nativeInvalid ationProperties, customInvalidationProperties);
23 } 24 }
24 25
25 CSSPaintDefinition::CSSPaintDefinition(ScriptState* scriptState, v8::Local<v8::F unction> constructor, v8::Local<v8::Function> paint, Vector<CSSPropertyID>& nati veInvalidationProperties, Vector<AtomicString>& customInvalidationProperties) 26 CSSPaintDefinition::CSSPaintDefinition(ScriptState* scriptState, v8::Local<v8::F unction> constructor, v8::Local<v8::Function> paint, Vector<CSSPropertyID>& nati veInvalidationProperties, Vector<AtomicString>& customInvalidationProperties)
26 : m_scriptState(scriptState) 27 : m_scriptState(scriptState)
(...skipping 16 matching lines...) Expand all
43 44
44 v8::Isolate* isolate = m_scriptState->isolate(); 45 v8::Isolate* isolate = m_scriptState->isolate();
45 v8::Local<v8::Object> instance = m_instance.newLocal(isolate); 46 v8::Local<v8::Object> instance = m_instance.newLocal(isolate);
46 47
47 // We may have failed to create an instance class, in which case produce an 48 // We may have failed to create an instance class, in which case produce an
48 // invalid image. 49 // invalid image.
49 if (isUndefinedOrNull(instance)) 50 if (isUndefinedOrNull(instance))
50 return nullptr; 51 return nullptr;
51 52
52 PaintRenderingContext2D* renderingContext = PaintRenderingContext2D::create( 53 PaintRenderingContext2D* renderingContext = PaintRenderingContext2D::create(
53 ImageBuffer::create(adoptPtr(new RecordingImageBufferSurface(size)))); 54 ImageBuffer::create(wrapUnique(new RecordingImageBufferSurface(size))));
54 Geometry* geometry = Geometry::create(size); 55 Geometry* geometry = Geometry::create(size);
55 56
56 v8::Local<v8::Value> argv[] = { 57 v8::Local<v8::Value> argv[] = {
57 toV8(renderingContext, m_scriptState->context()->Global(), isolate), 58 toV8(renderingContext, m_scriptState->context()->Global(), isolate),
58 toV8(geometry, m_scriptState->context()->Global(), isolate) 59 toV8(geometry, m_scriptState->context()->Global(), isolate)
59 }; 60 };
60 61
61 v8::Local<v8::Function> paint = m_paint.newLocal(isolate); 62 v8::Local<v8::Function> paint = m_paint.newLocal(isolate);
62 63
63 v8::TryCatch block(isolate); 64 v8::TryCatch block(isolate);
(...skipping 23 matching lines...) Expand all
87 88
88 v8::Local<v8::Object> paintInstance; 89 v8::Local<v8::Object> paintInstance;
89 if (V8ObjectConstructor::newInstance(isolate, constructor).ToLocal(&paintIns tance)) { 90 if (V8ObjectConstructor::newInstance(isolate, constructor).ToLocal(&paintIns tance)) {
90 m_instance.set(isolate, paintInstance); 91 m_instance.set(isolate, paintInstance);
91 } 92 }
92 93
93 m_didCallConstructor = true; 94 m_didCallConstructor = true;
94 } 95 }
95 96
96 } // namespace blink 97 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698