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

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: First attempt to land. 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/css/CSSComputedStyleDeclaration.h" 11 #include "core/css/CSSComputedStyleDeclaration.h"
12 #include "core/css/cssom/FilteredComputedStylePropertyMap.h" 12 #include "core/css/cssom/FilteredComputedStylePropertyMap.h"
13 #include "core/dom/ExecutionContext.h" 13 #include "core/dom/ExecutionContext.h"
14 #include "core/layout/LayoutObject.h" 14 #include "core/layout/LayoutObject.h"
15 #include "modules/csspaint/Geometry.h" 15 #include "modules/csspaint/Geometry.h"
16 #include "modules/csspaint/PaintRenderingContext2D.h" 16 #include "modules/csspaint/PaintRenderingContext2D.h"
17 #include "platform/graphics/ImageBuffer.h" 17 #include "platform/graphics/ImageBuffer.h"
18 #include "platform/graphics/PaintGeneratedImage.h" 18 #include "platform/graphics/PaintGeneratedImage.h"
19 #include "platform/graphics/RecordingImageBufferSurface.h" 19 #include "platform/graphics/RecordingImageBufferSurface.h"
20 #include "wtf/PtrUtil.h"
20 21
21 namespace blink { 22 namespace blink {
22 23
23 CSSPaintDefinition* CSSPaintDefinition::create(ScriptState* scriptState, v8::Loc al<v8::Function> constructor, v8::Local<v8::Function> paint, Vector<CSSPropertyI D>& nativeInvalidationProperties, Vector<AtomicString>& customInvalidationProper ties) 24 CSSPaintDefinition* CSSPaintDefinition::create(ScriptState* scriptState, v8::Loc al<v8::Function> constructor, v8::Local<v8::Function> paint, Vector<CSSPropertyI D>& nativeInvalidationProperties, Vector<AtomicString>& customInvalidationProper ties)
24 { 25 {
25 return new CSSPaintDefinition(scriptState, constructor, paint, nativeInvalid ationProperties, customInvalidationProperties); 26 return new CSSPaintDefinition(scriptState, constructor, paint, nativeInvalid ationProperties, customInvalidationProperties);
26 } 27 }
27 28
28 CSSPaintDefinition::CSSPaintDefinition(ScriptState* scriptState, v8::Local<v8::F unction> constructor, v8::Local<v8::Function> paint, Vector<CSSPropertyID>& nati veInvalidationProperties, Vector<AtomicString>& customInvalidationProperties) 29 CSSPaintDefinition::CSSPaintDefinition(ScriptState* scriptState, v8::Local<v8::F unction> constructor, v8::Local<v8::Function> paint, Vector<CSSPropertyID>& nati veInvalidationProperties, Vector<AtomicString>& customInvalidationProperties)
29 : m_scriptState(scriptState) 30 : m_scriptState(scriptState)
(...skipping 18 matching lines...) Expand all
48 v8::Local<v8::Object> instance = m_instance.newLocal(isolate); 49 v8::Local<v8::Object> instance = m_instance.newLocal(isolate);
49 50
50 // We may have failed to create an instance class, in which case produce an 51 // We may have failed to create an instance class, in which case produce an
51 // invalid image. 52 // invalid image.
52 if (isUndefinedOrNull(instance)) 53 if (isUndefinedOrNull(instance))
53 return nullptr; 54 return nullptr;
54 55
55 DCHECK(layoutObject.node()); 56 DCHECK(layoutObject.node());
56 57
57 PaintRenderingContext2D* renderingContext = PaintRenderingContext2D::create( 58 PaintRenderingContext2D* renderingContext = PaintRenderingContext2D::create(
58 ImageBuffer::create(adoptPtr(new RecordingImageBufferSurface(size)))); 59 ImageBuffer::create(wrapUnique(new RecordingImageBufferSurface(size))));
59 Geometry* geometry = Geometry::create(size); 60 Geometry* geometry = Geometry::create(size);
60 StylePropertyMap* styleMap = FilteredComputedStylePropertyMap::create( 61 StylePropertyMap* styleMap = FilteredComputedStylePropertyMap::create(
61 CSSComputedStyleDeclaration::create(layoutObject.node()), 62 CSSComputedStyleDeclaration::create(layoutObject.node()),
62 m_nativeInvalidationProperties, m_customInvalidationProperties); 63 m_nativeInvalidationProperties, m_customInvalidationProperties);
63 64
64 v8::Local<v8::Value> argv[] = { 65 v8::Local<v8::Value> argv[] = {
65 toV8(renderingContext, m_scriptState->context()->Global(), isolate), 66 toV8(renderingContext, m_scriptState->context()->Global(), isolate),
66 toV8(geometry, m_scriptState->context()->Global(), isolate), 67 toV8(geometry, m_scriptState->context()->Global(), isolate),
67 toV8(styleMap, m_scriptState->context()->Global(), isolate) 68 toV8(styleMap, m_scriptState->context()->Global(), isolate)
68 }; 69 };
(...skipping 27 matching lines...) Expand all
96 97
97 v8::Local<v8::Object> paintInstance; 98 v8::Local<v8::Object> paintInstance;
98 if (V8ObjectConstructor::newInstance(isolate, constructor).ToLocal(&paintIns tance)) { 99 if (V8ObjectConstructor::newInstance(isolate, constructor).ToLocal(&paintIns tance)) {
99 m_instance.set(isolate, paintInstance); 100 m_instance.set(isolate, paintInstance);
100 } 101 }
101 102
102 m_didCallConstructor = true; 103 m_didCallConstructor = true;
103 } 104 }
104 105
105 } // namespace blink 106 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698