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 30 matching lines...) Expand all Loading... |
41 // Delete all the locally cached shared memory objects, closing the handle | 41 // Delete all the locally cached shared memory objects, closing the handle |
42 // in this process. | 42 // in this process. |
43 for (TransferBufferMap::iterator it = transfer_buffers_.begin(); | 43 for (TransferBufferMap::iterator it = transfer_buffers_.begin(); |
44 it != transfer_buffers_.end(); | 44 it != transfer_buffers_.end(); |
45 ++it) { | 45 ++it) { |
46 delete it->second.shared_memory; | 46 delete it->second.shared_memory; |
47 it->second.shared_memory = NULL; | 47 it->second.shared_memory = NULL; |
48 } | 48 } |
49 for (Decoders::iterator it = video_decoder_hosts_.begin(); | 49 for (Decoders::iterator it = video_decoder_hosts_.begin(); |
50 it != video_decoder_hosts_.end(); ++it) { | 50 it != video_decoder_hosts_.end(); ++it) { |
51 it->second->Destroy(); | 51 if (it->second) |
| 52 it->second->OnChannelError(); |
52 } | 53 } |
53 } | 54 } |
54 | 55 |
55 bool CommandBufferProxyImpl::OnMessageReceived(const IPC::Message& message) { | 56 bool CommandBufferProxyImpl::OnMessageReceived(const IPC::Message& message) { |
56 bool handled = true; | 57 bool handled = true; |
57 IPC_BEGIN_MESSAGE_MAP(CommandBufferProxyImpl, message) | 58 IPC_BEGIN_MESSAGE_MAP(CommandBufferProxyImpl, message) |
58 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Destroyed, OnDestroyed); | 59 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Destroyed, OnDestroyed); |
59 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_NotifyRepaint, | 60 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_NotifyRepaint, |
60 OnNotifyRepaint); | 61 OnNotifyRepaint); |
61 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_EchoAck, OnEchoAck); | 62 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_EchoAck, OnEchoAck); |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 } | 500 } |
500 | 501 |
501 if (decoder_route_id < 0) { | 502 if (decoder_route_id < 0) { |
502 DLOG(ERROR) << "Failed to Initialize GPU decoder on profile: " << profile; | 503 DLOG(ERROR) << "Failed to Initialize GPU decoder on profile: " << profile; |
503 return NULL; | 504 return NULL; |
504 } | 505 } |
505 | 506 |
506 GpuVideoDecodeAcceleratorHost* decoder_host = | 507 GpuVideoDecodeAcceleratorHost* decoder_host = |
507 new GpuVideoDecodeAcceleratorHost(channel_, decoder_route_id, client); | 508 new GpuVideoDecodeAcceleratorHost(channel_, decoder_route_id, client); |
508 bool inserted = video_decoder_hosts_.insert(std::make_pair( | 509 bool inserted = video_decoder_hosts_.insert(std::make_pair( |
509 decoder_route_id, decoder_host)).second; | 510 decoder_route_id, base::AsWeakPtr(decoder_host))).second; |
510 DCHECK(inserted); | 511 DCHECK(inserted); |
511 | 512 |
512 channel_->AddRoute(decoder_route_id, base::AsWeakPtr(decoder_host)); | 513 channel_->AddRoute(decoder_route_id, base::AsWeakPtr(decoder_host)); |
513 | 514 |
514 return decoder_host; | 515 return decoder_host; |
515 } | 516 } |
516 | 517 |
517 gpu::error::Error CommandBufferProxyImpl::GetLastError() { | 518 gpu::error::Error CommandBufferProxyImpl::GetLastError() { |
518 return last_state_.error; | 519 return last_state_.error; |
519 } | 520 } |
(...skipping 30 matching lines...) Expand all Loading... |
550 | 551 |
551 void CommandBufferProxyImpl::SetOnConsoleMessageCallback( | 552 void CommandBufferProxyImpl::SetOnConsoleMessageCallback( |
552 const GpuConsoleMessageCallback& callback) { | 553 const GpuConsoleMessageCallback& callback) { |
553 console_message_callback_ = callback; | 554 console_message_callback_ = callback; |
554 } | 555 } |
555 | 556 |
556 void CommandBufferProxyImpl::TryUpdateState() { | 557 void CommandBufferProxyImpl::TryUpdateState() { |
557 if (last_state_.error == gpu::error::kNoError) | 558 if (last_state_.error == gpu::error::kNoError) |
558 shared_state_->Read(&last_state_); | 559 shared_state_->Read(&last_state_); |
559 } | 560 } |
OLD | NEW |