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

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

Issue 2515623003: Stop OffscreenCanvas resize from changing placeholder attributes (Closed)
Patch Set: report correct intrinsic size Created 4 years, 1 month 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 #ifndef OffscreenCanvasPlaceholder_h 5 #ifndef OffscreenCanvasPlaceholder_h
6 #define OffscreenCanvasPlaceholder_h 6 #define OffscreenCanvasPlaceholder_h
7 7
8 #include "platform/PlatformExport.h" 8 #include "platform/PlatformExport.h"
9 #include "wtf/RefPtr.h" 9 #include "wtf/RefPtr.h"
10 #include "wtf/WeakPtr.h" 10 #include "wtf/WeakPtr.h"
11 #include <memory> 11 #include <memory>
12 12
13 namespace blink { 13 namespace blink {
14 14
15 class Image; 15 class Image;
16 class IntSize; 16 class IntSize;
17 class OffscreenCanvasFrameDispatcher; 17 class OffscreenCanvasFrameDispatcher;
18 class WebTaskRunner; 18 class WebTaskRunner;
19 19
20 class PLATFORM_EXPORT OffscreenCanvasPlaceholder { 20 class PLATFORM_EXPORT OffscreenCanvasPlaceholder {
21 public: 21 public:
22 ~OffscreenCanvasPlaceholder(); 22 ~OffscreenCanvasPlaceholder();
23 23
24 void setPlaceholderFrame(RefPtr<Image>, 24 void setPlaceholderFrame(RefPtr<Image>,
25 WeakPtr<OffscreenCanvasFrameDispatcher>, 25 WeakPtr<OffscreenCanvasFrameDispatcher>,
26 std::unique_ptr<WebTaskRunner>, 26 std::unique_ptr<WebTaskRunner>,
27 unsigned resourceId); 27 unsigned resourceId);
28 void releasePlaceholderFrame(); 28 void releasePlaceholderFrame();
29 29
30 virtual void setSize(const IntSize&) = 0;
31
32 static OffscreenCanvasPlaceholder* getPlaceholderById(unsigned placeholderId); 30 static OffscreenCanvasPlaceholder* getPlaceholderById(unsigned placeholderId);
33 31
34 void registerPlaceholder(unsigned placeholderId); 32 void registerPlaceholder(unsigned placeholderId);
35 void unregisterPlaceholder(); 33 void unregisterPlaceholder();
36 const RefPtr<Image>& placeholderFrame() const { return m_placeholderFrame; } 34 const RefPtr<Image>& placeholderFrame() const { return m_placeholderFrame; }
37 35
38 private: 36 private:
39 bool isPlaceholderRegistered() const { 37 bool isPlaceholderRegistered() const {
40 return m_placeholderId != kNoPlaceholderId; 38 return m_placeholderId != kNoPlaceholderId;
41 } 39 }
42 40
43 RefPtr<Image> m_placeholderFrame; 41 RefPtr<Image> m_placeholderFrame;
44 WeakPtr<OffscreenCanvasFrameDispatcher> m_frameDispatcher; 42 WeakPtr<OffscreenCanvasFrameDispatcher> m_frameDispatcher;
45 std::unique_ptr<WebTaskRunner> m_frameDispatcherTaskRunner; 43 std::unique_ptr<WebTaskRunner> m_frameDispatcherTaskRunner;
46 unsigned m_placeholderFrameResourceId = 0; 44 unsigned m_placeholderFrameResourceId = 0;
47 45
48 enum { 46 enum {
49 kNoPlaceholderId = -1, 47 kNoPlaceholderId = -1,
50 }; 48 };
51 int m_placeholderId = kNoPlaceholderId; 49 int m_placeholderId = kNoPlaceholderId;
52 }; 50 };
53 51
54 } // blink 52 } // blink
55 53
56 #endif 54 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698