OLD | NEW |
---|---|
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/process_util.h" | 10 #include "base/process_util.h" |
(...skipping 11 matching lines...) Expand all Loading... | |
22 | 22 |
23 #if defined(OS_WIN) | 23 #if defined(OS_WIN) |
24 #include "content/public/common/sandbox_init.h" | 24 #include "content/public/common/sandbox_init.h" |
25 #endif | 25 #endif |
26 | 26 |
27 using gpu::Buffer; | 27 using gpu::Buffer; |
28 | 28 |
29 CommandBufferProxyImpl::CommandBufferProxyImpl( | 29 CommandBufferProxyImpl::CommandBufferProxyImpl( |
30 GpuChannelHost* channel, | 30 GpuChannelHost* channel, |
31 int route_id) | 31 int route_id) |
32 : shared_state_(NULL), | 32 : video_decoder_hosts_deleter_(&video_decoder_hosts_), |
piman
2012/07/17 17:14:28
So, doesn't this mean that when the CommandBufferP
Ami GONE FROM CHROMIUM
2012/07/17 17:58:50
Done.
| |
33 shared_state_(NULL), | |
33 channel_(channel), | 34 channel_(channel), |
34 route_id_(route_id), | 35 route_id_(route_id), |
35 flush_count_(0), | 36 flush_count_(0), |
36 last_put_offset_(-1), | 37 last_put_offset_(-1), |
37 next_signal_id_(0) { | 38 next_signal_id_(0) { |
38 } | 39 } |
39 | 40 |
40 CommandBufferProxyImpl::~CommandBufferProxyImpl() { | 41 CommandBufferProxyImpl::~CommandBufferProxyImpl() { |
41 // Delete all the locally cached shared memory objects, closing the handle | 42 // Delete all the locally cached shared memory objects, closing the handle |
42 // in this process. | 43 // in this process. |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
476 } | 477 } |
477 } | 478 } |
478 | 479 |
479 return result; | 480 return result; |
480 } | 481 } |
481 | 482 |
482 void CommandBufferProxyImpl::SetNotifyRepaintTask(const base::Closure& task) { | 483 void CommandBufferProxyImpl::SetNotifyRepaintTask(const base::Closure& task) { |
483 notify_repaint_task_ = task; | 484 notify_repaint_task_ = task; |
484 } | 485 } |
485 | 486 |
486 scoped_refptr<GpuVideoDecodeAcceleratorHost> | 487 GpuVideoDecodeAcceleratorHost* |
487 CommandBufferProxyImpl::CreateVideoDecoder( | 488 CommandBufferProxyImpl::CreateVideoDecoder( |
488 media::VideoCodecProfile profile, | 489 media::VideoCodecProfile profile, |
489 media::VideoDecodeAccelerator::Client* client) { | 490 media::VideoDecodeAccelerator::Client* client) { |
490 int decoder_route_id; | 491 int decoder_route_id; |
491 if (!Send(new GpuCommandBufferMsg_CreateVideoDecoder(route_id_, profile, | 492 if (!Send(new GpuCommandBufferMsg_CreateVideoDecoder(route_id_, profile, |
492 &decoder_route_id))) { | 493 &decoder_route_id))) { |
493 LOG(ERROR) << "Send(GpuCommandBufferMsg_CreateVideoDecoder) failed"; | 494 LOG(ERROR) << "Send(GpuCommandBufferMsg_CreateVideoDecoder) failed"; |
494 return NULL; | 495 return NULL; |
495 } | 496 } |
496 | 497 |
497 if (decoder_route_id < 0) { | 498 if (decoder_route_id < 0) { |
498 DLOG(ERROR) << "Failed to Initialize GPU decoder on profile: " << profile; | 499 DLOG(ERROR) << "Failed to Initialize GPU decoder on profile: " << profile; |
499 return NULL; | 500 return NULL; |
500 } | 501 } |
501 | 502 |
502 scoped_refptr<GpuVideoDecodeAcceleratorHost> decoder_host = | 503 GpuVideoDecodeAcceleratorHost* decoder_host = |
503 new GpuVideoDecodeAcceleratorHost(channel_, decoder_route_id, client); | 504 new GpuVideoDecodeAcceleratorHost(channel_, decoder_route_id, client); |
504 bool inserted = video_decoder_hosts_.insert(std::make_pair( | 505 bool inserted = video_decoder_hosts_.insert(std::make_pair( |
505 decoder_route_id, decoder_host)).second; | 506 decoder_route_id, decoder_host)).second; |
506 DCHECK(inserted); | 507 DCHECK(inserted); |
507 | 508 |
508 channel_->AddRoute(decoder_route_id, decoder_host->AsWeakPtr()); | 509 channel_->AddRoute(decoder_route_id, base::AsWeakPtr(decoder_host)); |
509 | 510 |
510 return decoder_host; | 511 return decoder_host; |
511 } | 512 } |
512 | 513 |
513 gpu::error::Error CommandBufferProxyImpl::GetLastError() { | 514 gpu::error::Error CommandBufferProxyImpl::GetLastError() { |
514 return last_state_.error; | 515 return last_state_.error; |
515 } | 516 } |
516 | 517 |
517 bool CommandBufferProxyImpl::Send(IPC::Message* msg) { | 518 bool CommandBufferProxyImpl::Send(IPC::Message* msg) { |
518 // Caller should not intentionally send a message if the context is lost. | 519 // Caller should not intentionally send a message if the context is lost. |
(...skipping 27 matching lines...) Expand all Loading... | |
546 | 547 |
547 void CommandBufferProxyImpl::SetOnConsoleMessageCallback( | 548 void CommandBufferProxyImpl::SetOnConsoleMessageCallback( |
548 const GpuConsoleMessageCallback& callback) { | 549 const GpuConsoleMessageCallback& callback) { |
549 console_message_callback_ = callback; | 550 console_message_callback_ = callback; |
550 } | 551 } |
551 | 552 |
552 void CommandBufferProxyImpl::TryUpdateState() { | 553 void CommandBufferProxyImpl::TryUpdateState() { |
553 if (last_state_.error == gpu::error::kNoError) | 554 if (last_state_.error == gpu::error::kNoError) |
554 shared_state_->Read(&last_state_); | 555 shared_state_->Read(&last_state_); |
555 } | 556 } |
OLD | NEW |