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

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

Issue 2718243002: cc: Regenerate image decode requests tasks when cache switches. (Closed)
Patch Set: update Created 3 years, 9 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
« no previous file with comments | « cc/tiles/decoded_image_tracker_unittest.cc ('k') | cc/tiles/image_controller.cc » ('j') | 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
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 scoped_refptr<TileTask> task; 79 scoped_refptr<TileTask> task;
80 bool need_unref; 80 bool need_unref;
81 }; 81 };
82 82
83 void StopWorkerTasks(); 83 void StopWorkerTasks();
84 84
85 // Called from the worker thread. 85 // Called from the worker thread.
86 void ProcessNextImageDecodeOnWorkerThread(); 86 void ProcessNextImageDecodeOnWorkerThread();
87 87
88 void ImageDecodeCompleted(ImageDecodeRequestId id); 88 void ImageDecodeCompleted(ImageDecodeRequestId id);
89 void GenerateTasksForOrphanedRequests();
89 90
90 ImageDecodeCache* cache_ = nullptr; 91 ImageDecodeCache* cache_ = nullptr;
91 std::vector<DrawImage> predecode_locked_images_; 92 std::vector<DrawImage> predecode_locked_images_;
92 93
93 static ImageDecodeRequestId s_next_image_decode_queue_id_; 94 static ImageDecodeRequestId s_next_image_decode_queue_id_;
94 std::unordered_map<ImageDecodeRequestId, DrawImage> requested_locked_images_; 95 std::unordered_map<ImageDecodeRequestId, DrawImage> requested_locked_images_;
95 96
96 base::SequencedTaskRunner* origin_task_runner_ = nullptr; 97 base::SequencedTaskRunner* origin_task_runner_ = nullptr;
97 98
98 // The variables defined below this lock (aside from weak_ptr_factory_) can 99 // The variables defined below this lock (aside from weak_ptr_factory_) can
99 // only be accessed when the lock is acquired. 100 // only be accessed when the lock is acquired.
100 base::Lock lock_; 101 base::Lock lock_;
101 std::map<ImageDecodeRequestId, ImageDecodeRequest> image_decode_queue_; 102 std::map<ImageDecodeRequestId, ImageDecodeRequest> image_decode_queue_;
102 std::map<ImageDecodeRequestId, ImageDecodeRequest> 103 std::map<ImageDecodeRequestId, ImageDecodeRequest>
103 requests_needing_completion_; 104 requests_needing_completion_;
104 bool abort_tasks_ = false; 105 bool abort_tasks_ = false;
106 // Orphaned requests are requests that were either in queue or needed a
107 // completion callback when we set the decode cache to be nullptr. When a new
108 // decode cache is set, these requests are re-enqueued again with tasks
109 // generated by the new cache. Note that when the cache is set, then aside
110 // from generating new tasks, this vector should be empty.
111 std::vector<ImageDecodeRequest> orphaned_decode_requests_;
105 112
106 base::WeakPtrFactory<ImageController> weak_ptr_factory_; 113 base::WeakPtrFactory<ImageController> weak_ptr_factory_;
107 114
108 DISALLOW_COPY_AND_ASSIGN(ImageController); 115 DISALLOW_COPY_AND_ASSIGN(ImageController);
109 }; 116 };
110 117
111 } // namespace cc 118 } // namespace cc
112 119
113 #endif // CC_TILES_IMAGE_CONTROLLER_H_ 120 #endif // CC_TILES_IMAGE_CONTROLLER_H_
OLDNEW
« no previous file with comments | « cc/tiles/decoded_image_tracker_unittest.cc ('k') | cc/tiles/image_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698