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

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: Fix mock gpu video accelerator factory 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
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(uint32 sync_point,
46 const gpu::SyncToken& sync_token,
47 bool is_lost);
42 48
43 // Gets a ReleaseCallback that can be called from another thread. Note: the 49 // Gets a ReleaseCallback that can be called from another thread. Note: the
44 // caller must ensure the callback is called. 50 // caller must ensure the callback is called.
45 scoped_ptr<SingleReleaseCallbackImpl> GetCallbackForImplThread(); 51 scoped_ptr<SingleReleaseCallbackImpl> GetCallbackForImplThread();
46 52
47 protected: 53 protected:
48 friend class TextureLayer; 54 friend class TextureLayer;
49 55
50 // Protected visiblity so only TextureLayer and unit tests can create these. 56 // Protected visiblity so only TextureLayer and unit tests can create these.
51 static scoped_ptr<MainThreadReference> Create( 57 static scoped_ptr<MainThreadReference> Create(
52 const TextureMailbox& mailbox, 58 const TextureMailbox& mailbox,
53 scoped_ptr<SingleReleaseCallback> release_callback); 59 scoped_ptr<SingleReleaseCallback> release_callback);
54 virtual ~TextureMailboxHolder(); 60 virtual ~TextureMailboxHolder();
55 61
56 private: 62 private:
57 friend class base::RefCountedThreadSafe<TextureMailboxHolder>; 63 friend class base::RefCountedThreadSafe<TextureMailboxHolder>;
58 friend class MainThreadReference; 64 friend class MainThreadReference;
59 explicit TextureMailboxHolder( 65 explicit TextureMailboxHolder(
60 const TextureMailbox& mailbox, 66 const TextureMailbox& mailbox,
61 scoped_ptr<SingleReleaseCallback> release_callback); 67 scoped_ptr<SingleReleaseCallback> release_callback);
62 68
63 void InternalAddRef(); 69 void InternalAddRef();
64 void InternalRelease(); 70 void InternalRelease();
65 void ReturnAndReleaseOnImplThread( 71 void ReturnAndReleaseOnImplThread(
66 uint32 sync_point, 72 uint32 sync_point,
73 const gpu::SyncToken& sync_token,
67 bool is_lost, 74 bool is_lost,
68 BlockingTaskRunner* main_thread_task_runner); 75 BlockingTaskRunner* main_thread_task_runner);
69 76
70 // These members are only accessed on the main thread, or on the impl thread 77 // These members are only accessed on the main thread, or on the impl thread
71 // during commit where the main thread is blocked. 78 // during commit where the main thread is blocked.
72 unsigned internal_references_; 79 unsigned internal_references_;
73 TextureMailbox mailbox_; 80 TextureMailbox mailbox_;
74 scoped_ptr<SingleReleaseCallback> release_callback_; 81 scoped_ptr<SingleReleaseCallback> release_callback_;
75 82
76 // This lock guards the sync_point_ and is_lost_ fields because they can be 83 // This lock guards the sync_point_ and is_lost_ fields because they can be
77 // accessed on both the impl and main thread. We do this to ensure that the 84 // 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 85 // values of these fields are well-ordered such that the last call to
79 // ReturnAndReleaseOnImplThread() defines their values. 86 // ReturnAndReleaseOnImplThread() defines their values.
80 base::Lock arguments_lock_; 87 base::Lock arguments_lock_;
81 uint32 sync_point_; 88 uint32 sync_point_;
89 gpu::SyncToken sync_token_;
82 bool is_lost_; 90 bool is_lost_;
83 base::ThreadChecker main_thread_checker_; 91 base::ThreadChecker main_thread_checker_;
84 DISALLOW_COPY_AND_ASSIGN(TextureMailboxHolder); 92 DISALLOW_COPY_AND_ASSIGN(TextureMailboxHolder);
85 }; 93 };
86 94
87 // Used when mailbox names are specified instead of texture IDs. 95 // Used when mailbox names are specified instead of texture IDs.
88 static scoped_refptr<TextureLayer> CreateForMailbox( 96 static scoped_refptr<TextureLayer> CreateForMailbox(
89 const LayerSettings& settings, 97 const LayerSettings& settings,
90 TextureLayerClient* client); 98 TextureLayerClient* client);
91 99
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 bool blend_background_color_; 172 bool blend_background_color_;
165 173
166 scoped_ptr<TextureMailboxHolder::MainThreadReference> holder_ref_; 174 scoped_ptr<TextureMailboxHolder::MainThreadReference> holder_ref_;
167 bool needs_set_mailbox_; 175 bool needs_set_mailbox_;
168 176
169 DISALLOW_COPY_AND_ASSIGN(TextureLayer); 177 DISALLOW_COPY_AND_ASSIGN(TextureLayer);
170 }; 178 };
171 179
172 } // namespace cc 180 } // namespace cc
173 #endif // CC_LAYERS_TEXTURE_LAYER_H_ 181 #endif // CC_LAYERS_TEXTURE_LAYER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698