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

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

Issue 2328463004: Implement WebGL's commit on the main thread (Closed)
Patch Set: fix compile error on win_dbg Created 4 years, 2 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 #ifndef AcceleratedStaticBitmapImage_h 5 #ifndef AcceleratedStaticBitmapImage_h
6 #define AcceleratedStaticBitmapImage_h 6 #define AcceleratedStaticBitmapImage_h
7 7
8 #include "base/threading/thread_checker.h" 8 #include "base/threading/thread_checker.h"
9 #include "gpu/command_buffer/common/mailbox.h"
10 #include "gpu/command_buffer/common/sync_token.h"
11 #include "platform/geometry/IntSize.h" 9 #include "platform/geometry/IntSize.h"
12 #include "platform/graphics/StaticBitmapImage.h" 10 #include "platform/graphics/StaticBitmapImage.h"
13 #include "third_party/skia/include/core/SkRefCnt.h" 11 #include "third_party/skia/include/core/SkRefCnt.h"
14 12
15 #include <memory> 13 #include <memory>
16 14
17 class GrContext; 15 class GrContext;
18 16
19 namespace cc { 17 namespace cc {
20 class SingleReleaseCallback; 18 class SingleReleaseCallback;
(...skipping 15 matching lines...) Expand all
36 // StaticBitmapImage overrides. 34 // StaticBitmapImage overrides.
37 sk_sp<SkImage> imageForCurrentFrame() override; 35 sk_sp<SkImage> imageForCurrentFrame() override;
38 void copyToTexture(WebGraphicsContext3DProvider*, GLuint destTextureId, GLen um destInternalFormat, GLenum destType, bool flipY) override; 36 void copyToTexture(WebGraphicsContext3DProvider*, GLuint destTextureId, GLen um destInternalFormat, GLenum destType, bool flipY) override;
39 37
40 // Image overrides. 38 // Image overrides.
41 void draw(SkCanvas*, const SkPaint&, const FloatRect& dstRect, const FloatRe ct& srcRect, RespectImageOrientationEnum, ImageClampingMode) override; 39 void draw(SkCanvas*, const SkPaint&, const FloatRect& dstRect, const FloatRe ct& srcRect, RespectImageOrientationEnum, ImageClampingMode) override;
42 40
43 // To be called on sender thread before performing a transfer 41 // To be called on sender thread before performing a transfer
44 void transfer() final; 42 void transfer() final;
45 43
44 void ensureMailbox() final;
45 gpu::Mailbox getMailbox() final { return m_mailbox; }
46 gpu::SyncToken getSyncToken() final { return m_syncToken; }
47
46 private: 48 private:
47 AcceleratedStaticBitmapImage(sk_sp<SkImage>); 49 AcceleratedStaticBitmapImage(sk_sp<SkImage>);
48 AcceleratedStaticBitmapImage(sk_sp<SkImage>, const gpu::Mailbox&, const gpu: :SyncToken&); 50 AcceleratedStaticBitmapImage(sk_sp<SkImage>, const gpu::Mailbox&, const gpu: :SyncToken&);
49 51
50 void ensureMailbox();
51 void createImageFromMailboxIfNeeded(); 52 void createImageFromMailboxIfNeeded();
52 void checkThread(); 53 void checkThread();
53 void waitSyncTokenIfNeeded(); 54 void waitSyncTokenIfNeeded();
54 bool isValid(); 55 bool isValid();
55 void releaseImageThreadSafe(); 56 void releaseImageThreadSafe();
56 bool imageBelongsToSharedContext(); 57 bool imageBelongsToSharedContext();
57 58
58 // Id of the shared context where m_image was created 59 // Id of the shared context where m_image was created
59 unsigned m_sharedContextId; 60 unsigned m_sharedContextId;
60 // True when the below mailbox and sync token are valid for getting at the t exture backing the object's SkImage. 61 // True when the below mailbox and sync token are valid for getting at the t exture backing the object's SkImage.
61 bool m_hasMailbox = false; 62 bool m_hasMailbox = false;
62 // A mailbox referring to the texture id backing the SkImage. The mailbox is valid as long as the SkImage is held alive. 63 // A mailbox referring to the texture id backing the SkImage. The mailbox is valid as long as the SkImage is held alive.
63 gpu::Mailbox m_mailbox; 64 gpu::Mailbox m_mailbox;
64 // This token must be waited for before using the mailbox. 65 // This token must be waited for before using the mailbox.
65 gpu::SyncToken m_syncToken; 66 gpu::SyncToken m_syncToken;
66 // Thread that m_image belongs to. Set to null when m_image belong to the sa me thread 67 // Thread that m_image belongs to. Set to null when m_image belong to the sa me thread
67 // as this AcceleratedStaticBitmapImage. Should only be non-null after a tr ansfer. 68 // as this AcceleratedStaticBitmapImage. Should only be non-null after a tr ansfer.
68 WebThread* m_imageThread = nullptr; 69 WebThread* m_imageThread = nullptr;
69 70
70 base::ThreadChecker m_threadChecker; 71 base::ThreadChecker m_threadChecker;
71 bool m_detachThreadAtNextCheck = false; 72 bool m_detachThreadAtNextCheck = false;
72 }; 73 };
73 74
74 } // namespace blink 75 } // namespace blink
75 76
76 #endif 77 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698