| OLD | NEW |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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 GPU_COMMAND_BUFFER_SERVICE_VALUEBUFFER_MANAGER_H_ | 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_VALUEBUFFER_MANAGER_H_ |
| 6 #define GPU_COMMAND_BUFFER_SERVICE_VALUEBUFFER_MANAGER_H_ | 6 #define GPU_COMMAND_BUFFER_SERVICE_VALUEBUFFER_MANAGER_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/containers/hash_tables.h" | 9 #include "base/containers/hash_tables.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/observer_list.h" | 12 #include "base/observer_list.h" |
| 13 #include "gpu/command_buffer/common/value_state.h" | 13 #include "gpu/command_buffer/common/value_state.h" |
| 14 #include "gpu/gpu_export.h" | 14 #include "gpu/gpu_export.h" |
| 15 | 15 |
| 16 namespace content { | 16 namespace content { |
| 17 class GpuChannel; | 17 class GpuChannel; |
| 18 } | 18 } |
| 19 | 19 |
| 20 namespace gpu { | 20 namespace gpu { |
| 21 namespace gles2 { | 21 namespace gles2 { |
| 22 | 22 |
| 23 class ValuebufferManager; | 23 class ValuebufferManager; |
| 24 | 24 |
| 25 // TODO(mgiuca): Avoid using UnsafeRefCounted. http://crbug.com/469952. |
| 25 class GPU_EXPORT SubscriptionRefSet | 26 class GPU_EXPORT SubscriptionRefSet |
| 26 : public base::RefCounted<SubscriptionRefSet> { | 27 : public base::UnsafeRefCounted<SubscriptionRefSet> { |
| 27 public: | 28 public: |
| 28 class GPU_EXPORT Observer { | 29 class GPU_EXPORT Observer { |
| 29 public: | 30 public: |
| 30 virtual ~Observer(); | 31 virtual ~Observer(); |
| 31 | 32 |
| 32 virtual void OnAddSubscription(unsigned int target) = 0; | 33 virtual void OnAddSubscription(unsigned int target) = 0; |
| 33 virtual void OnRemoveSubscription(unsigned int target) = 0; | 34 virtual void OnRemoveSubscription(unsigned int target) = 0; |
| 34 }; | 35 }; |
| 35 | 36 |
| 36 SubscriptionRefSet(); | 37 SubscriptionRefSet(); |
| 37 | 38 |
| 38 void AddObserver(Observer* observer); | 39 void AddObserver(Observer* observer); |
| 39 void RemoveObserver(Observer* observer); | 40 void RemoveObserver(Observer* observer); |
| 40 | 41 |
| 41 protected: | 42 protected: |
| 42 virtual ~SubscriptionRefSet(); | 43 virtual ~SubscriptionRefSet(); |
| 43 | 44 |
| 44 private: | 45 private: |
| 45 friend class base::RefCounted<SubscriptionRefSet>; | 46 friend class base::UnsafeRefCounted<SubscriptionRefSet>; |
| 46 friend class ValuebufferManager; | 47 friend class ValuebufferManager; |
| 47 | 48 |
| 48 typedef base::hash_map<unsigned int, int> RefSet; | 49 typedef base::hash_map<unsigned int, int> RefSet; |
| 49 | 50 |
| 50 void AddSubscription(unsigned int target); | 51 void AddSubscription(unsigned int target); |
| 51 void RemoveSubscription(unsigned int target); | 52 void RemoveSubscription(unsigned int target); |
| 52 | 53 |
| 53 RefSet reference_set_; | 54 RefSet reference_set_; |
| 54 | 55 |
| 55 ObserverList<Observer, true> observers_; | 56 ObserverList<Observer, true> observers_; |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 // many value buffers are currently subscribed to each | 155 // many value buffers are currently subscribed to each |
| 155 scoped_refptr<SubscriptionRefSet> subscription_ref_set_; | 156 scoped_refptr<SubscriptionRefSet> subscription_ref_set_; |
| 156 | 157 |
| 157 DISALLOW_COPY_AND_ASSIGN(ValuebufferManager); | 158 DISALLOW_COPY_AND_ASSIGN(ValuebufferManager); |
| 158 }; | 159 }; |
| 159 | 160 |
| 160 } // namespace gles2 | 161 } // namespace gles2 |
| 161 } // namespace gpu | 162 } // namespace gpu |
| 162 | 163 |
| 163 #endif // GPU_COMMAND_BUFFER_SERVICE_VALUEBUFFER_MANAGER_H_ | 164 #endif // GPU_COMMAND_BUFFER_SERVICE_VALUEBUFFER_MANAGER_H_ |
| OLD | NEW |