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

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

Issue 2050353002: Update webrtc::DesktopCapturer clients to implement OnCaptureResult(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix chromeos Created 4 years, 6 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 | « no previous file | chrome/browser/media/native_desktop_media_list_unittest.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 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"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 89
90 void Refresh(const DesktopMediaID::Id& view_dialog_id); 90 void Refresh(const DesktopMediaID::Id& view_dialog_id);
91 91
92 void RefreshThumbnails(const std::vector<DesktopMediaID>& native_ids, 92 void RefreshThumbnails(const std::vector<DesktopMediaID>& native_ids,
93 const gfx::Size& thumbnail_size); 93 const gfx::Size& thumbnail_size);
94 94
95 private: 95 private:
96 typedef std::map<DesktopMediaID, uint32_t> ImageHashesMap; 96 typedef std::map<DesktopMediaID, uint32_t> ImageHashesMap;
97 97
98 // webrtc::DesktopCapturer::Callback interface. 98 // webrtc::DesktopCapturer::Callback interface.
99 void OnCaptureCompleted(webrtc::DesktopFrame* frame) override; 99 void OnCaptureResult(webrtc::DesktopCapturer::Result result,
100 std::unique_ptr<webrtc::DesktopFrame> frame) override;
100 101
101 base::WeakPtr<NativeDesktopMediaList> media_list_; 102 base::WeakPtr<NativeDesktopMediaList> media_list_;
102 103
103 std::unique_ptr<webrtc::ScreenCapturer> screen_capturer_; 104 std::unique_ptr<webrtc::ScreenCapturer> screen_capturer_;
104 std::unique_ptr<webrtc::WindowCapturer> window_capturer_; 105 std::unique_ptr<webrtc::WindowCapturer> window_capturer_;
105 106
106 std::unique_ptr<webrtc::DesktopFrame> current_frame_; 107 std::unique_ptr<webrtc::DesktopFrame> current_frame_;
107 108
108 ImageHashesMap image_hashes_; 109 ImageHashesMap image_hashes_;
109 110
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 } 219 }
219 220
220 image_hashes_.swap(new_image_hashes); 221 image_hashes_.swap(new_image_hashes);
221 222
222 BrowserThread::PostTask( 223 BrowserThread::PostTask(
223 BrowserThread::UI, FROM_HERE, 224 BrowserThread::UI, FROM_HERE,
224 base::Bind(&NativeDesktopMediaList::UpdateNativeThumbnailsFinished, 225 base::Bind(&NativeDesktopMediaList::UpdateNativeThumbnailsFinished,
225 media_list_)); 226 media_list_));
226 } 227 }
227 228
228 void NativeDesktopMediaList::Worker::OnCaptureCompleted( 229 void NativeDesktopMediaList::Worker::OnCaptureResult(
229 webrtc::DesktopFrame* frame) { 230 webrtc::DesktopCapturer::Result result,
230 current_frame_.reset(frame); 231 std::unique_ptr<webrtc::DesktopFrame> frame) {
232 current_frame_ = std::move(frame);
231 } 233 }
232 234
233 NativeDesktopMediaList::NativeDesktopMediaList( 235 NativeDesktopMediaList::NativeDesktopMediaList(
234 std::unique_ptr<webrtc::ScreenCapturer> screen_capturer, 236 std::unique_ptr<webrtc::ScreenCapturer> screen_capturer,
235 std::unique_ptr<webrtc::WindowCapturer> window_capturer) 237 std::unique_ptr<webrtc::WindowCapturer> window_capturer)
236 : DesktopMediaListBase( 238 : DesktopMediaListBase(
237 base::TimeDelta::FromMilliseconds(kDefaultUpdatePeriod)), 239 base::TimeDelta::FromMilliseconds(kDefaultUpdatePeriod)),
238 weak_factory_(this) { 240 weak_factory_(this) {
239 base::SequencedWorkerPool* worker_pool = BrowserThread::GetBlockingPool(); 241 base::SequencedWorkerPool* worker_pool = BrowserThread::GetBlockingPool();
240 capture_task_runner_ = worker_pool->GetSequencedTaskRunner( 242 capture_task_runner_ = worker_pool->GetSequencedTaskRunner(
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 if (pending_aura_capture_requests_ == 0) { 367 if (pending_aura_capture_requests_ == 0) {
366 previous_aura_thumbnail_hashes_ = std::move(new_aura_thumbnail_hashes_); 368 previous_aura_thumbnail_hashes_ = std::move(new_aura_thumbnail_hashes_);
367 // Schedule next refresh if aura thumbnail captures finished after native 369 // Schedule next refresh if aura thumbnail captures finished after native
368 // thumbnail captures. 370 // thumbnail captures.
369 if (!pending_native_thumbnail_capture_) 371 if (!pending_native_thumbnail_capture_)
370 ScheduleNextRefresh(); 372 ScheduleNextRefresh();
371 } 373 }
372 } 374 }
373 375
374 #endif // defined(USE_AURA) 376 #endif // defined(USE_AURA)
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/media/native_desktop_media_list_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698