OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/renderer/gpu/command_buffer_proxy.h" | 5 #include "content/renderer/gpu/command_buffer_proxy.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/process_util.h" | 9 #include "base/process_util.h" |
10 #include "base/shared_memory.h" | 10 #include "base/shared_memory.h" |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 LOG(ERROR) << "Send(GpuChannelMsg_CreateVideoDecoder) failed"; | 394 LOG(ERROR) << "Send(GpuChannelMsg_CreateVideoDecoder) failed"; |
395 return NULL; | 395 return NULL; |
396 } | 396 } |
397 | 397 |
398 scoped_refptr<GpuVideoDecodeAcceleratorHost> decoder_host = | 398 scoped_refptr<GpuVideoDecodeAcceleratorHost> decoder_host = |
399 new GpuVideoDecodeAcceleratorHost(channel_, decoder_route_id, client); | 399 new GpuVideoDecodeAcceleratorHost(channel_, decoder_route_id, client); |
400 bool inserted = video_decoder_hosts_.insert(std::make_pair( | 400 bool inserted = video_decoder_hosts_.insert(std::make_pair( |
401 decoder_route_id, decoder_host)).second; | 401 decoder_route_id, decoder_host)).second; |
402 DCHECK(inserted); | 402 DCHECK(inserted); |
403 | 403 |
404 channel_->AddRoute(decoder_route_id, decoder_host.get()); | 404 channel_->AddRoute(decoder_route_id, decoder_host->AsWeakPtr()); |
405 | 405 |
406 return decoder_host; | 406 return decoder_host; |
407 } | 407 } |
408 | 408 |
409 bool CommandBufferProxy::Send(IPC::Message* msg) { | 409 bool CommandBufferProxy::Send(IPC::Message* msg) { |
410 // Caller should not intentionally send a message if the context is lost. | 410 // Caller should not intentionally send a message if the context is lost. |
411 DCHECK(last_state_.error == gpu::error::kNoError); | 411 DCHECK(last_state_.error == gpu::error::kNoError); |
412 | 412 |
413 if (channel_) { | 413 if (channel_) { |
414 if (channel_->Send(msg)) { | 414 if (channel_->Send(msg)) { |
(...skipping 12 matching lines...) Expand all Loading... |
427 delete msg; | 427 delete msg; |
428 return false; | 428 return false; |
429 } | 429 } |
430 | 430 |
431 void CommandBufferProxy::OnUpdateState(const gpu::CommandBuffer::State& state) { | 431 void CommandBufferProxy::OnUpdateState(const gpu::CommandBuffer::State& state) { |
432 // Handle wraparound. It works as long as we don't have more than 2B state | 432 // Handle wraparound. It works as long as we don't have more than 2B state |
433 // updates in flight across which reordering occurs. | 433 // updates in flight across which reordering occurs. |
434 if (state.generation - last_state_.generation < 0x80000000U) | 434 if (state.generation - last_state_.generation < 0x80000000U) |
435 last_state_ = state; | 435 last_state_ = state; |
436 } | 436 } |
OLD | NEW |