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

Side by Side Diff: content/common/gpu/client/command_buffer_proxy_impl.cc

Issue 22935009: Add content::SurfaceCapturer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@screencast_stride
Patch Set: 89e2665f Rebase. Created 7 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/common/gpu/client/command_buffer_proxy_impl.h" 5 #include "content/common/gpu/client/command_buffer_proxy_impl.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/shared_memory.h" 10 #include "base/memory/shared_memory.h"
11 #include "base/stl_util.h" 11 #include "base/stl_util.h"
12 #include "content/common/child_process_messages.h" 12 #include "content/common/child_process_messages.h"
13 #include "content/common/gpu/client/gl_surface_capturer_host.h"
13 #include "content/common/gpu/client/gpu_channel_host.h" 14 #include "content/common/gpu/client/gpu_channel_host.h"
14 #include "content/common/gpu/client/gpu_video_decode_accelerator_host.h" 15 #include "content/common/gpu/client/gpu_video_decode_accelerator_host.h"
15 #include "content/common/gpu/gpu_memory_allocation.h" 16 #include "content/common/gpu/gpu_memory_allocation.h"
16 #include "content/common/gpu/gpu_messages.h" 17 #include "content/common/gpu/gpu_messages.h"
17 #include "content/common/view_messages.h" 18 #include "content/common/view_messages.h"
18 #include "gpu/command_buffer/common/cmd_buffer_common.h" 19 #include "gpu/command_buffer/common/cmd_buffer_common.h"
19 #include "gpu/command_buffer/common/command_buffer_shared.h" 20 #include "gpu/command_buffer/common/command_buffer_shared.h"
20 #include "ui/gfx/size.h" 21 #include "ui/gfx/size.h"
21 22
22 namespace content { 23 namespace content {
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 return vda.Pass(); 494 return vda.Pass();
494 } 495 }
495 496
496 GpuVideoDecodeAcceleratorHost* decoder_host = 497 GpuVideoDecodeAcceleratorHost* decoder_host =
497 new GpuVideoDecodeAcceleratorHost(channel_, decoder_route_id, client, 498 new GpuVideoDecodeAcceleratorHost(channel_, decoder_route_id, client,
498 this); 499 this);
499 vda.reset(decoder_host); 500 vda.reset(decoder_host);
500 return vda.Pass(); 501 return vda.Pass();
501 } 502 }
502 503
504 scoped_ptr<SurfaceCapturer> CommandBufferProxyImpl::CreateSurfaceCapturer(
505 SurfaceCapturer::Client* client) {
506 int capturer_route_id;
507 scoped_ptr<SurfaceCapturer> capturer;
508 if (!Send(new GpuCommandBufferMsg_CreateSurfaceCapturer(
509 route_id_, &capturer_route_id))) {
Pawel Osciak 2013/08/24 01:29:31 Indent off?
sheu 2013/08/26 21:30:52 It's correct -- 4 from the starting opening '(' of
510 LOG(ERROR) << "Send(GpuCommandBufferMsg_CreateSurfaceCapturer) failed";
511 return capturer.Pass();
512 }
513
514 if (capturer_route_id < 0) {
515 DLOG(ERROR) << "Failed create surface capturer";
516 return capturer.Pass();
517 }
518
519 capturer.reset(new GLSurfaceCapturerHost(capturer_route_id, client, this));
520 return capturer.Pass();
521 }
522
503 gpu::error::Error CommandBufferProxyImpl::GetLastError() { 523 gpu::error::Error CommandBufferProxyImpl::GetLastError() {
504 return last_state_.error; 524 return last_state_.error;
505 } 525 }
506 526
507 bool CommandBufferProxyImpl::Send(IPC::Message* msg) { 527 bool CommandBufferProxyImpl::Send(IPC::Message* msg) {
508 // Caller should not intentionally send a message if the context is lost. 528 // Caller should not intentionally send a message if the context is lost.
509 DCHECK(last_state_.error == gpu::error::kNoError); 529 DCHECK(last_state_.error == gpu::error::kNoError);
510 530
511 if (channel_) { 531 if (channel_) {
512 if (channel_->Send(msg)) { 532 if (channel_->Send(msg)) {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 void CommandBufferProxyImpl::SendManagedMemoryStats( 567 void CommandBufferProxyImpl::SendManagedMemoryStats(
548 const GpuManagedMemoryStats& stats) { 568 const GpuManagedMemoryStats& stats) {
549 if (last_state_.error != gpu::error::kNoError) 569 if (last_state_.error != gpu::error::kNoError)
550 return; 570 return;
551 571
552 Send(new GpuCommandBufferMsg_SendClientManagedMemoryStats(route_id_, 572 Send(new GpuCommandBufferMsg_SendClientManagedMemoryStats(route_id_,
553 stats)); 573 stats));
554 } 574 }
555 575
556 } // namespace content 576 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698