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

Side by Side Diff: cc/tiles/image_controller.h

Issue 2847553002: cc: Replace some instances of unordered_map with base::flat_map. (Closed)
Patch Set: Created 3 years, 7 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
« cc/output/gl_renderer.h ('K') | « cc/surfaces/surface_aggregator.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_TILES_IMAGE_CONTROLLER_H_ 5 #ifndef CC_TILES_IMAGE_CONTROLLER_H_
6 #define CC_TILES_IMAGE_CONTROLLER_H_ 6 #define CC_TILES_IMAGE_CONTROLLER_H_
7 7
8 #include <set> 8 #include <set>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/containers/flat_map.h"
12 #include "base/macros.h" 13 #include "base/macros.h"
13 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
14 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
15 #include "base/threading/simple_thread.h" 16 #include "base/threading/simple_thread.h"
16 #include "cc/base/unique_notifier.h" 17 #include "cc/base/unique_notifier.h"
17 #include "cc/cc_export.h" 18 #include "cc/cc_export.h"
18 #include "cc/paint/draw_image.h" 19 #include "cc/paint/draw_image.h"
19 #include "cc/raster/tile_task.h" 20 #include "cc/raster/tile_task.h"
20 #include "cc/tiles/image_decode_cache.h" 21 #include "cc/tiles/image_decode_cache.h"
21 22
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 // Called from the worker thread. 87 // Called from the worker thread.
87 void ProcessNextImageDecodeOnWorkerThread(); 88 void ProcessNextImageDecodeOnWorkerThread();
88 89
89 void ImageDecodeCompleted(ImageDecodeRequestId id); 90 void ImageDecodeCompleted(ImageDecodeRequestId id);
90 void GenerateTasksForOrphanedRequests(); 91 void GenerateTasksForOrphanedRequests();
91 92
92 ImageDecodeCache* cache_ = nullptr; 93 ImageDecodeCache* cache_ = nullptr;
93 std::vector<DrawImage> predecode_locked_images_; 94 std::vector<DrawImage> predecode_locked_images_;
94 95
95 static ImageDecodeRequestId s_next_image_decode_queue_id_; 96 static ImageDecodeRequestId s_next_image_decode_queue_id_;
96 std::unordered_map<ImageDecodeRequestId, DrawImage> requested_locked_images_; 97 base::flat_map<ImageDecodeRequestId, DrawImage> requested_locked_images_;
97 98
98 base::SequencedTaskRunner* origin_task_runner_ = nullptr; 99 base::SequencedTaskRunner* origin_task_runner_ = nullptr;
99 100
100 // The variables defined below this lock (aside from weak_ptr_factory_) can 101 // The variables defined below this lock (aside from weak_ptr_factory_) can
101 // only be accessed when the lock is acquired. 102 // only be accessed when the lock is acquired.
102 base::Lock lock_; 103 base::Lock lock_;
103 std::map<ImageDecodeRequestId, ImageDecodeRequest> image_decode_queue_; 104 std::map<ImageDecodeRequestId, ImageDecodeRequest> image_decode_queue_;
104 std::map<ImageDecodeRequestId, ImageDecodeRequest> 105 std::map<ImageDecodeRequestId, ImageDecodeRequest>
105 requests_needing_completion_; 106 requests_needing_completion_;
106 bool abort_tasks_ = false; 107 bool abort_tasks_ = false;
107 // Orphaned requests are requests that were either in queue or needed a 108 // Orphaned requests are requests that were either in queue or needed a
108 // completion callback when we set the decode cache to be nullptr. When a new 109 // completion callback when we set the decode cache to be nullptr. When a new
109 // decode cache is set, these requests are re-enqueued again with tasks 110 // decode cache is set, these requests are re-enqueued again with tasks
110 // generated by the new cache. Note that when the cache is set, then aside 111 // generated by the new cache. Note that when the cache is set, then aside
111 // from generating new tasks, this vector should be empty. 112 // from generating new tasks, this vector should be empty.
112 std::vector<ImageDecodeRequest> orphaned_decode_requests_; 113 std::vector<ImageDecodeRequest> orphaned_decode_requests_;
113 114
114 base::WeakPtrFactory<ImageController> weak_ptr_factory_; 115 base::WeakPtrFactory<ImageController> weak_ptr_factory_;
115 116
116 DISALLOW_COPY_AND_ASSIGN(ImageController); 117 DISALLOW_COPY_AND_ASSIGN(ImageController);
117 }; 118 };
118 119
119 } // namespace cc 120 } // namespace cc
120 121
121 #endif // CC_TILES_IMAGE_CONTROLLER_H_ 122 #endif // CC_TILES_IMAGE_CONTROLLER_H_
OLDNEW
« cc/output/gl_renderer.h ('K') | « cc/surfaces/surface_aggregator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698