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

Unified Diff: cc/layers/delegated_frame_resource_collection.h

Issue 26023004: aura: Allow delegated frames to be used by more than one impl layer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: frameprovider: are_layers_attached checks Created 7 years, 2 months 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/layers/delegated_frame_provider_unittest.cc ('k') | cc/layers/delegated_frame_resource_collection.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/delegated_frame_resource_collection.h
diff --git a/cc/layers/delegated_frame_resource_collection.h b/cc/layers/delegated_frame_resource_collection.h
new file mode 100644
index 0000000000000000000000000000000000000000..f5d4a4d16778cd23a197cf8184597ccc19012411
--- /dev/null
+++ b/cc/layers/delegated_frame_resource_collection.h
@@ -0,0 +1,68 @@
+// Copyright 2013 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_LAYERS_DELEGATED_FRAME_RESOURCE_COLLECTION_H_
+#define CC_LAYERS_DELEGATED_FRAME_RESOURCE_COLLECTION_H_
+
+#include "base/containers/hash_tables.h"
+#include "base/memory/ref_counted.h"
+#include "base/threading/thread_checker.h"
+#include "cc/base/cc_export.h"
+#include "cc/resources/return_callback.h"
+#include "cc/resources/returned_resource.h"
+#include "cc/resources/transferable_resource.h"
+
+namespace cc {
+class BlockingTaskRunner;
+
+class CC_EXPORT DelegatedFrameResourceCollectionClient {
+ public:
+ // Called to inform the client that returned resources can be
+ // grabbed off the DelegatedFrameResourceCollection.
+ virtual void UnusedResourcesAreAvailable() = 0;
+};
+
+class CC_EXPORT DelegatedFrameResourceCollection
+ : public base::RefCounted<DelegatedFrameResourceCollection> {
+ public:
+ DelegatedFrameResourceCollection();
+
+ void SetClient(DelegatedFrameResourceCollectionClient* client);
+
+ void TakeUnusedResourcesForChildCompositor(ReturnedResourceArray* array);
+
+ // Methods for DelegatedFrameProvider.
+ void RefResources(const TransferableResourceArray& resources);
+ void UnrefResources(const ReturnedResourceArray& returned);
+ void ReceivedResources(const TransferableResourceArray& resources);
+ ReturnCallback GetReturnResourcesCallbackForImplThread();
+
+ private:
+ friend class base::RefCounted<DelegatedFrameResourceCollection>;
+ ~DelegatedFrameResourceCollection();
+
+ void UnrefResourcesOnImplThread(
+ scoped_refptr<BlockingTaskRunner> main_thread_runner,
+ const ReturnedResourceArray& returned);
+
+ DelegatedFrameResourceCollectionClient* client_;
+ scoped_refptr<BlockingTaskRunner> main_thread_runner_;
+
+ ReturnedResourceArray returned_resources_for_child_compositor_;
+
+ struct RefCount {
+ int refs_to_return;
+ int refs_to_wait_for;
+ };
+ typedef base::hash_map<unsigned, RefCount> ResourceIdRefCountMap;
+ ResourceIdRefCountMap resource_id_ref_count_map_;
+
+ base::ThreadChecker main_thread_checker_;
+
+ DISALLOW_COPY_AND_ASSIGN(DelegatedFrameResourceCollection);
+};
+
+} // namespace cc
+
+#endif // CC_LAYERS_DELEGATED_FRAME_RESOURCE_COLLECTION_H_
« no previous file with comments | « cc/layers/delegated_frame_provider_unittest.cc ('k') | cc/layers/delegated_frame_resource_collection.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698