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

Side by Side Diff: cc/layers/delegated_frame_resource_collection.h

Issue 485043003: cc: Use correct message loop proxy in BlockingTaskRunner (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Help gn deal with it. Created 6 years, 3 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
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 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 CC_LAYERS_DELEGATED_FRAME_RESOURCE_COLLECTION_H_ 5 #ifndef CC_LAYERS_DELEGATED_FRAME_RESOURCE_COLLECTION_H_
6 #define CC_LAYERS_DELEGATED_FRAME_RESOURCE_COLLECTION_H_ 6 #define CC_LAYERS_DELEGATED_FRAME_RESOURCE_COLLECTION_H_
7 7
8 #include "base/containers/hash_tables.h" 8 #include "base/containers/hash_tables.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
11 #include "base/threading/thread_checker.h" 11 #include "base/threading/thread_checker.h"
12 #include "cc/base/cc_export.h" 12 #include "cc/base/cc_export.h"
13 #include "cc/resources/return_callback.h" 13 #include "cc/resources/return_callback.h"
14 #include "cc/resources/returned_resource.h" 14 #include "cc/resources/returned_resource.h"
15 #include "cc/resources/transferable_resource.h" 15 #include "cc/resources/transferable_resource.h"
16 16
17 namespace cc { 17 namespace cc {
18 class BlockingTaskRunner;
19 18
20 class CC_EXPORT DelegatedFrameResourceCollectionClient { 19 class CC_EXPORT DelegatedFrameResourceCollectionClient {
21 public: 20 public:
22 // Called to inform the client that returned resources can be 21 // Called to inform the client that returned resources can be
23 // grabbed off the DelegatedFrameResourceCollection. 22 // grabbed off the DelegatedFrameResourceCollection.
24 virtual void UnusedResourcesAreAvailable() = 0; 23 virtual void UnusedResourcesAreAvailable() = 0;
25 }; 24 };
26 25
27 class CC_EXPORT DelegatedFrameResourceCollection 26 class CC_EXPORT DelegatedFrameResourceCollection
28 : public base::RefCounted<DelegatedFrameResourceCollection> { 27 : public base::RefCounted<DelegatedFrameResourceCollection> {
(...skipping 12 matching lines...) Expand all
41 void RefResources(const TransferableResourceArray& resources); 40 void RefResources(const TransferableResourceArray& resources);
42 void UnrefResources(const ReturnedResourceArray& returned); 41 void UnrefResources(const ReturnedResourceArray& returned);
43 void ReceivedResources(const TransferableResourceArray& resources); 42 void ReceivedResources(const TransferableResourceArray& resources);
44 ReturnCallback GetReturnResourcesCallbackForImplThread(); 43 ReturnCallback GetReturnResourcesCallbackForImplThread();
45 44
46 private: 45 private:
47 friend class base::RefCounted<DelegatedFrameResourceCollection>; 46 friend class base::RefCounted<DelegatedFrameResourceCollection>;
48 ~DelegatedFrameResourceCollection(); 47 ~DelegatedFrameResourceCollection();
49 48
50 DelegatedFrameResourceCollectionClient* client_; 49 DelegatedFrameResourceCollectionClient* client_;
51 scoped_refptr<BlockingTaskRunner> main_thread_runner_;
52 50
53 ReturnedResourceArray returned_resources_for_child_compositor_; 51 ReturnedResourceArray returned_resources_for_child_compositor_;
54 bool lost_all_resources_; 52 bool lost_all_resources_;
55 53
56 struct RefCount { 54 struct RefCount {
57 int refs_to_return; 55 int refs_to_return;
58 int refs_to_wait_for; 56 int refs_to_wait_for;
59 }; 57 };
60 typedef base::hash_map<unsigned, RefCount> ResourceIdRefCountMap; 58 typedef base::hash_map<unsigned, RefCount> ResourceIdRefCountMap;
61 ResourceIdRefCountMap resource_id_ref_count_map_; 59 ResourceIdRefCountMap resource_id_ref_count_map_;
62 60
63 base::ThreadChecker main_thread_checker_; 61 base::ThreadChecker main_thread_checker_;
64 base::WeakPtrFactory<DelegatedFrameResourceCollection> weak_ptr_factory_; 62 base::WeakPtrFactory<DelegatedFrameResourceCollection> weak_ptr_factory_;
65 63
66 DISALLOW_COPY_AND_ASSIGN(DelegatedFrameResourceCollection); 64 DISALLOW_COPY_AND_ASSIGN(DelegatedFrameResourceCollection);
67 }; 65 };
68 66
69 } // namespace cc 67 } // namespace cc
70 68
71 #endif // CC_LAYERS_DELEGATED_FRAME_RESOURCE_COLLECTION_H_ 69 #endif // CC_LAYERS_DELEGATED_FRAME_RESOURCE_COLLECTION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698