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

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

Issue 1902463002: Introduce components/display_compositor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove bot changes. Will do in a separate CL Created 4 years, 8 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.h" 11 #include "base/metrics/histogram.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 "content/browser/compositor/gl_helper.h" 14 #include "components/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 "content/public/browser/power_save_blocker.h" 18 #include "content/public/browser/power_save_blocker.h"
19 #include "media/base/video_capture_types.h" 19 #include "media/base/video_capture_types.h"
20 #include "media/base/video_util.h" 20 #include "media/base/video_util.h"
21 #include "media/capture/content/thread_safe_capture_oracle.h" 21 #include "media/capture/content/thread_safe_capture_oracle.h"
22 #include "media/capture/content/video_capture_oracle.h" 22 #include "media/capture/content/video_capture_oracle.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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 gfx::Rect region_in_frame = media::ComputeLetterboxRegion( 245 gfx::Rect region_in_frame = media::ComputeLetterboxRegion(
246 video_frame->visible_rect(), result->size()); 246 video_frame->visible_rect(), result->size());
247 region_in_frame = gfx::Rect(region_in_frame.x() & ~1, 247 region_in_frame = gfx::Rect(region_in_frame.x() & ~1,
248 region_in_frame.y() & ~1, 248 region_in_frame.y() & ~1,
249 region_in_frame.width() & ~1, 249 region_in_frame.width() & ~1,
250 region_in_frame.height() & ~1); 250 region_in_frame.height() & ~1);
251 if (region_in_frame.IsEmpty()) 251 if (region_in_frame.IsEmpty())
252 return false; 252 return false;
253 253
254 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); 254 ImageTransportFactory* factory = ImageTransportFactory::GetInstance();
255 GLHelper* gl_helper = factory->GetGLHelper(); 255 display_compositor::GLHelper* gl_helper = factory->GetGLHelper();
256 if (!gl_helper) 256 if (!gl_helper)
257 return false; 257 return false;
258 258
259 cc::TextureMailbox texture_mailbox; 259 cc::TextureMailbox texture_mailbox;
260 std::unique_ptr<cc::SingleReleaseCallback> release_callback; 260 std::unique_ptr<cc::SingleReleaseCallback> release_callback;
261 result->TakeTexture(&texture_mailbox, &release_callback); 261 result->TakeTexture(&texture_mailbox, &release_callback);
262 DCHECK(texture_mailbox.IsTexture()); 262 DCHECK(texture_mailbox.IsTexture());
263 if (!texture_mailbox.IsTexture()) 263 if (!texture_mailbox.IsTexture())
264 return false; 264 return false;
265 265
266 gfx::Rect result_rect(result->size()); 266 gfx::Rect result_rect(result->size());
267 if (!yuv_readback_pipeline_ || 267 if (!yuv_readback_pipeline_ ||
268 yuv_readback_pipeline_->scaler()->SrcSize() != result_rect.size() || 268 yuv_readback_pipeline_->scaler()->SrcSize() != result_rect.size() ||
269 yuv_readback_pipeline_->scaler()->SrcSubrect() != result_rect || 269 yuv_readback_pipeline_->scaler()->SrcSubrect() != result_rect ||
270 yuv_readback_pipeline_->scaler()->DstSize() != region_in_frame.size()) { 270 yuv_readback_pipeline_->scaler()->DstSize() != region_in_frame.size()) {
271 yuv_readback_pipeline_.reset( 271 yuv_readback_pipeline_.reset(gl_helper->CreateReadbackPipelineYUV(
272 gl_helper->CreateReadbackPipelineYUV(GLHelper::SCALER_QUALITY_FAST, 272 display_compositor::GLHelper::SCALER_QUALITY_FAST, result_rect.size(),
273 result_rect.size(), 273 result_rect, region_in_frame.size(), true, true));
274 result_rect,
275 region_in_frame.size(),
276 true,
277 true));
278 } 274 }
279 275
280 cursor_renderer_->SnapshotCursorState(region_in_frame); 276 cursor_renderer_->SnapshotCursorState(region_in_frame);
281 yuv_readback_pipeline_->ReadbackYUV( 277 yuv_readback_pipeline_->ReadbackYUV(
282 texture_mailbox.mailbox(), texture_mailbox.sync_token(), 278 texture_mailbox.mailbox(), texture_mailbox.sync_token(),
283 video_frame->visible_rect(), 279 video_frame->visible_rect(),
284 video_frame->stride(media::VideoFrame::kYPlane), 280 video_frame->stride(media::VideoFrame::kYPlane),
285 video_frame->data(media::VideoFrame::kYPlane), 281 video_frame->data(media::VideoFrame::kYPlane),
286 video_frame->stride(media::VideoFrame::kUPlane), 282 video_frame->stride(media::VideoFrame::kUPlane),
287 video_frame->data(media::VideoFrame::kUPlane), 283 video_frame->data(media::VideoFrame::kUPlane),
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 // TODO(miu): The CopyOutputRequest should be made earlier, at WillCommit(). 359 // TODO(miu): The CopyOutputRequest should be made earlier, at WillCommit().
364 // http://crbug.com/492839 360 // http://crbug.com/492839
365 BrowserThread::PostTask( 361 BrowserThread::PostTask(
366 BrowserThread::UI, 362 BrowserThread::UI,
367 FROM_HERE, 363 FROM_HERE,
368 base::Bind(&AuraWindowCaptureMachine::Capture, weak_factory_.GetWeakPtr(), 364 base::Bind(&AuraWindowCaptureMachine::Capture, weak_factory_.GetWeakPtr(),
369 true)); 365 true));
370 } 366 }
371 367
372 } // namespace content 368 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/media/capture/aura_window_capture_machine.h ('k') | content/browser/renderer_host/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698