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

Side by Side Diff: third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "core/offscreencanvas/OffscreenCanvas.h" 5 #include "core/offscreencanvas/OffscreenCanvas.h"
6 6
7 #include "core/dom/ExceptionCode.h" 7 #include "core/dom/ExceptionCode.h"
8 #include "core/html/canvas/CanvasContextCreationAttributes.h" 8 #include "core/html/canvas/CanvasContextCreationAttributes.h"
9 #include "core/html/canvas/CanvasRenderingContext.h" 9 #include "core/html/canvas/CanvasRenderingContext.h"
10 #include "core/html/canvas/CanvasRenderingContextFactory.h" 10 #include "core/html/canvas/CanvasRenderingContextFactory.h"
11 #include "wtf/MathExtras.h" 11 #include "wtf/MathExtras.h"
12 #include <memory>
12 13
13 namespace blink { 14 namespace blink {
14 15
15 OffscreenCanvas::OffscreenCanvas(const IntSize& size) 16 OffscreenCanvas::OffscreenCanvas(const IntSize& size)
16 : m_size(size) 17 : m_size(size)
17 , m_originClean(true) 18 , m_originClean(true)
18 { 19 {
19 } 20 }
20 21
21 OffscreenCanvas* OffscreenCanvas::create(unsigned width, unsigned height) 22 OffscreenCanvas* OffscreenCanvas::create(unsigned width, unsigned height)
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 DEFINE_STATIC_LOCAL(ContextFactoryVector, s_contextFactories, (CanvasRenderi ngContext::ContextTypeCount)); 89 DEFINE_STATIC_LOCAL(ContextFactoryVector, s_contextFactories, (CanvasRenderi ngContext::ContextTypeCount));
89 return s_contextFactories; 90 return s_contextFactories;
90 } 91 }
91 92
92 CanvasRenderingContextFactory* OffscreenCanvas::getRenderingContextFactory(int t ype) 93 CanvasRenderingContextFactory* OffscreenCanvas::getRenderingContextFactory(int t ype)
93 { 94 {
94 ASSERT(type < CanvasRenderingContext::ContextTypeCount); 95 ASSERT(type < CanvasRenderingContext::ContextTypeCount);
95 return renderingContextFactories()[type].get(); 96 return renderingContextFactories()[type].get();
96 } 97 }
97 98
98 void OffscreenCanvas::registerRenderingContextFactory(PassOwnPtr<CanvasRendering ContextFactory> renderingContextFactory) 99 void OffscreenCanvas::registerRenderingContextFactory(std::unique_ptr<CanvasRend eringContextFactory> renderingContextFactory)
99 { 100 {
100 CanvasRenderingContext::ContextType type = renderingContextFactory->getConte xtType(); 101 CanvasRenderingContext::ContextType type = renderingContextFactory->getConte xtType();
101 ASSERT(type < CanvasRenderingContext::ContextTypeCount); 102 ASSERT(type < CanvasRenderingContext::ContextTypeCount);
102 ASSERT(!renderingContextFactories()[type]); 103 ASSERT(!renderingContextFactories()[type]);
103 renderingContextFactories()[type] = std::move(renderingContextFactory); 104 renderingContextFactories()[type] = std::move(renderingContextFactory);
104 } 105 }
105 106
106 bool OffscreenCanvas::originClean() const 107 bool OffscreenCanvas::originClean() const
107 { 108 {
108 // TODO(crbug.com/607575): Make Settings accessable in worker and use 109 // TODO(crbug.com/607575): Make Settings accessable in worker and use
109 // disableReadingFromCanvas to determine originClean value. 110 // disableReadingFromCanvas to determine originClean value.
110 return m_originClean; 111 return m_originClean;
111 } 112 }
112 113
113 DEFINE_TRACE(OffscreenCanvas) 114 DEFINE_TRACE(OffscreenCanvas)
114 { 115 {
115 visitor->trace(m_context); 116 visitor->trace(m_context);
116 } 117 }
117 118
118 } // namespace blink 119 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698