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

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

Issue 10695181: [Android] Upstream all the IPC communications/handlings for stream texture (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix nits Created 8 years, 5 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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(OS_WIN) 5 #if defined(OS_WIN)
6 #include <windows.h> 6 #include <windows.h>
7 #endif 7 #endif
8 8
9 #include "content/common/gpu/gpu_channel.h" 9 #include "content/common/gpu/gpu_channel.h"
10 10
(...skipping 13 matching lines...) Expand all
24 #include "gpu/command_buffer/service/gpu_scheduler.h" 24 #include "gpu/command_buffer/service/gpu_scheduler.h"
25 #include "ipc/ipc_channel.h" 25 #include "ipc/ipc_channel.h"
26 #include "ipc/ipc_channel_proxy.h" 26 #include "ipc/ipc_channel_proxy.h"
27 #include "ui/gl/gl_context.h" 27 #include "ui/gl/gl_context.h"
28 #include "ui/gl/gl_surface.h" 28 #include "ui/gl/gl_surface.h"
29 29
30 #if defined(OS_POSIX) 30 #if defined(OS_POSIX)
31 #include "ipc/ipc_channel_posix.h" 31 #include "ipc/ipc_channel_posix.h"
32 #endif 32 #endif
33 33
34 #if defined(OS_ANDROID)
35 #include "content/common/gpu/stream_texture_manager_android.h"
36 #endif
37
34 namespace { 38 namespace {
35 // This filter does two things: 39 // This filter does two things:
36 // - it counts the number of messages coming in on the channel 40 // - it counts the number of messages coming in on the channel
37 // - it handles the GpuCommandBufferMsg_InsertSyncPoint message on the IO 41 // - it handles the GpuCommandBufferMsg_InsertSyncPoint message on the IO
38 // thread, generating the sync point ID and responding immediately, and then 42 // thread, generating the sync point ID and responding immediately, and then
39 // posting a task to insert the GpuCommandBufferMsg_RetireSyncPoint message 43 // posting a task to insert the GpuCommandBufferMsg_RetireSyncPoint message
40 // into the channel's queue. 44 // into the channel's queue.
41 class SyncPointMessageFilter : public IPC::ChannelProxy::MessageFilter { 45 class SyncPointMessageFilter : public IPC::ChannelProxy::MessageFilter {
42 public: 46 public:
43 // Takes ownership of gpu_channel (see below). 47 // Takes ownership of gpu_channel (see below).
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 processed_get_state_fast_(false), 160 processed_get_state_fast_(false),
157 weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { 161 weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
158 DCHECK(gpu_channel_manager); 162 DCHECK(gpu_channel_manager);
159 DCHECK(client_id); 163 DCHECK(client_id);
160 164
161 channel_id_ = IPC::Channel::GenerateVerifiedChannelID("gpu"); 165 channel_id_ = IPC::Channel::GenerateVerifiedChannelID("gpu");
162 const CommandLine* command_line = CommandLine::ForCurrentProcess(); 166 const CommandLine* command_line = CommandLine::ForCurrentProcess();
163 log_messages_ = command_line->HasSwitch(switches::kLogPluginMessages); 167 log_messages_ = command_line->HasSwitch(switches::kLogPluginMessages);
164 disallowed_features_.multisampling = 168 disallowed_features_.multisampling =
165 command_line->HasSwitch(switches::kDisableGLMultisampling); 169 command_line->HasSwitch(switches::kDisableGLMultisampling);
170 #if defined(OS_ANDROID)
171 stream_texture_manager_.reset(new content::StreamTextureManagerAndroid(this));
172 #endif
166 } 173 }
167 174
168 175
169 bool GpuChannel::Init(base::MessageLoopProxy* io_message_loop, 176 bool GpuChannel::Init(base::MessageLoopProxy* io_message_loop,
170 base::WaitableEvent* shutdown_event) { 177 base::WaitableEvent* shutdown_event) {
171 DCHECK(!channel_.get()); 178 DCHECK(!channel_.get());
172 179
173 // Map renderer ID to a (single) channel to that process. 180 // Map renderer ID to a (single) channel to that process.
174 channel_.reset(new IPC::SyncChannel( 181 channel_.reset(new IPC::SyncChannel(
175 channel_id_, 182 channel_id_,
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 388
382 bool GpuChannel::OnControlMessageReceived(const IPC::Message& msg) { 389 bool GpuChannel::OnControlMessageReceived(const IPC::Message& msg) {
383 // Always use IPC_MESSAGE_HANDLER_DELAY_REPLY for synchronous message handlers 390 // Always use IPC_MESSAGE_HANDLER_DELAY_REPLY for synchronous message handlers
384 // here. This is so the reply can be delayed if the scheduler is unscheduled. 391 // here. This is so the reply can be delayed if the scheduler is unscheduled.
385 bool handled = true; 392 bool handled = true;
386 IPC_BEGIN_MESSAGE_MAP(GpuChannel, msg) 393 IPC_BEGIN_MESSAGE_MAP(GpuChannel, msg)
387 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuChannelMsg_CreateOffscreenCommandBuffer, 394 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuChannelMsg_CreateOffscreenCommandBuffer,
388 OnCreateOffscreenCommandBuffer) 395 OnCreateOffscreenCommandBuffer)
389 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuChannelMsg_DestroyCommandBuffer, 396 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuChannelMsg_DestroyCommandBuffer,
390 OnDestroyCommandBuffer) 397 OnDestroyCommandBuffer)
398 #if defined(OS_ANDROID)
399 IPC_MESSAGE_HANDLER(GpuChannelMsg_RegisterStreamTextureProxy,
400 OnRegisterStreamTextureProxy)
401 IPC_MESSAGE_HANDLER(GpuChannelMsg_EstablishStreamTexture,
402 OnEstablishStreamTexture)
403 #endif
391 IPC_MESSAGE_UNHANDLED(handled = false) 404 IPC_MESSAGE_UNHANDLED(handled = false)
392 IPC_END_MESSAGE_MAP() 405 IPC_END_MESSAGE_MAP()
393 DCHECK(handled) << msg.type(); 406 DCHECK(handled) << msg.type();
394 return handled; 407 return handled;
395 } 408 }
396 409
397 void GpuChannel::HandleMessage() { 410 void GpuChannel::HandleMessage() {
398 handle_messages_scheduled_ = false; 411 handle_messages_scheduled_ = false;
399 412
400 if (!deferred_messages_.empty()) { 413 if (!deferred_messages_.empty()) {
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 // In case the renderer is currently blocked waiting for a sync reply from 512 // In case the renderer is currently blocked waiting for a sync reply from
500 // the stub, we need to make sure to reschedule the GpuChannel here. 513 // the stub, we need to make sure to reschedule the GpuChannel here.
501 if (need_reschedule) 514 if (need_reschedule)
502 OnScheduled(); 515 OnScheduled();
503 } 516 }
504 517
505 if (reply_message) 518 if (reply_message)
506 Send(reply_message); 519 Send(reply_message);
507 } 520 }
508 521
522 #if defined(OS_ANDROID)
523 void GpuChannel::OnRegisterStreamTextureProxy(
524 int32 stream_id, const gfx::Size& initial_size, int32* route_id) {
525 // Note that route_id is only used for notifications sent out from here.
526 // StreamTextureManager owns all texture objects and for incoming messages
527 // it finds the correct object based on stream_id.
528 *route_id = GenerateRouteID();
529 stream_texture_manager_->RegisterStreamTextureProxy(
530 stream_id, initial_size, *route_id);
531 }
532
533 void GpuChannel::OnEstablishStreamTexture(
534 int32 stream_id, content::SurfaceTexturePeer::SurfaceTextureTarget type,
535 int32 primary_id, int32 secondary_id) {
536 stream_texture_manager_->EstablishStreamTexture(
537 stream_id, type, primary_id, secondary_id);
538 }
539 #endif
540
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698