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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.h

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 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 19 matching lines...) Expand all
30 #include "platform/geometry/IntSize.h" 30 #include "platform/geometry/IntSize.h"
31 #include "platform/graphics/ImageBufferSurface.h" 31 #include "platform/graphics/ImageBufferSurface.h"
32 #include "public/platform/WebExternalTextureLayer.h" 32 #include "public/platform/WebExternalTextureLayer.h"
33 #include "public/platform/WebExternalTextureLayerClient.h" 33 #include "public/platform/WebExternalTextureLayerClient.h"
34 #include "public/platform/WebExternalTextureMailbox.h" 34 #include "public/platform/WebExternalTextureMailbox.h"
35 #include "public/platform/WebThread.h" 35 #include "public/platform/WebThread.h"
36 #include "third_party/khronos/GLES2/gl2.h" 36 #include "third_party/khronos/GLES2/gl2.h"
37 #include "third_party/skia/include/core/SkSurface.h" 37 #include "third_party/skia/include/core/SkSurface.h"
38 #include "wtf/Allocator.h" 38 #include "wtf/Allocator.h"
39 #include "wtf/Deque.h" 39 #include "wtf/Deque.h"
40 #include "wtf/PassOwnPtr.h"
40 #include "wtf/RefCounted.h" 41 #include "wtf/RefCounted.h"
41 #include "wtf/RefPtr.h" 42 #include "wtf/RefPtr.h"
42 #include "wtf/Vector.h" 43 #include "wtf/Vector.h"
43 #include "wtf/WeakPtr.h" 44 #include "wtf/WeakPtr.h"
44 #include <memory>
45 45
46 class SkImage; 46 class SkImage;
47 struct SkImageInfo; 47 struct SkImageInfo;
48 class SkPictureRecorder; 48 class SkPictureRecorder;
49 49
50 namespace gpu { 50 namespace gpu {
51 namespace gles2 { 51 namespace gles2 {
52 class GLES2Interface; 52 class GLES2Interface;
53 } 53 }
54 } 54 }
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 HibernationEventCount = 12, 139 HibernationEventCount = 12,
140 }; 140 };
141 141
142 class PLATFORM_EXPORT Logger { 142 class PLATFORM_EXPORT Logger {
143 public: 143 public:
144 virtual void reportHibernationEvent(HibernationEvent); 144 virtual void reportHibernationEvent(HibernationEvent);
145 virtual void didStartHibernating() { } 145 virtual void didStartHibernating() { }
146 virtual ~Logger() { } 146 virtual ~Logger() { }
147 }; 147 };
148 148
149 void setLoggerForTesting(std::unique_ptr<Logger>); 149 void setLoggerForTesting(PassOwnPtr<Logger>);
150 150
151 private: 151 private:
152 #if USE_IOSURFACE_FOR_2D_CANVAS 152 #if USE_IOSURFACE_FOR_2D_CANVAS
153 // All information associated with a CHROMIUM image. 153 // All information associated with a CHROMIUM image.
154 struct ImageInfo { 154 struct ImageInfo {
155 ImageInfo() {} 155 ImageInfo() {}
156 ImageInfo(GLuint imageId, GLuint textureId, GLint gpuMemoryBufferId); 156 ImageInfo(GLuint imageId, GLuint textureId, GLint gpuMemoryBufferId);
157 157
158 // Whether this structure holds references to a CHROMIUM image. 158 // Whether this structure holds references to a CHROMIUM image.
159 bool empty(); 159 bool empty();
(...skipping 18 matching lines...) Expand all
178 #if USE_IOSURFACE_FOR_2D_CANVAS 178 #if USE_IOSURFACE_FOR_2D_CANVAS
179 // If this mailbox wraps an IOSurface-backed texture, the ids of the 179 // If this mailbox wraps an IOSurface-backed texture, the ids of the
180 // CHROMIUM image and the texture. 180 // CHROMIUM image and the texture.
181 ImageInfo m_imageInfo; 181 ImageInfo m_imageInfo;
182 #endif // USE_IOSURFACE_FOR_2D_CANVAS 182 #endif // USE_IOSURFACE_FOR_2D_CANVAS
183 183
184 MailboxInfo(const MailboxInfo&); 184 MailboxInfo(const MailboxInfo&);
185 MailboxInfo() {} 185 MailboxInfo() {}
186 }; 186 };
187 187
188 Canvas2DLayerBridge(std::unique_ptr<WebGraphicsContext3DProvider>, const Int Size&, int msaaSampleCount, OpacityMode, AccelerationMode); 188 Canvas2DLayerBridge(PassOwnPtr<WebGraphicsContext3DProvider>, const IntSize& , int msaaSampleCount, OpacityMode, AccelerationMode);
189 gpu::gles2::GLES2Interface* contextGL(); 189 gpu::gles2::GLES2Interface* contextGL();
190 void startRecording(); 190 void startRecording();
191 void skipQueuedDrawCommands(); 191 void skipQueuedDrawCommands();
192 void flushRecordingOnly(); 192 void flushRecordingOnly();
193 void unregisterTaskObserver(); 193 void unregisterTaskObserver();
194 void reportSurfaceCreationFailure(); 194 void reportSurfaceCreationFailure();
195 195
196 // WebThread::TaskOberver implementation 196 // WebThread::TaskOberver implementation
197 void willProcessTask() override; 197 void willProcessTask() override;
198 void didProcessTask() override; 198 void didProcessTask() override;
(...skipping 27 matching lines...) Expand all
226 void createMailboxInfo(); 226 void createMailboxInfo();
227 227
228 // Returns whether the mailbox was successfully prepared from the SkImage. 228 // Returns whether the mailbox was successfully prepared from the SkImage.
229 // The mailbox is an out parameter only populated on success. 229 // The mailbox is an out parameter only populated on success.
230 bool prepareMailboxFromImage(PassRefPtr<SkImage>, WebExternalTextureMailbox* ); 230 bool prepareMailboxFromImage(PassRefPtr<SkImage>, WebExternalTextureMailbox* );
231 231
232 // Resets Skia's texture bindings. This method should be called after 232 // Resets Skia's texture bindings. This method should be called after
233 // changing texture bindings. 233 // changing texture bindings.
234 void resetSkiaTextureBinding(); 234 void resetSkiaTextureBinding();
235 235
236 std::unique_ptr<SkPictureRecorder> m_recorder; 236 OwnPtr<SkPictureRecorder> m_recorder;
237 RefPtr<SkSurface> m_surface; 237 RefPtr<SkSurface> m_surface;
238 RefPtr<SkImage> m_hibernationImage; 238 RefPtr<SkImage> m_hibernationImage;
239 int m_initialSurfaceSaveCount; 239 int m_initialSurfaceSaveCount;
240 std::unique_ptr<WebExternalTextureLayer> m_layer; 240 OwnPtr<WebExternalTextureLayer> m_layer;
241 std::unique_ptr<WebGraphicsContext3DProvider> m_contextProvider; 241 OwnPtr<WebGraphicsContext3DProvider> m_contextProvider;
242 std::unique_ptr<SharedContextRateLimiter> m_rateLimiter; 242 OwnPtr<SharedContextRateLimiter> m_rateLimiter;
243 std::unique_ptr<Logger> m_logger; 243 OwnPtr<Logger> m_logger;
244 WeakPtrFactory<Canvas2DLayerBridge> m_weakPtrFactory; 244 WeakPtrFactory<Canvas2DLayerBridge> m_weakPtrFactory;
245 ImageBuffer* m_imageBuffer; 245 ImageBuffer* m_imageBuffer;
246 int m_msaaSampleCount; 246 int m_msaaSampleCount;
247 size_t m_bytesAllocated; 247 size_t m_bytesAllocated;
248 bool m_haveRecordedDrawCommands; 248 bool m_haveRecordedDrawCommands;
249 bool m_destructionInProgress; 249 bool m_destructionInProgress;
250 SkFilterQuality m_filterQuality; 250 SkFilterQuality m_filterQuality;
251 bool m_isHidden; 251 bool m_isHidden;
252 bool m_isDeferralEnabled; 252 bool m_isDeferralEnabled;
253 bool m_isRegisteredTaskObserver; 253 bool m_isRegisteredTaskObserver;
(...skipping 23 matching lines...) Expand all
277 // Each element in this vector represents an IOSurface backed texture that 277 // Each element in this vector represents an IOSurface backed texture that
278 // is ready to be reused. 278 // is ready to be reused.
279 // Elements in this vector can safely be purged in low memory conditions. 279 // Elements in this vector can safely be purged in low memory conditions.
280 Vector<ImageInfo> m_imageInfoCache; 280 Vector<ImageInfo> m_imageInfoCache;
281 #endif // USE_IOSURFACE_FOR_2D_CANVAS 281 #endif // USE_IOSURFACE_FOR_2D_CANVAS
282 }; 282 };
283 283
284 } // namespace blink 284 } // namespace blink
285 285
286 #endif 286 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698