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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CC_LAYERS_DELEGATED_FRAME_RESOURCE_COLLECTION_H_
6 #define CC_LAYERS_DELEGATED_FRAME_RESOURCE_COLLECTION_H_
7
8 #include "base/containers/hash_tables.h"
9 #include "base/memory/ref_counted.h"
10 #include "base/threading/thread_checker.h"
11 #include "cc/base/cc_export.h"
12 #include "cc/resources/return_callback.h"
13 #include "cc/resources/returned_resource.h"
14 #include "cc/resources/transferable_resource.h"
15
16 namespace cc {
17 class BlockingTaskRunner;
18
19 class CC_EXPORT DelegatedFrameResourceCollectionClient {
20 public:
21 // Called to inform the client that returned resources can be
22 // grabbed off the DelegatedFrameResourceCollection.
23 virtual void UnusedResourcesAreAvailable() = 0;
24 };
25
26 class CC_EXPORT DelegatedFrameResourceCollection
27 : public base::RefCounted<DelegatedFrameResourceCollection> {
28 public:
29 DelegatedFrameResourceCollection();
30
31 void SetClient(DelegatedFrameResourceCollectionClient* client);
32
33 void TakeUnusedResourcesForChildCompositor(ReturnedResourceArray* array);
34
35 // Methods for DelegatedFrameProvider.
36 void RefResources(const TransferableResourceArray& resources);
37 void UnrefResources(const ReturnedResourceArray& returned);
38 void ReceivedResources(const TransferableResourceArray& resources);
39 ReturnCallback GetReturnResourcesCallbackForImplThread();
40
41 private:
42 friend class base::RefCounted<DelegatedFrameResourceCollection>;
43 ~DelegatedFrameResourceCollection();
44
45 void UnrefResourcesOnImplThread(
46 scoped_refptr<BlockingTaskRunner> main_thread_runner,
47 const ReturnedResourceArray& returned);
48
49 DelegatedFrameResourceCollectionClient* client_;
50 scoped_refptr<BlockingTaskRunner> main_thread_runner_;
51
52 ReturnedResourceArray returned_resources_for_child_compositor_;
53
54 struct RefCount {
55 int refs_to_return;
56 int refs_to_wait_for;
57 };
58 typedef base::hash_map<unsigned, RefCount> ResourceIdRefCountMap;
59 ResourceIdRefCountMap resource_id_ref_count_map_;
60
61 base::ThreadChecker main_thread_checker_;
62
63 DISALLOW_COPY_AND_ASSIGN(DelegatedFrameResourceCollection);
64 };
65
66 } // namespace cc
67
68 #endif // CC_LAYERS_DELEGATED_FRAME_RESOURCE_COLLECTION_H_
OLDNEW
« 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