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

Side by Side Diff: content/common/gpu/gpu_command_buffer_stub.cc

Issue 7659001: Support multiple HW video decoders per context. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 9 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 | Annotate | Revision Log
« no previous file with comments | « content/common/gpu/gpu_command_buffer_stub.h ('k') | content/common/gpu/gpu_messages.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #if defined(ENABLE_GPU) 5 #if defined(ENABLE_GPU)
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_DestroyVideoDecoder, 100 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_DestroyVideoDecoder,
101 OnDestroyVideoDecoder) 101 OnDestroyVideoDecoder)
102 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_ResizeOffscreenFrameBuffer, 102 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_ResizeOffscreenFrameBuffer,
103 OnResizeOffscreenFrameBuffer); 103 OnResizeOffscreenFrameBuffer);
104 #if defined(OS_MACOSX) 104 #if defined(OS_MACOSX)
105 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SetWindowSize, OnSetWindowSize); 105 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SetWindowSize, OnSetWindowSize);
106 #endif // defined(OS_MACOSX) 106 #endif // defined(OS_MACOSX)
107 IPC_MESSAGE_UNHANDLED(handled = false) 107 IPC_MESSAGE_UNHANDLED(handled = false)
108 IPC_END_MESSAGE_MAP() 108 IPC_END_MESSAGE_MAP()
109 109
110 // If this message isn't intended for the stub, try to route it to the video
111 // decoder.
112 if (!handled && video_decoder_.get())
113 handled = video_decoder_->OnMessageReceived(message);
114
115 DCHECK(handled); 110 DCHECK(handled);
116 return handled; 111 return handled;
117 } 112 }
118 113
119 bool GpuCommandBufferStub::Send(IPC::Message* message) { 114 bool GpuCommandBufferStub::Send(IPC::Message* message) {
120 return channel_->Send(message); 115 return channel_->Send(message);
121 } 116 }
122 117
123 bool GpuCommandBufferStub::IsScheduled() { 118 bool GpuCommandBufferStub::IsScheduled() {
124 return !scheduler_.get() || scheduler_->IsScheduled(); 119 return !scheduler_.get() || scheduler_->IsScheduled();
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 } else { 545 } else {
551 IPC::Message* msg = new GpuCommandBufferMsg_UpdateState(route_id_, state); 546 IPC::Message* msg = new GpuCommandBufferMsg_UpdateState(route_id_, state);
552 msg->set_unblock(true); 547 msg->set_unblock(true);
553 Send(msg); 548 Send(msg);
554 } 549 }
555 } 550 }
556 551
557 void GpuCommandBufferStub::OnCreateVideoDecoder( 552 void GpuCommandBufferStub::OnCreateVideoDecoder(
558 const std::vector<int32>& configs, 553 const std::vector<int32>& configs,
559 IPC::Message* reply_message) { 554 IPC::Message* reply_message) {
560 video_decoder_.reset( 555 int decoder_route_id = channel_->GenerateRouteID();
561 new GpuVideoDecodeAccelerator(this, route_id_, this)); 556 GpuCommandBufferMsg_CreateVideoDecoder::WriteReplyParams(
562 video_decoder_->Initialize(configs, reply_message); 557 reply_message, decoder_route_id);
558 GpuVideoDecodeAccelerator* decoder =
559 new GpuVideoDecodeAccelerator(this, decoder_route_id, this);
560 video_decoders_.AddWithID(decoder, decoder_route_id);
561 channel_->AddRoute(decoder_route_id, decoder);
562 decoder->Initialize(configs, reply_message);
563 } 563 }
564 564
565 void GpuCommandBufferStub::OnDestroyVideoDecoder() { 565 void GpuCommandBufferStub::OnDestroyVideoDecoder(int decoder_route_id) {
566 LOG(ERROR) << "GpuCommandBufferStub::OnDestroyVideoDecoder"; 566 channel_->RemoveRoute(decoder_route_id);
567 video_decoder_.reset(); 567 video_decoders_.Remove(decoder_route_id);
568 } 568 }
569 569
570 #endif // defined(ENABLE_GPU) 570 #endif // defined(ENABLE_GPU)
OLDNEW
« no previous file with comments | « content/common/gpu/gpu_command_buffer_stub.h ('k') | content/common/gpu/gpu_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698