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

Unified Diff: content/common/gpu/gpu_channel.cc

Issue 1736643005: Decouple Media Service (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed nit + fixed compile issue Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/common/gpu/gpu_channel.h ('k') | content/common/gpu/gpu_channel_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/gpu/gpu_channel.cc
diff --git a/content/common/gpu/gpu_channel.cc b/content/common/gpu/gpu_channel.cc
index a50c62bd7ac29dcbad5ae253819670c18377f918..bb53c4b8721d83262c5ec730791b44205bfb2227 100644
--- a/content/common/gpu/gpu_channel.cc
+++ b/content/common/gpu/gpu_channel.cc
@@ -34,7 +34,6 @@
#include "content/common/gpu/gpu_channel_manager_delegate.h"
#include "content/common/gpu/gpu_memory_buffer_factory.h"
#include "content/common/gpu/gpu_messages.h"
-#include "content/common/gpu/media/gpu_jpeg_decode_accelerator.h"
#include "content/public/common/content_switches.h"
#include "gpu/command_buffer/common/mailbox.h"
#include "gpu/command_buffer/common/value_state.h"
@@ -73,21 +72,6 @@ const int64_t kMaxPreemptTimeMs = kVsyncIntervalMs;
// below this threshold.
const int64_t kStopPreemptThresholdMs = kVsyncIntervalMs;
-void SendCreateJpegDecoderResult(
- scoped_ptr<IPC::Message> reply_message,
- scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
- base::WeakPtr<GpuChannel> channel,
- scoped_refptr<GpuChannelMessageFilter> filter,
- bool result) {
- GpuChannelMsg_CreateJpegDecoder::WriteReplyParams(reply_message.get(),
- result);
- if (io_task_runner->BelongsToCurrentThread()) {
- filter->Send(reply_message.release());
- } else {
- channel->Send(reply_message.release());
- }
-}
-
} // anonymous namespace
scoped_refptr<GpuChannelMessageQueue> GpuChannelMessageQueue::Create(
@@ -605,6 +589,7 @@ GpuChannel::GpuChannel(GpuChannelManager* gpu_channel_manager,
bool allow_real_time_streams)
: gpu_channel_manager_(gpu_channel_manager),
sync_point_manager_(sync_point_manager),
+ unhandled_message_listener_(nullptr),
channel_id_(IPC::Channel::GenerateVerifiedChannelID("gpu")),
preempting_flag_(preempting_flag),
preempted_flag_(preempted_flag),
@@ -667,6 +652,14 @@ IPC::ChannelHandle GpuChannel::Init(base::WaitableEvent* shutdown_event) {
return channel_handle;
}
+void GpuChannel::SetUnhandledMessageListener(IPC::Listener* listener) {
+ unhandled_message_listener_ = listener;
+}
+
+base::WeakPtr<GpuChannel> GpuChannel::AsWeakPtr() {
+ return weak_factory_.GetWeakPtr();
+}
+
base::ProcessId GpuChannel::GetClientPID() const {
return channel_->GetPeerPID();
}
@@ -766,11 +759,8 @@ bool GpuChannel::OnControlMessageReceived(const IPC::Message& msg) {
OnCreateOffscreenCommandBuffer)
IPC_MESSAGE_HANDLER(GpuChannelMsg_DestroyCommandBuffer,
OnDestroyCommandBuffer)
- IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuChannelMsg_CreateJpegDecoder,
- OnCreateJpegDecoder)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
- DCHECK(handled) << msg.type();
return handled;
}
@@ -832,6 +822,9 @@ void GpuChannel::HandleMessageHelper(const IPC::Message& msg) {
handled = router_.RouteMessage(msg);
}
+ if (!handled && unhandled_message_listener_)
+ handled = unhandled_message_listener_->OnMessageReceived(msg);
+
// Respond to sync messages even if router failed to route.
if (!handled && msg.is_sync()) {
IPC::Message* reply = IPC::SyncMessage::GenerateReply(&msg);
@@ -999,18 +992,6 @@ void GpuChannel::OnDestroyCommandBuffer(int32_t route_id) {
RemoveRoute(route_id);
}
-void GpuChannel::OnCreateJpegDecoder(int32_t route_id,
- IPC::Message* reply_msg) {
- scoped_ptr<IPC::Message> msg(reply_msg);
- if (!jpeg_decoder_) {
- jpeg_decoder_.reset(new GpuJpegDecodeAccelerator(this, io_task_runner_));
- }
- jpeg_decoder_->AddClient(
- route_id,
- base::Bind(&SendCreateJpegDecoderResult, base::Passed(&msg),
- io_task_runner_, weak_factory_.GetWeakPtr(), filter_));
-}
-
void GpuChannel::CacheShader(const std::string& key,
const std::string& shader) {
gpu_channel_manager_->delegate()->StoreShaderToDisk(client_id_, key, shader);
« no previous file with comments | « content/common/gpu/gpu_channel.h ('k') | content/common/gpu/gpu_channel_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698