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

Unified Diff: cc/surfaces/surface_resource_holder.h

Issue 1531403002: Revert "Delete CC." (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 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
« no previous file with comments | « cc/surfaces/surface_manager.cc ('k') | cc/surfaces/surface_resource_holder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/surfaces/surface_resource_holder.h
diff --git a/cc/surfaces/surface_resource_holder.h b/cc/surfaces/surface_resource_holder.h
new file mode 100644
index 0000000000000000000000000000000000000000..20c9f2918489291486a178829563c0e82486534c
--- /dev/null
+++ b/cc/surfaces/surface_resource_holder.h
@@ -0,0 +1,51 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CC_SURFACES_SURFACE_RESOURCE_HOLDER_H_
+#define CC_SURFACES_SURFACE_RESOURCE_HOLDER_H_
+
+#include "base/containers/hash_tables.h"
+#include "base/macros.h"
+#include "cc/resources/resource_provider.h"
+#include "cc/resources/returned_resource.h"
+#include "cc/surfaces/surfaces_export.h"
+
+namespace cc {
+class SurfaceFactoryClient;
+
+// A SurfaceResourceHolder manages the lifetime of resources submitted by a
+// particular SurfaceFactory. Each resource is held by the service until
+// it is no longer referenced by any pending frames or by any
+// resource providers.
+class CC_SURFACES_EXPORT SurfaceResourceHolder {
+ public:
+ explicit SurfaceResourceHolder(SurfaceFactoryClient* client);
+ ~SurfaceResourceHolder();
+
+ void ReceiveFromChild(const TransferableResourceArray& resources);
+ void RefResources(const TransferableResourceArray& resources);
+ void UnrefResources(const ReturnedResourceArray& resources);
+
+ private:
+ SurfaceFactoryClient* client_;
+
+ struct ResourceRefs {
+ ResourceRefs();
+
+ int refs_received_from_child;
+ int refs_holding_resource_alive;
+ };
+ // Keeps track of the number of users currently in flight for each resource
+ // ID we've received from the client. When this counter hits zero for a
+ // particular resource, that ID is available to return to the client.
+ typedef base::hash_map<ResourceProvider::ResourceId, ResourceRefs>
+ ResourceIdCountMap;
+ ResourceIdCountMap resource_id_use_count_map_;
+
+ DISALLOW_COPY_AND_ASSIGN(SurfaceResourceHolder);
+};
+
+} // namespace cc
+
+#endif // CC_SURFACES_SURFACE_RESOURCE_HOLDER_H_
« no previous file with comments | « cc/surfaces/surface_manager.cc ('k') | cc/surfaces/surface_resource_holder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698