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

Side by Side Diff: chrome/browser/media/native_desktop_media_list.cc

Issue 1808273002: Use DesktopCaptureDeviceAura for all aura windows in Windows and Linux (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 | « chrome/browser/media/native_desktop_media_list.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 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 #include "chrome/browser/media/native_desktop_media_list.h" 5 #include "chrome/browser/media/native_desktop_media_list.h"
6 6
7 #include "base/hash.h" 7 #include "base/hash.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "base/threading/sequenced_worker_pool.h" 9 #include "base/threading/sequenced_worker_pool.h"
10 #include "chrome/browser/media/desktop_media_list_observer.h" 10 #include "chrome/browser/media/desktop_media_list_observer.h"
11 #include "chrome/browser/ui/browser.h" 11 #include "chrome/browser/ui/browser.h"
12 #include "chrome/browser/ui/browser_list.h" 12 #include "chrome/browser/ui/browser_list.h"
13 #include "chrome/browser/ui/browser_window.h" 13 #include "chrome/browser/ui/browser_window.h"
Sergey Ulanov 2016/03/18 21:09:36 Don't need to include these 3 headers anymore
GeorgeZ 2016/03/21 18:08:10 Done.
14 #include "chrome/grit/generated_resources.h" 14 #include "chrome/grit/generated_resources.h"
15 #include "content/public/browser/browser_thread.h" 15 #include "content/public/browser/browser_thread.h"
16 #include "media/base/video_util.h" 16 #include "media/base/video_util.h"
17 #include "third_party/libyuv/include/libyuv/scale_argb.h" 17 #include "third_party/libyuv/include/libyuv/scale_argb.h"
18 #include "third_party/skia/include/core/SkBitmap.h" 18 #include "third_party/skia/include/core/SkBitmap.h"
19 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" 19 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h"
20 #include "third_party/webrtc/modules/desktop_capture/screen_capturer.h" 20 #include "third_party/webrtc/modules/desktop_capture/screen_capturer.h"
21 #include "third_party/webrtc/modules/desktop_capture/window_capturer.h" 21 #include "third_party/webrtc/modules/desktop_capture/window_capturer.h"
22 #include "ui/aura/window.h" 22 #include "ui/aura/window.h"
23 #include "ui/aura/window_tree_host.h" 23 #include "ui/aura/window_tree_host.h"
24 #include "ui/base/l10n/l10n_util.h" 24 #include "ui/base/l10n/l10n_util.h"
25 #include "ui/gfx/native_widget_types.h" 25 #include "ui/gfx/native_widget_types.h"
26 #include "ui/snapshot/snapshot.h" 26 #include "ui/snapshot/snapshot.h"
27 27
28 #if defined(OS_WIN)
29 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_win.h"
30 #endif // defined(OS_WIN)
31
32 #if defined(USE_X11) && !defined(OS_CHROMEOS)
33 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h"
34 #endif // defined(USE_X11) && !defined(OS_CHROMEOS)
35
28 using content::BrowserThread; 36 using content::BrowserThread;
29 using content::DesktopMediaID; 37 using content::DesktopMediaID;
30 38
31 namespace { 39 namespace {
32 40
33 // Update the list every second. 41 // Update the list every second.
34 const int kDefaultUpdatePeriod = 1000; 42 const int kDefaultUpdatePeriod = 1000;
35 43
36 // Returns a hash of a DesktopFrame content to detect when image for a desktop 44 // Returns a hash of a DesktopFrame content to detect when image for a desktop
37 // media source has changed. 45 // media source has changed.
(...skipping 29 matching lines...) Expand all
67 pixels_data[result.rowBytes() * y + x * result.bytesPerPixel() + 3] = 75 pixels_data[result.rowBytes() * y + x * result.bytesPerPixel() + 3] =
68 0xff; 76 0xff;
69 } 77 }
70 } 78 }
71 79
72 result.unlockPixels(); 80 result.unlockPixels();
73 81
74 return gfx::ImageSkia::CreateFrom1xBitmap(result); 82 return gfx::ImageSkia::CreateFrom1xBitmap(result);
75 } 83 }
76 84
77 #if defined(USE_AURA)
78
79 NativeDesktopMediaList::NativeAuraIdMap GetBrowserNativeAuraIdMap() {
80 NativeDesktopMediaList::NativeAuraIdMap id_map;
81 for (auto* browser : *BrowserList::GetInstance()) {
82 aura::Window* aura_window = browser->window()->GetNativeWindow();
83 if (!aura_window)
84 continue;
85 aura::WindowTreeHost* host = aura_window->GetHost();
86 if (!host)
87 continue;
88 gfx::AcceleratedWidget widget = host->GetAcceleratedWidget();
89 #if defined(OS_WIN)
90 DesktopMediaID::Id native_id = reinterpret_cast<DesktopMediaID::Id>(widget);
91 #else
92 DesktopMediaID::Id native_id = widget;
93 #endif
94 DesktopMediaID media_id = DesktopMediaID::RegisterAuraWindow(
95 DesktopMediaID::TYPE_WINDOW, aura_window);
96 id_map[native_id] = media_id.aura_id;
97 }
98
99 return id_map;
100 }
101
102 #endif // defined(USE_AURA)
103
104 } // namespace 85 } // namespace
105 86
106 class NativeDesktopMediaList::Worker 87 class NativeDesktopMediaList::Worker
107 : public webrtc::DesktopCapturer::Callback { 88 : public webrtc::DesktopCapturer::Callback {
108 public: 89 public:
109 Worker(base::WeakPtr<NativeDesktopMediaList> media_list, 90 Worker(base::WeakPtr<NativeDesktopMediaList> media_list,
110 scoped_ptr<webrtc::ScreenCapturer> screen_capturer, 91 scoped_ptr<webrtc::ScreenCapturer> screen_capturer,
111 scoped_ptr<webrtc::WindowCapturer> window_capturer); 92 scoped_ptr<webrtc::WindowCapturer> window_capturer);
112 ~Worker() override; 93 ~Worker() override;
113 94
114 void Refresh(const gfx::Size& thumbnail_size, 95 void Refresh(const DesktopMediaID::Id& view_dialog_id);
115 const DesktopMediaID::Id& view_dialog_id, 96
116 const NativeAuraIdMap& native_aura_id_map); 97 void UpdateNativeThumbnails(const std::vector<SourceDescription>& sources,
Sergey Ulanov 2016/03/18 21:09:36 RefreshThumbnails.
GeorgeZ 2016/03/21 18:08:10 Done.
98 const gfx::Size& thumbnail_size);
117 99
118 private: 100 private:
119 typedef std::map<DesktopMediaID, uint32_t> ImageHashesMap; 101 typedef std::map<DesktopMediaID, uint32_t> ImageHashesMap;
120 102
121 // webrtc::DesktopCapturer::Callback interface. 103 // webrtc::DesktopCapturer::Callback interface.
122 void OnCaptureCompleted(webrtc::DesktopFrame* frame) override; 104 void OnCaptureCompleted(webrtc::DesktopFrame* frame) override;
123 105
124 base::WeakPtr<NativeDesktopMediaList> media_list_; 106 base::WeakPtr<NativeDesktopMediaList> media_list_;
125 107
126 scoped_ptr<webrtc::ScreenCapturer> screen_capturer_; 108 scoped_ptr<webrtc::ScreenCapturer> screen_capturer_;
(...skipping 15 matching lines...) Expand all
142 window_capturer_(std::move(window_capturer)) { 124 window_capturer_(std::move(window_capturer)) {
143 if (screen_capturer_) 125 if (screen_capturer_)
144 screen_capturer_->Start(this); 126 screen_capturer_->Start(this);
145 if (window_capturer_) 127 if (window_capturer_)
146 window_capturer_->Start(this); 128 window_capturer_->Start(this);
147 } 129 }
148 130
149 NativeDesktopMediaList::Worker::~Worker() {} 131 NativeDesktopMediaList::Worker::~Worker() {}
150 132
151 void NativeDesktopMediaList::Worker::Refresh( 133 void NativeDesktopMediaList::Worker::Refresh(
152 const gfx::Size& thumbnail_size, 134 const DesktopMediaID::Id& view_dialog_id) {
153 const DesktopMediaID::Id& view_dialog_id,
154 const NativeAuraIdMap& native_aura_id_map) {
155 std::vector<SourceDescription> sources; 135 std::vector<SourceDescription> sources;
156 std::vector<DesktopMediaID> aura_media_ids;
157 136
158 if (screen_capturer_) { 137 if (screen_capturer_) {
159 webrtc::ScreenCapturer::ScreenList screens; 138 webrtc::ScreenCapturer::ScreenList screens;
160 if (screen_capturer_->GetScreenList(&screens)) { 139 if (screen_capturer_->GetScreenList(&screens)) {
161 bool mutiple_screens = screens.size() > 1; 140 bool mutiple_screens = screens.size() > 1;
162 base::string16 title; 141 base::string16 title;
163 for (size_t i = 0; i < screens.size(); ++i) { 142 for (size_t i = 0; i < screens.size(); ++i) {
164 if (mutiple_screens) { 143 if (mutiple_screens) {
165 title = l10n_util::GetStringFUTF16Int( 144 title = l10n_util::GetStringFUTF16Int(
166 IDS_DESKTOP_MEDIA_PICKER_MULTIPLE_SCREEN_NAME, 145 IDS_DESKTOP_MEDIA_PICKER_MULTIPLE_SCREEN_NAME,
167 static_cast<int>(i + 1)); 146 static_cast<int>(i + 1));
168 } else { 147 } else {
169 title = l10n_util::GetStringUTF16( 148 title = l10n_util::GetStringUTF16(
170 IDS_DESKTOP_MEDIA_PICKER_SINGLE_SCREEN_NAME); 149 IDS_DESKTOP_MEDIA_PICKER_SINGLE_SCREEN_NAME);
171 } 150 }
172 sources.push_back(SourceDescription(DesktopMediaID( 151 sources.push_back(SourceDescription(DesktopMediaID(
173 DesktopMediaID::TYPE_SCREEN, screens[i].id), title)); 152 DesktopMediaID::TYPE_SCREEN, screens[i].id), title));
174 } 153 }
175 } 154 }
176 } 155 }
177 156
178 if (window_capturer_) { 157 if (window_capturer_) {
179 webrtc::WindowCapturer::WindowList windows; 158 webrtc::WindowCapturer::WindowList windows;
180 if (window_capturer_->GetWindowList(&windows)) { 159 if (window_capturer_->GetWindowList(&windows)) {
181 for (webrtc::WindowCapturer::WindowList::iterator it = windows.begin(); 160 for (webrtc::WindowCapturer::WindowList::iterator it = windows.begin();
182 it != windows.end(); ++it) { 161 it != windows.end(); ++it) {
183 // Skip the picker dialog window. 162 // Skip the picker dialog window.
184 if (it->id != view_dialog_id) { 163 if (it->id == view_dialog_id)
185 DesktopMediaID media_id(DesktopMediaID::TYPE_WINDOW, it->id); 164 continue;
186 #if defined(USE_AURA) 165
187 // Associate aura id with native id. 166 DesktopMediaID media_id(DesktopMediaID::TYPE_WINDOW, it->id);
188 auto aura_id = native_aura_id_map.find(media_id.id); 167 sources.push_back(
189 if (aura_id != native_aura_id_map.end()) { 168 SourceDescription(media_id, base::UTF8ToUTF16(it->title)));
190 media_id.aura_id = aura_id->second;
191 aura_media_ids.push_back(media_id);
192 }
193 #endif
194 sources.push_back(
195 SourceDescription(media_id, base::UTF8ToUTF16(it->title)));
196 }
197 } 169 }
198 } 170 }
199 } 171 }
200 172
201 // Update list of windows before updating thumbnails. 173 BrowserThread::PostTask(
202 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, 174 BrowserThread::UI, FROM_HERE,
203 base::Bind(&NativeDesktopMediaList::UpdateSourcesList, 175 base::Bind(&NativeDesktopMediaList::RefreshForAuraWindows, media_list_,
204 media_list_, sources)); 176 sources));
177 }
205 178
179 void NativeDesktopMediaList::Worker::UpdateNativeThumbnails(
180 const std::vector<SourceDescription>& sources,
181 const gfx::Size& thumbnail_size) {
206 ImageHashesMap new_image_hashes; 182 ImageHashesMap new_image_hashes;
207 183
208 // Get a thumbnail for each source. 184 // Get a thumbnail for each source.
209 for (size_t i = 0; i < sources.size(); ++i) { 185 for (const auto& source : sources) {
210 SourceDescription& source = sources[i];
211
212 switch (source.id.type) { 186 switch (source.id.type) {
213 case DesktopMediaID::TYPE_SCREEN: 187 case DesktopMediaID::TYPE_SCREEN:
214 if (!screen_capturer_->SelectScreen(source.id.id)) 188 if (!screen_capturer_->SelectScreen(source.id.id))
215 continue; 189 continue;
216 screen_capturer_->Capture(webrtc::DesktopRegion()); 190 screen_capturer_->Capture(webrtc::DesktopRegion());
217 break; 191 break;
218 192
219 case DesktopMediaID::TYPE_WINDOW: 193 case DesktopMediaID::TYPE_WINDOW:
220 #if defined(USE_AURA) 194 #if defined(USE_AURA)
221 // Aura window thumbmail capture is skipped here. It will be done 195 // Aura window thumbmail capture is already launched in the UI thread.
222 // asynchronously in the UI thread.
223 if (source.id.aura_id > DesktopMediaID::kNullId) 196 if (source.id.aura_id > DesktopMediaID::kNullId)
224 continue; 197 continue;
225 #endif 198 #endif // defined(USE_AURA)
226 if (!window_capturer_->SelectWindow(source.id.id)) 199 if (!window_capturer_->SelectWindow(source.id.id))
227 continue; 200 continue;
228 window_capturer_->Capture(webrtc::DesktopRegion()); 201 window_capturer_->Capture(webrtc::DesktopRegion());
229 break; 202 break;
230 203
231 default: 204 default:
232 NOTREACHED(); 205 NOTREACHED();
233 } 206 }
234 207
235 // Expect that DesktopCapturer to always captures frames synchronously. 208 // Expect that DesktopCapturer to always captures frames synchronously.
236 // |current_frame_| may be NULL if capture failed (e.g. because window has 209 // |current_frame_| may be NULL if capture failed (e.g. because window has
237 // been closed). 210 // been closed).
238 if (current_frame_) { 211 if (current_frame_) {
239 uint32_t frame_hash = GetFrameHash(current_frame_.get()); 212 uint32_t frame_hash = GetFrameHash(current_frame_.get());
240 new_image_hashes[source.id] = frame_hash; 213 new_image_hashes[source.id] = frame_hash;
241 214
242 // Scale the image only if it has changed. 215 // Scale the image only if it has changed.
243 ImageHashesMap::iterator it = image_hashes_.find(source.id); 216 ImageHashesMap::iterator it = image_hashes_.find(source.id);
244 if (it == image_hashes_.end() || it->second != frame_hash) { 217 if (it == image_hashes_.end() || it->second != frame_hash) {
245 gfx::ImageSkia thumbnail = 218 gfx::ImageSkia thumbnail =
246 ScaleDesktopFrame(std::move(current_frame_), thumbnail_size); 219 ScaleDesktopFrame(std::move(current_frame_), thumbnail_size);
247 BrowserThread::PostTask( 220 BrowserThread::PostTask(
248 BrowserThread::UI, FROM_HERE, 221 BrowserThread::UI, FROM_HERE,
249 base::Bind(&NativeDesktopMediaList::OnSourceThumbnailCaptured, 222 base::Bind(&NativeDesktopMediaList::UpdateSourceThumbnail,
250 media_list_, i, thumbnail)); 223 media_list_, source.id, thumbnail));
251 } 224 }
252 } 225 }
253 } 226 }
254 227
255 image_hashes_.swap(new_image_hashes); 228 image_hashes_.swap(new_image_hashes);
256 229
257 // Aura thumbnail captures have to be done in UI thread. After they are done,
258 // a refresh will be scheduled.
259 BrowserThread::PostTask( 230 BrowserThread::PostTask(
260 BrowserThread::UI, FROM_HERE, 231 BrowserThread::UI, FROM_HERE,
261 base::Bind( 232 base::Bind(&NativeDesktopMediaList::UpdateNativeThumbnailsFinished,
262 &NativeDesktopMediaList::FinishRefreshOnUiThreadAndScheduleNext, 233 media_list_));
263 media_list_, aura_media_ids));
264 } 234 }
265 235
266 void NativeDesktopMediaList::Worker::OnCaptureCompleted( 236 void NativeDesktopMediaList::Worker::OnCaptureCompleted(
267 webrtc::DesktopFrame* frame) { 237 webrtc::DesktopFrame* frame) {
268 current_frame_.reset(frame); 238 current_frame_.reset(frame);
269 } 239 }
270 240
271 NativeDesktopMediaList::NativeDesktopMediaList( 241 NativeDesktopMediaList::NativeDesktopMediaList(
272 scoped_ptr<webrtc::ScreenCapturer> screen_capturer, 242 scoped_ptr<webrtc::ScreenCapturer> screen_capturer,
273 scoped_ptr<webrtc::WindowCapturer> window_capturer) 243 scoped_ptr<webrtc::WindowCapturer> window_capturer)
274 : DesktopMediaListBase( 244 : DesktopMediaListBase(
275 base::TimeDelta::FromMilliseconds(kDefaultUpdatePeriod)), 245 base::TimeDelta::FromMilliseconds(kDefaultUpdatePeriod)),
276 weak_factory_(this) { 246 weak_factory_(this) {
277 base::SequencedWorkerPool* worker_pool = BrowserThread::GetBlockingPool(); 247 base::SequencedWorkerPool* worker_pool = BrowserThread::GetBlockingPool();
278 capture_task_runner_ = worker_pool->GetSequencedTaskRunner( 248 capture_task_runner_ = worker_pool->GetSequencedTaskRunner(
279 worker_pool->GetSequenceToken()); 249 worker_pool->GetSequenceToken());
280 250
281 worker_.reset(new Worker(weak_factory_.GetWeakPtr(), 251 worker_.reset(new Worker(weak_factory_.GetWeakPtr(),
282 std::move(screen_capturer), 252 std::move(screen_capturer),
283 std::move(window_capturer))); 253 std::move(window_capturer)));
284 } 254 }
285 255
286 NativeDesktopMediaList::~NativeDesktopMediaList() { 256 NativeDesktopMediaList::~NativeDesktopMediaList() {
287 capture_task_runner_->DeleteSoon(FROM_HERE, worker_.release()); 257 capture_task_runner_->DeleteSoon(FROM_HERE, worker_.release());
288 } 258 }
289 259
290 void NativeDesktopMediaList::Refresh() { 260 void NativeDesktopMediaList::Refresh() {
291 NativeAuraIdMap native_aura_id_map;
292 #if defined(USE_AURA) 261 #if defined(USE_AURA)
293 native_aura_id_map = GetBrowserNativeAuraIdMap();
294 pending_aura_capture_requests_ = 0; 262 pending_aura_capture_requests_ = 0;
295 new_aura_thumbnail_hashes_.clear(); 263 new_aura_thumbnail_hashes_.clear();
264 native_thumbnail_capture_completed = false;
296 #endif 265 #endif
297 266
298 capture_task_runner_->PostTask( 267 capture_task_runner_->PostTask(
299 FROM_HERE, 268 FROM_HERE, base::Bind(&Worker::Refresh, base::Unretained(worker_.get()),
300 base::Bind(&Worker::Refresh, base::Unretained(worker_.get()), 269 view_dialog_id_.id));
301 thumbnail_size_, view_dialog_id_.id, native_aura_id_map));
302 } 270 }
303 271
304 void NativeDesktopMediaList::OnSourceThumbnailCaptured( 272 void NativeDesktopMediaList::RefreshForAuraWindows(
305 int index, 273 std::vector<SourceDescription> sources) {
306 const gfx::ImageSkia& image) { 274 #if defined(USE_AURA)
307 UpdateSourceThumbnail(GetSource(index).id, image); 275 for (auto& source : sources) {
276 aura::Window* aura_window = NULL;
277 #if defined(OS_WIN)
278 aura_window = views::DesktopWindowTreeHostWin::GetContentWindowForHWND(
279 reinterpret_cast<HWND>(source.id.id));
280 #endif // defined(OS_WIN)
281 #if defined(USE_X11) && !defined(OS_CHROMEOS)
Sergey Ulanov 2016/03/18 21:09:36 #elif
GeorgeZ 2016/03/21 18:08:10 Done.
282 aura_window =
283 views::DesktopWindowTreeHostX11::GetContentWindowForXID(source.id.id);
284 #endif // defined(USE_X11) && !defined(OS_CHROMEOS)
285 // Associate aura id with native id.
286 if (aura_window) {
287 DesktopMediaID aura_id = DesktopMediaID::RegisterAuraWindow(
288 DesktopMediaID::TYPE_WINDOW, aura_window);
289 source.id.aura_id = aura_id.aura_id;
290 }
291 }
292 #endif // defined(USE_AURA)
293
294 UpdateSourcesList(sources);
295
296 #if defined(USE_AURA)
297 for (const auto& source : sources) {
298 if (source.id.aura_id > DesktopMediaID::kNullId)
Sergey Ulanov 2016/03/18 21:09:36 Currently both this and Worker::UpdateNativeThumbn
GeorgeZ 2016/03/21 18:08:10 Done.
299 CaptureAuraWindowThumbnail(source.id);
300 }
301 #endif // defined(USE_AURA)
302
303 capture_task_runner_->PostTask(
304 FROM_HERE,
305 base::Bind(&Worker::UpdateNativeThumbnails,
306 base::Unretained(worker_.get()), sources, thumbnail_size_));
308 } 307 }
309 308
310 void NativeDesktopMediaList::FinishRefreshOnUiThreadAndScheduleNext( 309 void NativeDesktopMediaList::UpdateNativeThumbnailsFinished() {
311 const std::vector<DesktopMediaID>& aura_ids) { 310 #if defined(USE_AURA)
312 // Schedule a refresh here when there is no aura thumbanil capture or schedule 311 native_thumbnail_capture_completed = true;
313 // a refresh in OnAuraThumbnailCaptured() after all aura thumbnails are 312 // Schedule next refresh if native thumbnail captures finished after aura
314 // captured. 313 // thumbnail captures.
315 if (aura_ids.size() == 0) { 314 if (pending_aura_capture_requests_ == 0)
316 ScheduleNextRefresh(); 315 ScheduleNextRefresh();
317 return; 316 #else
318 } 317 ScheduleNextRefresh();
319 318 #endif // defined(USE_AURA)
320 #if defined(USE_AURA)
321 DCHECK_EQ(pending_aura_capture_requests_, 0);
322 for (const auto& aura_id : aura_ids) {
323 CaptureAuraWindowThumbnail(aura_id);
324 }
325 #endif
326 } 319 }
327 320
328 #if defined(USE_AURA) 321 #if defined(USE_AURA)
329 322
330 void NativeDesktopMediaList::CaptureAuraWindowThumbnail( 323 void NativeDesktopMediaList::CaptureAuraWindowThumbnail(
331 const DesktopMediaID& id) { 324 const DesktopMediaID& id) {
332 gfx::NativeWindow window = DesktopMediaID::GetAuraWindowById(id); 325 gfx::NativeWindow window = DesktopMediaID::GetAuraWindowById(id);
333 if (!window) 326 if (!window)
334 return; 327 return;
335 328
(...skipping 17 matching lines...) Expand all
353 previous_aura_thumbnail_hashes_[id] != new_aura_thumbnail_hashes_[id]) { 346 previous_aura_thumbnail_hashes_[id] != new_aura_thumbnail_hashes_[id]) {
354 UpdateSourceThumbnail(id, image.AsImageSkia()); 347 UpdateSourceThumbnail(id, image.AsImageSkia());
355 } 348 }
356 } 349 }
357 350
358 // After all aura windows are processed, schedule next refresh; 351 // After all aura windows are processed, schedule next refresh;
359 pending_aura_capture_requests_--; 352 pending_aura_capture_requests_--;
360 DCHECK_GE(pending_aura_capture_requests_, 0); 353 DCHECK_GE(pending_aura_capture_requests_, 0);
361 if (pending_aura_capture_requests_ == 0) { 354 if (pending_aura_capture_requests_ == 0) {
362 previous_aura_thumbnail_hashes_ = std::move(new_aura_thumbnail_hashes_); 355 previous_aura_thumbnail_hashes_ = std::move(new_aura_thumbnail_hashes_);
363 ScheduleNextRefresh(); 356 // Schedule next refresh if aura thumbnail captures finished after native
357 // thumbnail captures.
358 if (native_thumbnail_capture_completed)
359 ScheduleNextRefresh();
364 } 360 }
365 } 361 }
366 362
367 #endif // defined(USE_AURA) 363 #endif // defined(USE_AURA)
OLDNEW
« no previous file with comments | « chrome/browser/media/native_desktop_media_list.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698