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

Side by Side Diff: content/common/gpu/media/media_channel.cc

Issue 1845563005: Refactor content/common/gpu into gpu/ipc/service (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Drop ref to deleted content_tests_gypi_values.content_unittests_ozone_sources Created 4 years, 8 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
« no previous file with comments | « content/common/gpu/media/media_channel.h ('k') | content/common/gpu/media/media_service.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 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 "content/common/gpu/media/media_channel.h" 5 #include "content/common/gpu/media/media_channel.h"
6 6
7 #include "content/common/gpu/gpu_channel.h"
8 #include "content/common/gpu/media/gpu_video_decode_accelerator.h" 7 #include "content/common/gpu/media/gpu_video_decode_accelerator.h"
9 #include "content/common/gpu/media/gpu_video_encode_accelerator.h" 8 #include "content/common/gpu/media/gpu_video_encode_accelerator.h"
9 #include "gpu/ipc/service/gpu_channel.h"
10 #include "media/gpu/ipc/common/media_messages.h" 10 #include "media/gpu/ipc/common/media_messages.h"
11 11
12 namespace content { 12 namespace content {
13 13
14 namespace { 14 namespace {
15 15
16 void SendCreateJpegDecoderResult( 16 void SendCreateJpegDecoderResult(
17 scoped_ptr<IPC::Message> reply_message, 17 scoped_ptr<IPC::Message> reply_message,
18 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, 18 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
19 base::WeakPtr<GpuChannel> channel, 19 base::WeakPtr<gpu::GpuChannel> channel,
20 scoped_refptr<GpuChannelMessageFilter> filter, 20 scoped_refptr<gpu::GpuChannelMessageFilter> filter,
21 bool result) { 21 bool result) {
22 GpuChannelMsg_CreateJpegDecoder::WriteReplyParams(reply_message.get(), 22 GpuChannelMsg_CreateJpegDecoder::WriteReplyParams(reply_message.get(),
23 result); 23 result);
24 if (io_task_runner->BelongsToCurrentThread()) { 24 if (io_task_runner->BelongsToCurrentThread()) {
25 filter->Send(reply_message.release()); 25 filter->Send(reply_message.release());
26 } else if (channel) { 26 } else if (channel) {
27 channel->Send(reply_message.release()); 27 channel->Send(reply_message.release());
28 } 28 }
29 } 29 }
30 30
(...skipping 17 matching lines...) Expand all
48 IPC::Message* reply_message) { 48 IPC::Message* reply_message) {
49 channel_->OnCreateVideoEncoder(routing_id_, params, reply_message); 49 channel_->OnCreateVideoEncoder(routing_id_, params, reply_message);
50 } 50 }
51 51
52 private: 52 private:
53 MediaChannel* const channel_; 53 MediaChannel* const channel_;
54 const int32_t routing_id_; 54 const int32_t routing_id_;
55 DISALLOW_COPY_AND_ASSIGN(MediaChannelDispatchHelper); 55 DISALLOW_COPY_AND_ASSIGN(MediaChannelDispatchHelper);
56 }; 56 };
57 57
58 MediaChannel::MediaChannel(GpuChannel* channel) : channel_(channel) {} 58 MediaChannel::MediaChannel(gpu::GpuChannel* channel) : channel_(channel) {}
59 59
60 MediaChannel::~MediaChannel() {} 60 MediaChannel::~MediaChannel() {}
61 61
62 bool MediaChannel::Send(IPC::Message* msg) { 62 bool MediaChannel::Send(IPC::Message* msg) {
63 return channel_->Send(msg); 63 return channel_->Send(msg);
64 } 64 }
65 65
66 bool MediaChannel::OnMessageReceived(const IPC::Message& message) { 66 bool MediaChannel::OnMessageReceived(const IPC::Message& message) {
67 MediaChannelDispatchHelper helper(this, message.routing_id()); 67 MediaChannelDispatchHelper helper(this, message.routing_id());
68 bool handled = true; 68 bool handled = true;
(...skipping 23 matching lines...) Expand all
92 channel_->io_task_runner(), channel_->AsWeakPtr(), 92 channel_->io_task_runner(), channel_->AsWeakPtr(),
93 make_scoped_refptr(channel_->filter()))); 93 make_scoped_refptr(channel_->filter())));
94 } 94 }
95 95
96 void MediaChannel::OnCreateVideoDecoder( 96 void MediaChannel::OnCreateVideoDecoder(
97 int32_t command_buffer_route_id, 97 int32_t command_buffer_route_id,
98 const media::VideoDecodeAccelerator::Config& config, 98 const media::VideoDecodeAccelerator::Config& config,
99 int32_t decoder_route_id, 99 int32_t decoder_route_id,
100 IPC::Message* reply_message) { 100 IPC::Message* reply_message) {
101 TRACE_EVENT0("gpu", "MediaChannel::OnCreateVideoDecoder"); 101 TRACE_EVENT0("gpu", "MediaChannel::OnCreateVideoDecoder");
102 GpuCommandBufferStub* stub = 102 gpu::GpuCommandBufferStub* stub =
103 channel_->LookupCommandBuffer(command_buffer_route_id); 103 channel_->LookupCommandBuffer(command_buffer_route_id);
104 if (!stub) { 104 if (!stub) {
105 reply_message->set_reply_error(); 105 reply_message->set_reply_error();
106 Send(reply_message); 106 Send(reply_message);
107 return; 107 return;
108 } 108 }
109 GpuVideoDecodeAccelerator* decoder = new GpuVideoDecodeAccelerator( 109 GpuVideoDecodeAccelerator* decoder = new GpuVideoDecodeAccelerator(
110 decoder_route_id, stub, stub->channel()->io_task_runner()); 110 decoder_route_id, stub, stub->channel()->io_task_runner());
111 bool succeeded = decoder->Initialize(config); 111 bool succeeded = decoder->Initialize(config);
112 GpuCommandBufferMsg_CreateVideoDecoder::WriteReplyParams(reply_message, 112 GpuCommandBufferMsg_CreateVideoDecoder::WriteReplyParams(reply_message,
113 succeeded); 113 succeeded);
114 Send(reply_message); 114 Send(reply_message);
115 115
116 // decoder is registered as a DestructionObserver of this stub and will 116 // decoder is registered as a DestructionObserver of this stub and will
117 // self-delete during destruction of this stub. 117 // self-delete during destruction of this stub.
118 } 118 }
119 119
120 void MediaChannel::OnCreateVideoEncoder( 120 void MediaChannel::OnCreateVideoEncoder(
121 int32_t command_buffer_route_id, 121 int32_t command_buffer_route_id,
122 const media::CreateVideoEncoderParams& params, 122 const media::CreateVideoEncoderParams& params,
123 IPC::Message* reply_message) { 123 IPC::Message* reply_message) {
124 TRACE_EVENT0("gpu", "MediaChannel::OnCreateVideoEncoder"); 124 TRACE_EVENT0("gpu", "MediaChannel::OnCreateVideoEncoder");
125 GpuCommandBufferStub* stub = 125 gpu::GpuCommandBufferStub* stub =
126 channel_->LookupCommandBuffer(command_buffer_route_id); 126 channel_->LookupCommandBuffer(command_buffer_route_id);
127 if (!stub) { 127 if (!stub) {
128 reply_message->set_reply_error(); 128 reply_message->set_reply_error();
129 Send(reply_message); 129 Send(reply_message);
130 return; 130 return;
131 } 131 }
132 GpuVideoEncodeAccelerator* encoder = 132 GpuVideoEncodeAccelerator* encoder =
133 new GpuVideoEncodeAccelerator(params.encoder_route_id, stub); 133 new GpuVideoEncodeAccelerator(params.encoder_route_id, stub);
134 bool succeeded = 134 bool succeeded =
135 encoder->Initialize(params.input_format, params.input_visible_size, 135 encoder->Initialize(params.input_format, params.input_visible_size,
136 params.output_profile, params.initial_bitrate); 136 params.output_profile, params.initial_bitrate);
137 GpuCommandBufferMsg_CreateVideoEncoder::WriteReplyParams(reply_message, 137 GpuCommandBufferMsg_CreateVideoEncoder::WriteReplyParams(reply_message,
138 succeeded); 138 succeeded);
139 Send(reply_message); 139 Send(reply_message);
140 140
141 // encoder is registered as a DestructionObserver of this stub and will 141 // encoder is registered as a DestructionObserver of this stub and will
142 // self-delete during destruction of this stub. 142 // self-delete during destruction of this stub.
143 } 143 }
144 144
145 } // namespace content 145 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/media/media_channel.h ('k') | content/common/gpu/media/media_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698