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

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

Issue 245443005: Move IPC::MessageFilter and router to a separate file (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix gn build Created 6 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 | 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
11 #include <queue> 11 #include <queue>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/bind.h" 14 #include "base/bind.h"
15 #include "base/command_line.h" 15 #include "base/command_line.h"
16 #include "base/debug/trace_event.h" 16 #include "base/debug/trace_event.h"
17 #include "base/message_loop/message_loop_proxy.h" 17 #include "base/message_loop/message_loop_proxy.h"
18 #include "base/strings/string_util.h" 18 #include "base/strings/string_util.h"
19 #include "base/timer/timer.h" 19 #include "base/timer/timer.h"
20 #include "content/common/gpu/devtools_gpu_agent.h" 20 #include "content/common/gpu/devtools_gpu_agent.h"
21 #include "content/common/gpu/gpu_channel_manager.h" 21 #include "content/common/gpu/gpu_channel_manager.h"
22 #include "content/common/gpu/gpu_messages.h" 22 #include "content/common/gpu/gpu_messages.h"
23 #include "content/common/gpu/sync_point_manager.h" 23 #include "content/common/gpu/sync_point_manager.h"
24 #include "content/public/common/content_switches.h" 24 #include "content/public/common/content_switches.h"
25 #include "gpu/command_buffer/common/mailbox.h" 25 #include "gpu/command_buffer/common/mailbox.h"
26 #include "gpu/command_buffer/service/gpu_scheduler.h" 26 #include "gpu/command_buffer/service/gpu_scheduler.h"
27 #include "gpu/command_buffer/service/image_manager.h" 27 #include "gpu/command_buffer/service/image_manager.h"
28 #include "gpu/command_buffer/service/mailbox_manager.h" 28 #include "gpu/command_buffer/service/mailbox_manager.h"
29 #include "ipc/ipc_channel.h" 29 #include "ipc/ipc_channel.h"
30 #include "ipc/ipc_channel_proxy.h" 30 #include "ipc/message_filter.h"
31 #include "ui/gl/gl_context.h" 31 #include "ui/gl/gl_context.h"
32 #include "ui/gl/gl_image.h" 32 #include "ui/gl/gl_image.h"
33 #include "ui/gl/gl_surface.h" 33 #include "ui/gl/gl_surface.h"
34 34
35 #if defined(OS_POSIX) 35 #if defined(OS_POSIX)
36 #include "ipc/ipc_channel_posix.h" 36 #include "ipc/ipc_channel_posix.h"
37 #endif 37 #endif
38 38
39 namespace content { 39 namespace content {
40 namespace { 40 namespace {
(...skipping 21 matching lines...) Expand all
62 // - it counts and timestamps each message forwarded to the channel 62 // - it counts and timestamps each message forwarded to the channel
63 // so that we can preempt other channels if a message takes too long to 63 // so that we can preempt other channels if a message takes too long to
64 // process. To guarantee fairness, we must wait a minimum amount of time 64 // process. To guarantee fairness, we must wait a minimum amount of time
65 // before preempting and we limit the amount of time that we can preempt in 65 // before preempting and we limit the amount of time that we can preempt in
66 // one shot (see constants above). 66 // one shot (see constants above).
67 // - it handles the GpuCommandBufferMsg_InsertSyncPoint message on the IO 67 // - it handles the GpuCommandBufferMsg_InsertSyncPoint message on the IO
68 // thread, generating the sync point ID and responding immediately, and then 68 // thread, generating the sync point ID and responding immediately, and then
69 // posting a task to insert the GpuCommandBufferMsg_RetireSyncPoint message 69 // posting a task to insert the GpuCommandBufferMsg_RetireSyncPoint message
70 // into the channel's queue. 70 // into the channel's queue.
71 // - it generates mailbox names for clients of the GPU process on the IO thread. 71 // - it generates mailbox names for clients of the GPU process on the IO thread.
72 class GpuChannelMessageFilter : public IPC::ChannelProxy::MessageFilter { 72 class GpuChannelMessageFilter : public IPC::MessageFilter {
73 public: 73 public:
74 // Takes ownership of gpu_channel (see below). 74 // Takes ownership of gpu_channel (see below).
75 GpuChannelMessageFilter(base::WeakPtr<GpuChannel>* gpu_channel, 75 GpuChannelMessageFilter(base::WeakPtr<GpuChannel>* gpu_channel,
76 scoped_refptr<SyncPointManager> sync_point_manager, 76 scoped_refptr<SyncPointManager> sync_point_manager,
77 scoped_refptr<base::MessageLoopProxy> message_loop) 77 scoped_refptr<base::MessageLoopProxy> message_loop)
78 : preemption_state_(IDLE), 78 : preemption_state_(IDLE),
79 gpu_channel_(gpu_channel), 79 gpu_channel_(gpu_channel),
80 channel_(NULL), 80 channel_(NULL),
81 sync_point_manager_(sync_point_manager), 81 sync_point_manager_(sync_point_manager),
82 message_loop_(message_loop), 82 message_loop_(message_loop),
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after
838 messages_processed_)); 838 messages_processed_));
839 } 839 }
840 } 840 }
841 841
842 void GpuChannel::CacheShader(const std::string& key, 842 void GpuChannel::CacheShader(const std::string& key,
843 const std::string& shader) { 843 const std::string& shader) {
844 gpu_channel_manager_->Send( 844 gpu_channel_manager_->Send(
845 new GpuHostMsg_CacheShader(client_id_, key, shader)); 845 new GpuHostMsg_CacheShader(client_id_, key, shader));
846 } 846 }
847 847
848 void GpuChannel::AddFilter(IPC::ChannelProxy::MessageFilter* filter) { 848 void GpuChannel::AddFilter(IPC::MessageFilter* filter) {
849 channel_->AddFilter(filter); 849 channel_->AddFilter(filter);
850 } 850 }
851 851
852 void GpuChannel::RemoveFilter(IPC::ChannelProxy::MessageFilter* filter) { 852 void GpuChannel::RemoveFilter(IPC::MessageFilter* filter) {
853 channel_->RemoveFilter(filter); 853 channel_->RemoveFilter(filter);
854 } 854 }
855 855
856 uint64 GpuChannel::GetMemoryUsage() { 856 uint64 GpuChannel::GetMemoryUsage() {
857 uint64 size = 0; 857 uint64 size = 0;
858 for (StubMap::Iterator<GpuCommandBufferStub> it(&stubs_); 858 for (StubMap::Iterator<GpuCommandBufferStub> it(&stubs_);
859 !it.IsAtEnd(); it.Advance()) { 859 !it.IsAtEnd(); it.Advance()) {
860 size += it.GetCurrentValue()->GetMemoryUsage(); 860 size += it.GetCurrentValue()->GetMemoryUsage();
861 } 861 }
862 return size; 862 return size;
863 } 863 }
864 864
865 } // namespace content 865 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/gpu_channel.h ('k') | content/common/gpu/media/gpu_video_decode_accelerator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698