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

Unified Diff: gpu/command_buffer/service/valuebuffer_manager.h

Issue 816543004: Update from https://crrev.com/308996 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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 side-by-side diff with in-line comments
Download patch
Index: gpu/command_buffer/service/valuebuffer_manager.h
diff --git a/gpu/command_buffer/service/valuebuffer_manager.h b/gpu/command_buffer/service/valuebuffer_manager.h
index 022bf411cc434133d994fe445d3bb2cf16597f91..d67616a104b208048f5acc8ec53b3daaeea19b02 100644
--- a/gpu/command_buffer/service/valuebuffer_manager.h
+++ b/gpu/command_buffer/service/valuebuffer_manager.h
@@ -9,14 +9,54 @@
#include "base/containers/hash_tables.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
+#include "base/observer_list.h"
#include "gpu/command_buffer/common/value_state.h"
#include "gpu/gpu_export.h"
+namespace content {
+class GpuChannel;
+}
+
namespace gpu {
namespace gles2 {
class ValuebufferManager;
+class GPU_EXPORT SubscriptionRefSet
+ : public base::RefCounted<SubscriptionRefSet> {
+ public:
+ class GPU_EXPORT Observer {
+ public:
+ virtual ~Observer();
+
+ virtual void OnAddSubscription(unsigned int target) = 0;
+ virtual void OnRemoveSubscription(unsigned int target) = 0;
+ };
+
+ SubscriptionRefSet();
+
+ void AddObserver(Observer* observer);
+ void RemoveObserver(Observer* observer);
+
+ protected:
+ virtual ~SubscriptionRefSet();
+
+ private:
+ friend class base::RefCounted<SubscriptionRefSet>;
+ friend class ValuebufferManager;
+
+ typedef base::hash_map<unsigned int, int> RefSet;
+
+ void AddSubscription(unsigned int target);
+ void RemoveSubscription(unsigned int target);
+
+ RefSet reference_set_;
+
+ ObserverList<Observer, true> observers_;
+
+ DISALLOW_COPY_AND_ASSIGN(SubscriptionRefSet);
+};
+
class GPU_EXPORT Valuebuffer : public base::RefCounted<Valuebuffer> {
public:
Valuebuffer(ValuebufferManager* manager, unsigned int client_id);
@@ -67,7 +107,7 @@ class GPU_EXPORT Valuebuffer : public base::RefCounted<Valuebuffer> {
class GPU_EXPORT ValuebufferManager {
public:
- ValuebufferManager(ValueStateMap* state_map);
+ ValuebufferManager(SubscriptionRefSet* ref_set, ValueStateMap* state_map);
~ValuebufferManager();
// Must call before destruction.
@@ -96,6 +136,9 @@ class GPU_EXPORT ValuebufferManager {
void StartTracking(Valuebuffer* valuebuffer);
void StopTracking(Valuebuffer* valuebuffer);
+ void NotifyAddSubscription(unsigned int target);
+ void NotifyRemoveSubscription(unsigned int target);
+
// Counts the number of Valuebuffer allocated with 'this' as its manager.
// Allows to check no Valuebuffer will outlive this.
unsigned int valuebuffer_count_;
@@ -107,6 +150,10 @@ class GPU_EXPORT ValuebufferManager {
// Updated by GpuChannel
scoped_refptr<ValueStateMap> pending_state_map_;
+ // Subscription targets which are currently subscribed and how
+ // many value buffers are currently subscribed to each
+ scoped_refptr<SubscriptionRefSet> subscription_ref_set_;
+
DISALLOW_COPY_AND_ASSIGN(ValuebufferManager);
};
« no previous file with comments | « gpu/command_buffer/service/texture_manager_unittest.cc ('k') | gpu/command_buffer/service/valuebuffer_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698