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

Side by Side Diff: cc/layers/texture_layer.h

Issue 1427543002: Modified old wait sync point functions to also accept new sync tokens. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: format Created 5 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
« no previous file with comments | « cc/blink/web_external_texture_layer_impl.cc ('k') | cc/layers/texture_layer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 The Chromium Authors. All rights reserved. 1 // Copyright 2010 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 CC_LAYERS_TEXTURE_LAYER_H_ 5 #ifndef CC_LAYERS_TEXTURE_LAYER_H_
6 #define CC_LAYERS_TEXTURE_LAYER_H_ 6 #define CC_LAYERS_TEXTURE_LAYER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/synchronization/lock.h" 11 #include "base/synchronization/lock.h"
12 #include "base/threading/thread_checker.h" 12 #include "base/threading/thread_checker.h"
13 #include "cc/base/cc_export.h" 13 #include "cc/base/cc_export.h"
14 #include "cc/layers/layer.h" 14 #include "cc/layers/layer.h"
15 #include "cc/resources/texture_mailbox.h" 15 #include "cc/resources/texture_mailbox.h"
16 16
17 namespace gpu {
18 struct SyncToken;
19 }
20
17 namespace cc { 21 namespace cc {
18 class BlockingTaskRunner; 22 class BlockingTaskRunner;
19 class SingleReleaseCallback; 23 class SingleReleaseCallback;
20 class SingleReleaseCallbackImpl; 24 class SingleReleaseCallbackImpl;
21 class TextureLayerClient; 25 class TextureLayerClient;
22 26
23 // A Layer containing a the rendered output of a plugin instance. 27 // A Layer containing a the rendered output of a plugin instance.
24 class CC_EXPORT TextureLayer : public Layer { 28 class CC_EXPORT TextureLayer : public Layer {
25 public: 29 public:
26 class CC_EXPORT TextureMailboxHolder 30 class CC_EXPORT TextureMailboxHolder
27 : public base::RefCountedThreadSafe<TextureMailboxHolder> { 31 : public base::RefCountedThreadSafe<TextureMailboxHolder> {
28 public: 32 public:
29 class CC_EXPORT MainThreadReference { 33 class CC_EXPORT MainThreadReference {
30 public: 34 public:
31 explicit MainThreadReference(TextureMailboxHolder* holder); 35 explicit MainThreadReference(TextureMailboxHolder* holder);
32 ~MainThreadReference(); 36 ~MainThreadReference();
33 TextureMailboxHolder* holder() { return holder_.get(); } 37 TextureMailboxHolder* holder() { return holder_.get(); }
34 38
35 private: 39 private:
36 scoped_refptr<TextureMailboxHolder> holder_; 40 scoped_refptr<TextureMailboxHolder> holder_;
37 DISALLOW_COPY_AND_ASSIGN(MainThreadReference); 41 DISALLOW_COPY_AND_ASSIGN(MainThreadReference);
38 }; 42 };
39 43
40 const TextureMailbox& mailbox() const { return mailbox_; } 44 const TextureMailbox& mailbox() const { return mailbox_; }
41 void Return(uint32 sync_point, bool is_lost); 45 void Return(const gpu::SyncToken& sync_token, bool is_lost);
42 46
43 // Gets a ReleaseCallback that can be called from another thread. Note: the 47 // Gets a ReleaseCallback that can be called from another thread. Note: the
44 // caller must ensure the callback is called. 48 // caller must ensure the callback is called.
45 scoped_ptr<SingleReleaseCallbackImpl> GetCallbackForImplThread(); 49 scoped_ptr<SingleReleaseCallbackImpl> GetCallbackForImplThread();
46 50
47 protected: 51 protected:
48 friend class TextureLayer; 52 friend class TextureLayer;
49 53
50 // Protected visiblity so only TextureLayer and unit tests can create these. 54 // Protected visiblity so only TextureLayer and unit tests can create these.
51 static scoped_ptr<MainThreadReference> Create( 55 static scoped_ptr<MainThreadReference> Create(
52 const TextureMailbox& mailbox, 56 const TextureMailbox& mailbox,
53 scoped_ptr<SingleReleaseCallback> release_callback); 57 scoped_ptr<SingleReleaseCallback> release_callback);
54 virtual ~TextureMailboxHolder(); 58 virtual ~TextureMailboxHolder();
55 59
56 private: 60 private:
57 friend class base::RefCountedThreadSafe<TextureMailboxHolder>; 61 friend class base::RefCountedThreadSafe<TextureMailboxHolder>;
58 friend class MainThreadReference; 62 friend class MainThreadReference;
59 explicit TextureMailboxHolder( 63 explicit TextureMailboxHolder(
60 const TextureMailbox& mailbox, 64 const TextureMailbox& mailbox,
61 scoped_ptr<SingleReleaseCallback> release_callback); 65 scoped_ptr<SingleReleaseCallback> release_callback);
62 66
63 void InternalAddRef(); 67 void InternalAddRef();
64 void InternalRelease(); 68 void InternalRelease();
65 void ReturnAndReleaseOnImplThread( 69 void ReturnAndReleaseOnImplThread(
66 uint32 sync_point, 70 const gpu::SyncToken& sync_token,
67 bool is_lost, 71 bool is_lost,
68 BlockingTaskRunner* main_thread_task_runner); 72 BlockingTaskRunner* main_thread_task_runner);
69 73
70 // These members are only accessed on the main thread, or on the impl thread 74 // These members are only accessed on the main thread, or on the impl thread
71 // during commit where the main thread is blocked. 75 // during commit where the main thread is blocked.
72 unsigned internal_references_; 76 unsigned internal_references_;
73 TextureMailbox mailbox_; 77 TextureMailbox mailbox_;
74 scoped_ptr<SingleReleaseCallback> release_callback_; 78 scoped_ptr<SingleReleaseCallback> release_callback_;
75 79
76 // This lock guards the sync_point_ and is_lost_ fields because they can be 80 // This lock guards the sync_token_ and is_lost_ fields because they can be
77 // accessed on both the impl and main thread. We do this to ensure that the 81 // accessed on both the impl and main thread. We do this to ensure that the
78 // values of these fields are well-ordered such that the last call to 82 // values of these fields are well-ordered such that the last call to
79 // ReturnAndReleaseOnImplThread() defines their values. 83 // ReturnAndReleaseOnImplThread() defines their values.
80 base::Lock arguments_lock_; 84 base::Lock arguments_lock_;
81 uint32 sync_point_; 85 gpu::SyncToken sync_token_;
82 bool is_lost_; 86 bool is_lost_;
83 base::ThreadChecker main_thread_checker_; 87 base::ThreadChecker main_thread_checker_;
84 DISALLOW_COPY_AND_ASSIGN(TextureMailboxHolder); 88 DISALLOW_COPY_AND_ASSIGN(TextureMailboxHolder);
85 }; 89 };
86 90
87 // Used when mailbox names are specified instead of texture IDs. 91 // Used when mailbox names are specified instead of texture IDs.
88 static scoped_refptr<TextureLayer> CreateForMailbox( 92 static scoped_refptr<TextureLayer> CreateForMailbox(
89 const LayerSettings& settings, 93 const LayerSettings& settings,
90 TextureLayerClient* client); 94 TextureLayerClient* client);
91 95
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 bool blend_background_color_; 168 bool blend_background_color_;
165 169
166 scoped_ptr<TextureMailboxHolder::MainThreadReference> holder_ref_; 170 scoped_ptr<TextureMailboxHolder::MainThreadReference> holder_ref_;
167 bool needs_set_mailbox_; 171 bool needs_set_mailbox_;
168 172
169 DISALLOW_COPY_AND_ASSIGN(TextureLayer); 173 DISALLOW_COPY_AND_ASSIGN(TextureLayer);
170 }; 174 };
171 175
172 } // namespace cc 176 } // namespace cc
173 #endif // CC_LAYERS_TEXTURE_LAYER_H_ 177 #endif // CC_LAYERS_TEXTURE_LAYER_H_
OLDNEW
« no previous file with comments | « cc/blink/web_external_texture_layer_impl.cc ('k') | cc/layers/texture_layer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698