| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "media/gpu/ipc/service/media_gpu_channel.h" | 5 #include "media/gpu/ipc/service/media_gpu_channel.h" |
| 6 | 6 |
| 7 #include "base/unguessable_token.h" | 7 #include "base/unguessable_token.h" |
| 8 #include "gpu/ipc/service/gpu_channel.h" | 8 #include "gpu/ipc/service/gpu_channel.h" |
| 9 #include "ipc/message_filter.h" | 9 #include "ipc/message_filter.h" |
| 10 #include "media/gpu/ipc/common/media_messages.h" | 10 #include "media/gpu/ipc/common/media_messages.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 } | 83 } |
| 84 | 84 |
| 85 private: | 85 private: |
| 86 ~MediaGpuChannelFilter() override {} | 86 ~MediaGpuChannelFilter() override {} |
| 87 | 87 |
| 88 IPC::Channel* channel_; | 88 IPC::Channel* channel_; |
| 89 base::UnguessableToken channel_token_; | 89 base::UnguessableToken channel_token_; |
| 90 }; | 90 }; |
| 91 | 91 |
| 92 MediaGpuChannel::MediaGpuChannel(gpu::GpuChannel* channel, | 92 MediaGpuChannel::MediaGpuChannel(gpu::GpuChannel* channel, |
| 93 const base::UnguessableToken& channel_token) | 93 const base::UnguessableToken& channel_token, |
| 94 : channel_(channel) { | 94 service_manager::Connector* connector, |
| 95 const char* browser_service_name) |
| 96 : channel_(channel), |
| 97 connector_(connector), |
| 98 browser_service_name_(browser_service_name) { |
| 95 channel_->AddFilter(new MediaGpuChannelFilter(channel_token)); | 99 channel_->AddFilter(new MediaGpuChannelFilter(channel_token)); |
| 96 } | 100 } |
| 97 | 101 |
| 98 MediaGpuChannel::~MediaGpuChannel() {} | 102 MediaGpuChannel::~MediaGpuChannel() {} |
| 99 | 103 |
| 100 bool MediaGpuChannel::Send(IPC::Message* msg) { | 104 bool MediaGpuChannel::Send(IPC::Message* msg) { |
| 101 return channel_->Send(msg); | 105 return channel_->Send(msg); |
| 102 } | 106 } |
| 103 | 107 |
| 104 bool MediaGpuChannel::OnMessageReceived(const IPC::Message& message) { | 108 bool MediaGpuChannel::OnMessageReceived(const IPC::Message& message) { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 IPC::Message* reply_message) { | 146 IPC::Message* reply_message) { |
| 143 TRACE_EVENT0("gpu", "MediaGpuChannel::OnCreateVideoDecoder"); | 147 TRACE_EVENT0("gpu", "MediaGpuChannel::OnCreateVideoDecoder"); |
| 144 gpu::GpuCommandBufferStub* stub = | 148 gpu::GpuCommandBufferStub* stub = |
| 145 channel_->LookupCommandBuffer(command_buffer_route_id); | 149 channel_->LookupCommandBuffer(command_buffer_route_id); |
| 146 if (!stub) { | 150 if (!stub) { |
| 147 reply_message->set_reply_error(); | 151 reply_message->set_reply_error(); |
| 148 Send(reply_message); | 152 Send(reply_message); |
| 149 return; | 153 return; |
| 150 } | 154 } |
| 151 GpuVideoDecodeAccelerator* decoder = new GpuVideoDecodeAccelerator( | 155 GpuVideoDecodeAccelerator* decoder = new GpuVideoDecodeAccelerator( |
| 152 decoder_route_id, stub, stub->channel()->io_task_runner()); | 156 decoder_route_id, stub, stub->channel()->io_task_runner(), connector_, |
| 157 browser_service_name_); |
| 153 bool succeeded = decoder->Initialize(config); | 158 bool succeeded = decoder->Initialize(config); |
| 154 GpuCommandBufferMsg_CreateVideoDecoder::WriteReplyParams(reply_message, | 159 GpuCommandBufferMsg_CreateVideoDecoder::WriteReplyParams(reply_message, |
| 155 succeeded); | 160 succeeded); |
| 156 Send(reply_message); | 161 Send(reply_message); |
| 157 | 162 |
| 158 // decoder is registered as a DestructionObserver of this stub and will | 163 // decoder is registered as a DestructionObserver of this stub and will |
| 159 // self-delete during destruction of this stub. | 164 // self-delete during destruction of this stub. |
| 160 } | 165 } |
| 161 | 166 |
| 162 void MediaGpuChannel::OnCreateVideoEncoder( | 167 void MediaGpuChannel::OnCreateVideoEncoder( |
| (...skipping 15 matching lines...) Expand all Loading... |
| 178 params.output_profile, params.initial_bitrate); | 183 params.output_profile, params.initial_bitrate); |
| 179 GpuCommandBufferMsg_CreateVideoEncoder::WriteReplyParams(reply_message, | 184 GpuCommandBufferMsg_CreateVideoEncoder::WriteReplyParams(reply_message, |
| 180 succeeded); | 185 succeeded); |
| 181 Send(reply_message); | 186 Send(reply_message); |
| 182 | 187 |
| 183 // encoder is registered as a DestructionObserver of this stub and will | 188 // encoder is registered as a DestructionObserver of this stub and will |
| 184 // self-delete during destruction of this stub. | 189 // self-delete during destruction of this stub. |
| 185 } | 190 } |
| 186 | 191 |
| 187 } // namespace media | 192 } // namespace media |
| OLD | NEW |