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

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

Issue 2873243002: Move components/display_compositor to components/viz/display_compositor (Closed)
Patch Set: Rebase 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
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/aura_window_capture_machine.h" 5 #include "content/browser/media/capture/aura_window_capture_machine.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/metrics/histogram_macros.h" 11 #include "base/metrics/histogram_macros.h"
12 #include "cc/output/copy_output_request.h" 12 #include "cc/output/copy_output_request.h"
13 #include "cc/output/copy_output_result.h" 13 #include "cc/output/copy_output_result.h"
14 #include "components/display_compositor/gl_helper.h" 14 #include "components/viz/display_compositor/gl_helper.h"
15 #include "content/browser/compositor/image_transport_factory.h" 15 #include "content/browser/compositor/image_transport_factory.h"
16 #include "content/browser/media/capture/desktop_capture_device_uma_types.h" 16 #include "content/browser/media/capture/desktop_capture_device_uma_types.h"
17 #include "content/public/browser/browser_thread.h" 17 #include "content/public/browser/browser_thread.h"
18 #include "device/power_save_blocker/power_save_blocker.h" 18 #include "device/power_save_blocker/power_save_blocker.h"
19 #include "media/base/video_util.h" 19 #include "media/base/video_util.h"
20 #include "media/capture/content/thread_safe_capture_oracle.h" 20 #include "media/capture/content/thread_safe_capture_oracle.h"
21 #include "media/capture/content/video_capture_oracle.h" 21 #include "media/capture/content/video_capture_oracle.h"
22 #include "media/capture/video_capture_types.h" 22 #include "media/capture/video_capture_types.h"
23 #include "skia/ext/image_operations.h" 23 #include "skia/ext/image_operations.h"
24 #include "third_party/skia/include/core/SkBitmap.h" 24 #include "third_party/skia/include/core/SkBitmap.h"
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 region_in_frame = gfx::Rect(region_in_frame.x() & ~1, 298 region_in_frame = gfx::Rect(region_in_frame.x() & ~1,
299 region_in_frame.y() & ~1, 299 region_in_frame.y() & ~1,
300 region_in_frame.width() & ~1, 300 region_in_frame.width() & ~1,
301 region_in_frame.height() & ~1); 301 region_in_frame.height() & ~1);
302 if (region_in_frame.IsEmpty()) { 302 if (region_in_frame.IsEmpty()) {
303 VLOG(1) << "Aborting capture: Computed empty letterboxed content region."; 303 VLOG(1) << "Aborting capture: Computed empty letterboxed content region.";
304 return false; 304 return false;
305 } 305 }
306 306
307 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); 307 ImageTransportFactory* factory = ImageTransportFactory::GetInstance();
308 display_compositor::GLHelper* gl_helper = factory->GetGLHelper(); 308 viz::GLHelper* gl_helper = factory->GetGLHelper();
309 if (!gl_helper) { 309 if (!gl_helper) {
310 VLOG(1) << "Aborting capture: No GLHelper available for YUV readback."; 310 VLOG(1) << "Aborting capture: No GLHelper available for YUV readback.";
311 return false; 311 return false;
312 } 312 }
313 313
314 cc::TextureMailbox texture_mailbox; 314 cc::TextureMailbox texture_mailbox;
315 std::unique_ptr<cc::SingleReleaseCallback> release_callback; 315 std::unique_ptr<cc::SingleReleaseCallback> release_callback;
316 result->TakeTexture(&texture_mailbox, &release_callback); 316 result->TakeTexture(&texture_mailbox, &release_callback);
317 DCHECK(texture_mailbox.IsTexture()); 317 DCHECK(texture_mailbox.IsTexture());
318 if (!texture_mailbox.IsTexture()) { 318 if (!texture_mailbox.IsTexture()) {
319 VLOG(1) << "Aborting capture: Failed to take texture from mailbox."; 319 VLOG(1) << "Aborting capture: Failed to take texture from mailbox.";
320 return false; 320 return false;
321 } 321 }
322 322
323 gfx::Rect result_rect(result->size()); 323 gfx::Rect result_rect(result->size());
324 if (!yuv_readback_pipeline_ || 324 if (!yuv_readback_pipeline_ ||
325 yuv_readback_pipeline_->scaler()->SrcSize() != result_rect.size() || 325 yuv_readback_pipeline_->scaler()->SrcSize() != result_rect.size() ||
326 yuv_readback_pipeline_->scaler()->SrcSubrect() != result_rect || 326 yuv_readback_pipeline_->scaler()->SrcSubrect() != result_rect ||
327 yuv_readback_pipeline_->scaler()->DstSize() != region_in_frame.size()) { 327 yuv_readback_pipeline_->scaler()->DstSize() != region_in_frame.size()) {
328 yuv_readback_pipeline_.reset(gl_helper->CreateReadbackPipelineYUV( 328 yuv_readback_pipeline_.reset(gl_helper->CreateReadbackPipelineYUV(
329 display_compositor::GLHelper::SCALER_QUALITY_FAST, result_rect.size(), 329 viz::GLHelper::SCALER_QUALITY_FAST, result_rect.size(), result_rect,
330 result_rect, region_in_frame.size(), true, true)); 330 region_in_frame.size(), true, true));
331 } 331 }
332 332
333 cursor_renderer_->SnapshotCursorState(region_in_frame); 333 cursor_renderer_->SnapshotCursorState(region_in_frame);
334 yuv_readback_pipeline_->ReadbackYUV( 334 yuv_readback_pipeline_->ReadbackYUV(
335 texture_mailbox.mailbox(), texture_mailbox.sync_token(), 335 texture_mailbox.mailbox(), texture_mailbox.sync_token(),
336 video_frame->visible_rect(), 336 video_frame->visible_rect(),
337 video_frame->stride(media::VideoFrame::kYPlane), 337 video_frame->stride(media::VideoFrame::kYPlane),
338 video_frame->data(media::VideoFrame::kYPlane), 338 video_frame->data(media::VideoFrame::kYPlane),
339 video_frame->stride(media::VideoFrame::kUPlane), 339 video_frame->stride(media::VideoFrame::kUPlane),
340 video_frame->data(media::VideoFrame::kUPlane), 340 video_frame->data(media::VideoFrame::kUPlane),
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 Capture(timestamp); 440 Capture(timestamp);
441 } 441 }
442 442
443 void AuraWindowCaptureMachine::OnCompositingShuttingDown( 443 void AuraWindowCaptureMachine::OnCompositingShuttingDown(
444 ui::Compositor* compositor) { 444 ui::Compositor* compositor) {
445 DCHECK_CURRENTLY_ON(BrowserThread::UI); 445 DCHECK_CURRENTLY_ON(BrowserThread::UI);
446 compositor->RemoveAnimationObserver(this); 446 compositor->RemoveAnimationObserver(this);
447 } 447 }
448 448
449 } // namespace content 449 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/media/capture/aura_window_capture_machine.h ('k') | content/browser/renderer_host/compositor_impl_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698