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

Side by Side Diff: content/browser/media/capture/desktop_capture_device_aura.cc

Issue 462173002: Fix set_area sizes for RequestCopyOfOutput, and related tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: RWHVBrowserTest changes, per danakj's comments. Disabled tests on Windows. Created 6 years, 4 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 #include "content/browser/media/capture/desktop_capture_device_aura.h" 5 #include "content/browser/media/capture/desktop_capture_device_aura.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/timer/timer.h" 9 #include "base/timer/timer.h"
10 #include "cc/output/copy_output_request.h" 10 #include "cc/output/copy_output_request.h"
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 238
239 started_ = false; 239 started_ = false;
240 240
241 callback.Run(); 241 callback.Run();
242 } 242 }
243 243
244 void DesktopVideoCaptureMachine::UpdateCaptureSize() { 244 void DesktopVideoCaptureMachine::UpdateCaptureSize() {
245 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 245 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
246 if (oracle_proxy_ && desktop_window_) { 246 if (oracle_proxy_ && desktop_window_) {
247 ui::Layer* layer = desktop_window_->layer(); 247 ui::Layer* layer = desktop_window_->layer();
248 oracle_proxy_->UpdateCaptureSize(ui::ConvertSizeToPixel( 248 oracle_proxy_->UpdateCaptureSize(ui::ConvertSizeToPixel(
miu 2014/08/13 18:11:10 (This change was due to a rebase.)
249 layer, layer->bounds().size())); 249 layer, layer->bounds().size()));
250 } 250 }
251 ClearCursorState(); 251 ClearCursorState();
252 } 252 }
253 253
254 void DesktopVideoCaptureMachine::Capture(bool dirty) { 254 void DesktopVideoCaptureMachine::Capture(bool dirty) {
255 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 255 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
256 256
257 // Do not capture if the desktop window is already destroyed. 257 // Do not capture if the desktop window is already destroyed.
258 if (!desktop_window_) 258 if (!desktop_window_)
259 return; 259 return;
260 260
261 scoped_refptr<media::VideoFrame> frame; 261 scoped_refptr<media::VideoFrame> frame;
262 ThreadSafeCaptureOracle::CaptureFrameCallback capture_frame_cb; 262 ThreadSafeCaptureOracle::CaptureFrameCallback capture_frame_cb;
263 263
264 const base::TimeTicks start_time = base::TimeTicks::Now(); 264 const base::TimeTicks start_time = base::TimeTicks::Now();
265 const VideoCaptureOracle::Event event = 265 const VideoCaptureOracle::Event event =
266 dirty ? VideoCaptureOracle::kCompositorUpdate 266 dirty ? VideoCaptureOracle::kCompositorUpdate
267 : VideoCaptureOracle::kTimerPoll; 267 : VideoCaptureOracle::kTimerPoll;
268 if (oracle_proxy_->ObserveEventAndDecideCapture( 268 if (oracle_proxy_->ObserveEventAndDecideCapture(
269 event, gfx::Rect(), start_time, &frame, &capture_frame_cb)) { 269 event, gfx::Rect(), start_time, &frame, &capture_frame_cb)) {
270 scoped_ptr<cc::CopyOutputRequest> request = 270 scoped_ptr<cc::CopyOutputRequest> request =
271 cc::CopyOutputRequest::CreateRequest( 271 cc::CopyOutputRequest::CreateRequest(
272 base::Bind(&DesktopVideoCaptureMachine::DidCopyOutput, 272 base::Bind(&DesktopVideoCaptureMachine::DidCopyOutput,
273 AsWeakPtr(), frame, start_time, capture_frame_cb)); 273 AsWeakPtr(), frame, start_time, capture_frame_cb));
274 gfx::Rect window_rect = 274 gfx::Rect window_rect = gfx::Rect(desktop_window_->bounds().width(),
275 ui::ConvertRectToPixel(desktop_window_->layer(), 275 desktop_window_->bounds().height());
276 gfx::Rect(desktop_window_->bounds().width(),
277 desktop_window_->bounds().height()));
278 request->set_area(window_rect); 276 request->set_area(window_rect);
279 desktop_window_->layer()->RequestCopyOfOutput(request.Pass()); 277 desktop_window_->layer()->RequestCopyOfOutput(request.Pass());
280 } 278 }
281 } 279 }
282 280
283 void CopyOutputFinishedForVideo( 281 void CopyOutputFinishedForVideo(
284 base::TimeTicks start_time, 282 base::TimeTicks start_time,
285 const ThreadSafeCaptureOracle::CaptureFrameCallback& capture_frame_cb, 283 const ThreadSafeCaptureOracle::CaptureFrameCallback& capture_frame_cb,
286 const scoped_refptr<media::VideoFrame>& target, 284 const scoped_refptr<media::VideoFrame>& target,
287 const SkBitmap& cursor_bitmap, 285 const SkBitmap& cursor_bitmap,
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 scoped_ptr<Client> client) { 522 scoped_ptr<Client> client) {
525 DVLOG(1) << "Allocating " << params.requested_format.frame_size.ToString(); 523 DVLOG(1) << "Allocating " << params.requested_format.frame_size.ToString();
526 core_->AllocateAndStart(params, client.Pass()); 524 core_->AllocateAndStart(params, client.Pass());
527 } 525 }
528 526
529 void DesktopCaptureDeviceAura::StopAndDeAllocate() { 527 void DesktopCaptureDeviceAura::StopAndDeAllocate() {
530 core_->StopAndDeAllocate(); 528 core_->StopAndDeAllocate();
531 } 529 }
532 530
533 } // namespace content 531 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698