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

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

Issue 2080623002: Revert "Remove OwnPtr from Blink." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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"
21 20
22 namespace blink { 21 namespace blink {
23 22
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) 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)
25 { 24 {
26 return new CSSPaintDefinition(scriptState, constructor, paint, nativeInvalid ationProperties, customInvalidationProperties); 25 return new CSSPaintDefinition(scriptState, constructor, paint, nativeInvalid ationProperties, customInvalidationProperties);
27 } 26 }
28 27
29 CSSPaintDefinition::CSSPaintDefinition(ScriptState* scriptState, v8::Local<v8::F unction> constructor, v8::Local<v8::Function> paint, Vector<CSSPropertyID>& nati veInvalidationProperties, Vector<AtomicString>& customInvalidationProperties) 28 CSSPaintDefinition::CSSPaintDefinition(ScriptState* scriptState, v8::Local<v8::F unction> constructor, v8::Local<v8::Function> paint, Vector<CSSPropertyID>& nati veInvalidationProperties, Vector<AtomicString>& customInvalidationProperties)
30 : m_scriptState(scriptState) 29 : m_scriptState(scriptState)
(...skipping 18 matching lines...) Expand all
49 v8::Local<v8::Object> instance = m_instance.newLocal(isolate); 48 v8::Local<v8::Object> instance = m_instance.newLocal(isolate);
50 49
51 // We may have failed to create an instance class, in which case produce an 50 // We may have failed to create an instance class, in which case produce an
52 // invalid image. 51 // invalid image.
53 if (isUndefinedOrNull(instance)) 52 if (isUndefinedOrNull(instance))
54 return nullptr; 53 return nullptr;
55 54
56 DCHECK(layoutObject.node()); 55 DCHECK(layoutObject.node());
57 56
58 PaintRenderingContext2D* renderingContext = PaintRenderingContext2D::create( 57 PaintRenderingContext2D* renderingContext = PaintRenderingContext2D::create(
59 ImageBuffer::create(wrapUnique(new RecordingImageBufferSurface(size)))); 58 ImageBuffer::create(adoptPtr(new RecordingImageBufferSurface(size))));
60 Geometry* geometry = Geometry::create(size); 59 Geometry* geometry = Geometry::create(size);
61 StylePropertyMap* styleMap = FilteredComputedStylePropertyMap::create( 60 StylePropertyMap* styleMap = FilteredComputedStylePropertyMap::create(
62 CSSComputedStyleDeclaration::create(layoutObject.node()), 61 CSSComputedStyleDeclaration::create(layoutObject.node()),
63 m_nativeInvalidationProperties, m_customInvalidationProperties); 62 m_nativeInvalidationProperties, m_customInvalidationProperties);
64 63
65 v8::Local<v8::Value> argv[] = { 64 v8::Local<v8::Value> argv[] = {
66 toV8(renderingContext, m_scriptState->context()->Global(), isolate), 65 toV8(renderingContext, m_scriptState->context()->Global(), isolate),
67 toV8(geometry, m_scriptState->context()->Global(), isolate), 66 toV8(geometry, m_scriptState->context()->Global(), isolate),
68 toV8(styleMap, m_scriptState->context()->Global(), isolate) 67 toV8(styleMap, m_scriptState->context()->Global(), isolate)
69 }; 68 };
(...skipping 27 matching lines...) Expand all
97 96
98 v8::Local<v8::Object> paintInstance; 97 v8::Local<v8::Object> paintInstance;
99 if (V8ObjectConstructor::newInstance(isolate, constructor).ToLocal(&paintIns tance)) { 98 if (V8ObjectConstructor::newInstance(isolate, constructor).ToLocal(&paintIns tance)) {
100 m_instance.set(isolate, paintInstance); 99 m_instance.set(isolate, paintInstance);
101 } 100 }
102 101
103 m_didCallConstructor = true; 102 m_didCallConstructor = true;
104 } 103 }
105 104
106 } // namespace blink 105 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698