diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-22 20:16:19 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-22 20:16:19 +0000 |
commit | eb398193640924b8e55c6b2d00077838146ea8eb (patch) | |
tree | fc832fdabf40bad4ea19253b19216f1111fdc166 /content/common/gpu | |
parent | f6b218e0969ab52a1a623260a8242030f8aeef31 (diff) | |
download | chromium_src-eb398193640924b8e55c6b2d00077838146ea8eb.zip chromium_src-eb398193640924b8e55c6b2d00077838146ea8eb.tar.gz chromium_src-eb398193640924b8e55c6b2d00077838146ea8eb.tar.bz2 |
Move a bunch of code in content\common (as well as a few left in renderer) to the content namespace.
Review URL: https://codereview.chromium.org/11227033
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@163359 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/common/gpu')
34 files changed, 182 insertions, 70 deletions
diff --git a/content/common/gpu/client/command_buffer_proxy_impl.cc b/content/common/gpu/client/command_buffer_proxy_impl.cc index f261597..c17ea27 100644 --- a/content/common/gpu/client/command_buffer_proxy_impl.cc +++ b/content/common/gpu/client/command_buffer_proxy_impl.cc @@ -26,6 +26,8 @@ using gpu::Buffer; +namespace content { + CommandBufferProxyImpl::CommandBufferProxyImpl( GpuChannelHost* channel, int route_id) @@ -261,8 +263,8 @@ int32 CommandBufferProxyImpl::CreateTransferBuffer( base::SharedMemoryHandle handle = shm->handle(); #if defined(OS_WIN) // Windows needs to explicitly duplicate the handle out to another process. - if (!content::BrokerDuplicateHandle(handle, channel_->gpu_pid(), - &handle, FILE_MAP_WRITE, 0)) { + if (!BrokerDuplicateHandle(handle, channel_->gpu_pid(), &handle, + FILE_MAP_WRITE, 0)) { return -1; } #elif defined(OS_POSIX) @@ -292,8 +294,8 @@ int32 CommandBufferProxyImpl::RegisterTransferBuffer( base::SharedMemoryHandle handle = shared_memory->handle(); #if defined(OS_WIN) // Windows needs to explicitly duplicate the handle out to another process. - if (!content::BrokerDuplicateHandle(handle, channel_->gpu_pid(), - &handle, FILE_MAP_WRITE, 0)) { + if (!BrokerDuplicateHandle(handle, channel_->gpu_pid(), &handle, + FILE_MAP_WRITE, 0)) { return -1; } #endif @@ -561,3 +563,5 @@ void CommandBufferProxyImpl::TryUpdateState() { if (last_state_.error == gpu::error::kNoError) shared_state_->Read(&last_state_); } + +} // namespace content diff --git a/content/common/gpu/client/command_buffer_proxy_impl.h b/content/common/gpu/client/command_buffer_proxy_impl.h index 8a7a6b4..856159d 100644 --- a/content/common/gpu/client/command_buffer_proxy_impl.h +++ b/content/common/gpu/client/command_buffer_proxy_impl.h @@ -23,14 +23,16 @@ #include "gpu/command_buffer/common/command_buffer_shared.h" #include "ipc/ipc_listener.h" -class GpuChannelHost; struct GPUCommandBufferConsoleMessage; -struct GpuMemoryAllocationForRenderer; namespace base { class SharedMemory; } +namespace content { +class GpuChannelHost; +struct GpuMemoryAllocationForRenderer; + // Client side proxy that forwards messages synchronously to a // CommandBufferStub. class CommandBufferProxyImpl @@ -169,6 +171,8 @@ class CommandBufferProxyImpl DISALLOW_COPY_AND_ASSIGN(CommandBufferProxyImpl); }; +} // namespace content + #endif // ENABLE_GPU #endif // CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_ diff --git a/content/common/gpu/client/gpu_channel_host.cc b/content/common/gpu/client/gpu_channel_host.cc index 59c73e3..aa556c8 100644 --- a/content/common/gpu/client/gpu_channel_host.cc +++ b/content/common/gpu/client/gpu_channel_host.cc @@ -17,6 +17,8 @@ using base::AutoLock; using base::MessageLoopProxy; +namespace content { + GpuListenerInfo::GpuListenerInfo() {} GpuListenerInfo::~GpuListenerInfo() {} @@ -57,7 +59,7 @@ void GpuChannelHost::Connect( state_ = kConnected; } -void GpuChannelHost::set_gpu_info(const content::GPUInfo& gpu_info) { +void GpuChannelHost::set_gpu_info(const GPUInfo& gpu_info) { gpu_info_ = gpu_info; } @@ -65,7 +67,7 @@ void GpuChannelHost::SetStateLost() { state_ = kLost; } -const content::GPUInfo& GpuChannelHost::gpu_info() const { +const GPUInfo& GpuChannelHost::gpu_info() const { return gpu_info_; } @@ -215,7 +217,7 @@ void GpuChannelHost::DestroyCommandBuffer( } bool GpuChannelHost::CollectRenderingStatsForSurface( - int surface_id, content::GpuRenderingStats* stats) { + int surface_id, GpuRenderingStats* stats) { TRACE_EVENT0("gpu", "GpuChannelHost::CollectRenderingStats"); return Send(new GpuChannelMsg_CollectRenderingStatsForSurface(surface_id, @@ -315,4 +317,4 @@ void GpuChannelHost::MessageFilter::OnChannelError() { listeners_.clear(); } - +} // namespace content diff --git a/content/common/gpu/client/gpu_channel_host.h b/content/common/gpu/client/gpu_channel_host.h index e2567c6..8b68626 100644 --- a/content/common/gpu/client/gpu_channel_host.h +++ b/content/common/gpu/client/gpu_channel_host.h @@ -28,24 +28,23 @@ #include "ui/gl/gpu_preference.h" class CommandBufferProxy; -class CommandBufferProxyImpl; -struct GPUCreateCommandBufferConfig; class GURL; -class TransportTextureService; class MessageLoop; +class TransportTextureService; +struct GPUCreateCommandBufferConfig; namespace base { class MessageLoopProxy; } -namespace content { -struct GpuRenderingStats; -} - namespace IPC { class SyncMessageFilter; } +namespace content { +class CommandBufferProxyImpl; +struct GpuRenderingStats; + struct GpuListenerInfo { GpuListenerInfo(); ~GpuListenerInfo(); @@ -68,8 +67,7 @@ class CONTENT_EXPORT GpuChannelHostFactory { virtual scoped_ptr<base::SharedMemory> AllocateSharedMemory(uint32 size) = 0; virtual int32 CreateViewCommandBuffer( int32 surface_id, const GPUCreateCommandBufferConfig& init_params) = 0; - virtual GpuChannelHost* EstablishGpuChannelSync( - content::CauseForGpuLaunch) = 0; + virtual GpuChannelHost* EstablishGpuChannelSync(CauseForGpuLaunch) = 0; virtual void CreateImage( gfx::PluginWindowHandle window, int32 image_id, @@ -106,8 +104,8 @@ class GpuChannelHost : public IPC::Sender, void SetStateLost(); // The GPU stats reported by the GPU process. - void set_gpu_info(const content::GPUInfo& gpu_info); - const content::GPUInfo& gpu_info() const; + void set_gpu_info(const GPUInfo& gpu_info); + const GPUInfo& gpu_info() const; void OnChannelError(); @@ -144,7 +142,7 @@ class GpuChannelHost : public IPC::Sender, // Collect rendering stats from GPU process. bool CollectRenderingStatsForSurface( - int surface_id, content::GpuRenderingStats* stats); + int surface_id, GpuRenderingStats* stats); // Add a route for the current message loop. void AddRoute(int route_id, base::WeakPtr<IPC::Listener> listener); @@ -189,7 +187,7 @@ class GpuChannelHost : public IPC::Sender, State state_; - content::GPUInfo gpu_info_; + GPUInfo gpu_info_; scoped_ptr<IPC::SyncChannel> channel_; scoped_refptr<MessageFilter> channel_filter_; @@ -208,4 +206,6 @@ class GpuChannelHost : public IPC::Sender, DISALLOW_COPY_AND_ASSIGN(GpuChannelHost); }; +} // namespace content + #endif // CONTENT_COMMON_GPU_CLIENT_GPU_CHANNEL_HOST_H_ diff --git a/content/common/gpu/client/gpu_video_decode_accelerator_host.cc b/content/common/gpu/client/gpu_video_decode_accelerator_host.cc index 387327b..349585a 100644 --- a/content/common/gpu/client/gpu_video_decode_accelerator_host.cc +++ b/content/common/gpu/client/gpu_video_decode_accelerator_host.cc @@ -18,6 +18,7 @@ #endif // OS_WIN using media::VideoDecodeAccelerator; +namespace content { GpuVideoDecodeAcceleratorHost::GpuVideoDecodeAcceleratorHost( GpuChannelHost* channel, @@ -69,10 +70,10 @@ void GpuVideoDecodeAcceleratorHost::Decode( DCHECK(CalledOnValidThread()); base::SharedMemoryHandle buffer_handle = bitstream_buffer.handle(); #if defined(OS_WIN) - if (!content::BrokerDuplicateHandle(bitstream_buffer.handle(), - channel_->gpu_pid(), - &buffer_handle, 0, - DUPLICATE_SAME_ACCESS)) { + if (!BrokerDuplicateHandle(bitstream_buffer.handle(), + channel_->gpu_pid(), + &buffer_handle, 0, + DUPLICATE_SAME_ACCESS)) { NOTREACHED() << "Failed to duplicate buffer handler"; return; } @@ -203,3 +204,5 @@ void GpuVideoDecodeAcceleratorHost::OnErrorNotification(uint32 error) { static_cast<media::VideoDecodeAccelerator::Error>(error)); client_ = NULL; } + +} // namespace content diff --git a/content/common/gpu/client/gpu_video_decode_accelerator_host.h b/content/common/gpu/client/gpu_video_decode_accelerator_host.h index b46310a..8b13cb2 100644 --- a/content/common/gpu/client/gpu_video_decode_accelerator_host.h +++ b/content/common/gpu/client/gpu_video_decode_accelerator_host.h @@ -12,6 +12,7 @@ #include "ipc/ipc_listener.h" #include "media/video/video_decode_accelerator.h" +namespace content { class GpuChannelHost; // This class is used to talk to VideoDecodeAccelerator in the Gpu process @@ -71,4 +72,6 @@ class GpuVideoDecodeAcceleratorHost DISALLOW_COPY_AND_ASSIGN(GpuVideoDecodeAcceleratorHost); }; +} // namespace content + #endif // CONTENT_COMMON_GPU_CLIENT_GPU_VIDEO_DECODE_ACCELERATOR_HOST_H_ diff --git a/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc b/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc index 9a21f10..581ac6f 100644 --- a/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc +++ b/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc @@ -37,6 +37,7 @@ #include "gpu/ipc/command_buffer_proxy.h" #include "webkit/glue/gl_bindings_skia_cmd_buffer.h" +namespace content { static base::LazyInstance<base::Lock>::Leaky g_all_shared_contexts_lock = LAZY_INSTANCE_INITIALIZER; static base::LazyInstance<std::set<WebGraphicsContext3DCommandBufferImpl*> > @@ -151,7 +152,7 @@ WebGraphicsContext3DCommandBufferImpl::WebGraphicsContext3DCommandBufferImpl( use_echo_for_swap_ack_(true) { #if defined(OS_MACOSX) || defined(OS_WIN) // Get ViewMsg_SwapBuffers_ACK from browser for single-threaded path. - use_echo_for_swap_ack_ = content::IsThreadedCompositingEnabled(); + use_echo_for_swap_ack_ = IsThreadedCompositingEnabled(); #endif } @@ -181,7 +182,7 @@ void WebGraphicsContext3DCommandBufferImpl::InitializeWithCommandBuffer( bool WebGraphicsContext3DCommandBufferImpl::Initialize( const WebGraphicsContext3D::Attributes& attributes, bool bind_generates_resources, - content::CauseForGpuLaunch cause) { + CauseForGpuLaunch cause) { TRACE_EVENT0("gpu", "WebGfxCtx3DCmdBfrImpl::initialize"); attributes_ = attributes; @@ -1453,7 +1454,7 @@ WebGraphicsContext3DCommandBufferImpl::CreateViewContext( const WebGraphicsContext3D::Attributes& attributes, bool bind_generates_resources, const GURL& active_url, - content::CauseForGpuLaunch cause) { + CauseForGpuLaunch cause) { WebGraphicsContext3DCommandBufferImpl* context = new WebGraphicsContext3DCommandBufferImpl( surface_id, @@ -1480,8 +1481,8 @@ WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context( new WebGraphicsContext3DCommandBufferImpl( 0, active_url, factory, null_client)); - content::CauseForGpuLaunch cause = - content::CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE; + CauseForGpuLaunch cause = + CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE; if (context->Initialize(attributes, false, cause)) return context.release(); return NULL; @@ -1603,3 +1604,5 @@ void WebGraphicsContext3DCommandBufferImpl::OnErrorMessage( error_message_callback_->onErrorMessage(str, id); } } + +} // namespace content diff --git a/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h b/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h index c8cde90..d25eb53 100644 --- a/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h +++ b/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h @@ -24,11 +24,6 @@ #endif class CommandBufferProxy; -class GpuChannelHost; -class GpuChannelHostFactory; -struct GpuMemoryAllocationForRenderer; - - namespace gpu { class TransferBuffer; @@ -54,6 +49,11 @@ using WebKit::WGC3Dclampf; using WebKit::WGC3Dintptr; using WebKit::WGC3Dsizeiptr; +namespace content { +class GpuChannelHost; +class GpuChannelHostFactory; +struct GpuMemoryAllocationForRenderer; + // TODO(piman): move this logic to the compositor and remove it from the // context... class WebGraphicsContext3DSwapBuffersClient { @@ -87,7 +87,7 @@ class WebGraphicsContext3DCommandBufferImpl bool Initialize(const Attributes& attributes, bool bind_generates_resources, - content::CauseForGpuLaunch cause); + CauseForGpuLaunch cause); // The following 3 IDs let one uniquely identify this context. // Gets the GPU process ID for this context. @@ -127,7 +127,7 @@ class WebGraphicsContext3DCommandBufferImpl const WebGraphicsContext3D::Attributes& attributes, bool bind_generates_resources, const GURL& active_url, - content::CauseForGpuLaunch cause); + CauseForGpuLaunch cause); // Create & initialize a WebGraphicsContext3DCommandBufferImpl. Return NULL // on any failure. @@ -729,4 +729,6 @@ class WebGraphicsContext3DCommandBufferImpl bool use_echo_for_swap_ack_; }; +} // namespace content + #endif // CONTENT_COMMON_GPU_CLIENT_WEBGRAPHICSCONTEXT3D_COMMAND_BUFFER_IMPL_H_ diff --git a/content/common/gpu/gpu_channel.cc b/content/common/gpu/gpu_channel.cc index 106e922..a139650 100644 --- a/content/common/gpu/gpu_channel.cc +++ b/content/common/gpu/gpu_channel.cc @@ -36,6 +36,7 @@ #include "content/common/gpu/stream_texture_manager_android.h" #endif +namespace content { namespace { // This filter does two things: // - it counts the number of messages coming in on the channel @@ -170,7 +171,7 @@ GpuChannel::GpuChannel(GpuChannelManager* gpu_channel_manager, disallowed_features_.multisampling = command_line->HasSwitch(switches::kDisableGLMultisampling); #if defined(OS_ANDROID) - stream_texture_manager_.reset(new content::StreamTextureManagerAndroid(this)); + stream_texture_manager_.reset(new StreamTextureManagerAndroid(this)); #endif } @@ -571,7 +572,7 @@ void GpuChannel::OnRegisterStreamTextureProxy( } void GpuChannel::OnEstablishStreamTexture( - int32 stream_id, content::SurfaceTexturePeer::SurfaceTextureTarget type, + int32 stream_id, SurfaceTexturePeer::SurfaceTextureTarget type, int32 primary_id, int32 secondary_id) { stream_texture_manager_->EstablishStreamTexture( stream_id, type, primary_id, secondary_id); @@ -580,7 +581,7 @@ void GpuChannel::OnEstablishStreamTexture( void GpuChannel::OnCollectRenderingStatsForSurface( int32 surface_id, IPC::Message* reply_message) { - content::GpuRenderingStats stats; + GpuRenderingStats stats; for (StubMap::Iterator<GpuCommandBufferStub> it(&stubs_); !it.IsAtEnd(); it.Advance()) { @@ -607,3 +608,5 @@ void GpuChannel::OnCollectRenderingStatsForSurface( stats); Send(reply_message); } + +} // namespace content diff --git a/content/common/gpu/gpu_channel.h b/content/common/gpu/gpu_channel.h index fc43820..c790454 100644 --- a/content/common/gpu/gpu_channel.h +++ b/content/common/gpu/gpu_channel.h @@ -28,9 +28,7 @@ #include "content/common/android/surface_texture_peer.h" #endif -class GpuChannelManager; struct GPUCreateCommandBufferConfig; -class GpuWatchdog; namespace base { class MessageLoopProxy; @@ -50,6 +48,10 @@ class StreamTextureManagerAndroid; } #endif +namespace content { +class GpuChannelManager; +class GpuWatchdog; + // Encapsulates an IPC channel between the GPU process and one renderer // process. On the renderer side there's a corresponding GpuChannelHost. class GpuChannel : public IPC::Listener, @@ -135,7 +137,7 @@ class GpuChannel : public IPC::Listener, scoped_refptr<gpu::RefCountedCounter> preempt_by_counter); #if defined(OS_ANDROID) - content::StreamTextureManagerAndroid* stream_texture_manager() { + StreamTextureManagerAndroid* stream_texture_manager() { return stream_texture_manager_.get(); } #endif @@ -168,7 +170,7 @@ class GpuChannel : public IPC::Listener, // Create a java surface texture object and send it to the renderer process // through binder thread. void OnEstablishStreamTexture( - int32 stream_id, content::SurfaceTexturePeer::SurfaceTextureTarget type, + int32 stream_id, SurfaceTexturePeer::SurfaceTextureTarget type, int32 primary_id, int32 secondary_id); #endif @@ -222,7 +224,7 @@ class GpuChannel : public IPC::Listener, bool processed_get_state_fast_; #if defined(OS_ANDROID) - scoped_ptr<content::StreamTextureManagerAndroid> stream_texture_manager_; + scoped_ptr<StreamTextureManagerAndroid> stream_texture_manager_; #endif base::WeakPtrFactory<GpuChannel> weak_factory_; @@ -230,4 +232,6 @@ class GpuChannel : public IPC::Listener, DISALLOW_COPY_AND_ASSIGN(GpuChannel); }; +} // namespace content + #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_H_ diff --git a/content/common/gpu/gpu_channel_manager.cc b/content/common/gpu/gpu_channel_manager.cc index 4b92daf..d39736a 100644 --- a/content/common/gpu/gpu_channel_manager.cc +++ b/content/common/gpu/gpu_channel_manager.cc @@ -18,6 +18,8 @@ #include "ui/gl/gl_bindings.h" #include "ui/gl/gl_share_group.h" +namespace content { + GpuChannelManager::ImageOperation::ImageOperation( int32 sync_point, base::Closure callback) : sync_point(sync_point), @@ -274,3 +276,5 @@ gfx::GLSurface* GpuChannelManager::GetDefaultOffscreenSurface() { } return default_offscreen_surface_.get(); } + +} // namespace content diff --git a/content/common/gpu/gpu_channel_manager.h b/content/common/gpu/gpu_channel_manager.h index 78b5079..9aaeda0 100644 --- a/content/common/gpu/gpu_channel_manager.h +++ b/content/common/gpu/gpu_channel_manager.h @@ -39,10 +39,12 @@ namespace IPC { struct ChannelHandle; } +struct GPUCreateCommandBufferConfig; + +namespace content { class ChildThread; class GpuChannel; class GpuWatchdog; -struct GPUCreateCommandBufferConfig; class SyncPointManager; // A GpuChannelManager is a thread responsible for issuing rendering commands @@ -149,4 +151,6 @@ class GpuChannelManager : public IPC::Listener, DISALLOW_COPY_AND_ASSIGN(GpuChannelManager); }; +} // namespace content + #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_ diff --git a/content/common/gpu/gpu_command_buffer_stub.cc b/content/common/gpu/gpu_command_buffer_stub.cc index 32aa0dc..404d732 100644 --- a/content/common/gpu/gpu_command_buffer_stub.cc +++ b/content/common/gpu/gpu_command_buffer_stub.cc @@ -37,6 +37,7 @@ #include "content/common/gpu/stream_texture_manager_android.h" #endif +namespace content { namespace { // The GpuCommandBufferMemoryTracker class provides a bridge between the @@ -75,7 +76,7 @@ void FastSetActiveURL(const GURL& url, size_t url_hash) { static size_t g_last_url_hash = 0; if (url_hash != g_last_url_hash) { g_last_url_hash = url_hash; - content::GetContentClient()->SetActiveURL(url); + GetContentClient()->SetActiveURL(url); } } @@ -645,7 +646,7 @@ void GpuCommandBufferStub::OnGetTransferBuffer( if (buffer.shared_memory) { #if defined(OS_WIN) transfer_buffer = NULL; - content::BrokerDuplicateHandle(buffer.shared_memory->handle(), + BrokerDuplicateHandle(buffer.shared_memory->handle(), channel_->renderer_pid(), &transfer_buffer, FILE_MAP_READ | FILE_MAP_WRITE, 0); DCHECK(transfer_buffer != NULL); @@ -844,4 +845,6 @@ void GpuCommandBufferStub::SetMemoryAllocation( surface_->SetFrontbufferAllocation(allocation.suggest_have_frontbuffer); } +} // namespace content + #endif // defined(ENABLE_GPU) diff --git a/content/common/gpu/gpu_command_buffer_stub.h b/content/common/gpu/gpu_command_buffer_stub.h index 2bb79b6c..79ec479 100644 --- a/content/common/gpu/gpu_command_buffer_stub.h +++ b/content/common/gpu/gpu_command_buffer_stub.h @@ -33,11 +33,6 @@ #include "ui/surface/accelerated_surface_mac.h" #endif -class GpuChannel; -struct GpuMemoryAllocation; -class GpuVideoDecodeAccelerator; -class GpuWatchdog; - namespace gpu { namespace gles2 { class ImageManager; @@ -45,6 +40,13 @@ class MailboxManager; } } +namespace content { + +class GpuChannel; +class GpuVideoDecodeAccelerator; +class GpuWatchdog; +struct GpuMemoryAllocation; + // This Base class is used to expose methods of GpuCommandBufferStub used for // testability. class CONTENT_EXPORT GpuCommandBufferStubBase { @@ -298,4 +300,6 @@ class GpuCommandBufferStub DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferStub); }; +} // namespace content + #endif // CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_ diff --git a/content/common/gpu/gpu_memory_allocation.h b/content/common/gpu/gpu_memory_allocation.h index fcf31e7..0a748d4 100644 --- a/content/common/gpu/gpu_memory_allocation.h +++ b/content/common/gpu/gpu_memory_allocation.h @@ -7,6 +7,8 @@ #include "base/basictypes.h" +namespace content { + // These are per context memory allocation limits set by the GpuMemoryManager // and assigned to the browser and renderer context. // They will change over time, given memory availability, and browser state. @@ -122,4 +124,6 @@ struct GpuMemoryAllocationRequest { } }; +} // namespace content + #endif // CONTENT_COMMON_GPU_GPU_MEMORY_ALLOCATION_H_ diff --git a/content/common/gpu/gpu_memory_manager.cc b/content/common/gpu/gpu_memory_manager.cc index 3b9ffbd..46fa430 100644 --- a/content/common/gpu/gpu_memory_manager.cc +++ b/content/common/gpu/gpu_memory_manager.cc @@ -19,6 +19,7 @@ #include "content/common/gpu/gpu_memory_tracking.h" #include "gpu/command_buffer/service/gpu_switches.h" +namespace content { namespace { const int kDelayedScheduleManageTimeoutMs = 67; @@ -203,7 +204,7 @@ void GpuMemoryManager::RemoveTrackingGroup( } void GpuMemoryManager::GetVideoMemoryUsageStats( - content::GPUVideoMemoryUsageStats& video_memory_usage_stats) const { + GPUVideoMemoryUsageStats& video_memory_usage_stats) const { // For each context group, assign its memory usage to its PID video_memory_usage_stats.process_map.clear(); for (std::set<GpuMemoryTrackingGroup*>::const_iterator i = @@ -406,4 +407,6 @@ void GpuMemoryManager::Manage() { false); } +} // namespace content + #endif diff --git a/content/common/gpu/gpu_memory_manager.h b/content/common/gpu/gpu_memory_manager.h index a3a65cc..1256bb7 100644 --- a/content/common/gpu/gpu_memory_manager.h +++ b/content/common/gpu/gpu_memory_manager.h @@ -19,20 +19,24 @@ #include "content/public/common/gpu_memory_stats.h" #include "ui/gfx/size.h" +namespace content { class GpuCommandBufferStubBase; -class GpuMemoryTrackingGroup; +} #if defined(COMPILER_GCC) namespace BASE_HASH_NAMESPACE { template<> -struct hash<GpuCommandBufferStubBase*> { - size_t operator()(GpuCommandBufferStubBase* ptr) const { +struct hash<content::GpuCommandBufferStubBase*> { + size_t operator()(content::GpuCommandBufferStubBase* ptr) const { return hash<size_t>()(reinterpret_cast<size_t>(ptr)); } }; } // namespace BASE_HASH_NAMESPACE #endif // COMPILER +namespace content { +class GpuMemoryTrackingGroup; + class CONTENT_EXPORT GpuMemoryManagerClient { public: virtual ~GpuMemoryManagerClient() {} @@ -176,6 +180,8 @@ size_t GetMaximumTabAllocation() const { DISALLOW_COPY_AND_ASSIGN(GpuMemoryManager); }; +} // namespace content + #endif #endif // CONTENT_COMMON_GPU_GPU_MEMORY_MANAGER_H_ diff --git a/content/common/gpu/gpu_memory_manager_unittest.cc b/content/common/gpu/gpu_memory_manager_unittest.cc index 549a246..bb57f30 100644 --- a/content/common/gpu/gpu_memory_manager_unittest.cc +++ b/content/common/gpu/gpu_memory_manager_unittest.cc @@ -9,6 +9,8 @@ #include "testing/gtest/include/gtest/gtest.h" +namespace content { + class FakeCommandBufferStub : public GpuCommandBufferStubBase { public: MemoryManagerState memory_manager_state_; @@ -682,3 +684,5 @@ TEST_F(GpuMemoryManagerTest, StubMemoryStatsForLastManageTests) { stub3allocation3 != GetMaximumTabAllocation()) EXPECT_GT(stub3allocation4, stub3allocation3); } + +} // namespace content diff --git a/content/common/gpu/gpu_memory_tracking.h b/content/common/gpu/gpu_memory_tracking.h index c20ad85..c8c7148 100644 --- a/content/common/gpu/gpu_memory_tracking.h +++ b/content/common/gpu/gpu_memory_tracking.h @@ -10,6 +10,8 @@ #include "base/basictypes.h" #include "content/common/gpu/gpu_memory_manager.h" +namespace content { + // All decoders in a context group point to a single GpuMemoryTrackingGroup, // which tracks GPU resource consumption for the entire context group. class GpuMemoryTrackingGroup { @@ -48,6 +50,8 @@ class GpuMemoryTrackingGroup { GpuMemoryManager* memory_manager_; }; +} // namespace content + #endif #endif // CONTENT_COMMON_GPU_GPU_MEMORY_TRACKING_H_ diff --git a/content/common/gpu/gpu_messages.h b/content/common/gpu/gpu_messages.h index e731d98..8645531 100644 --- a/content/common/gpu/gpu_messages.h +++ b/content/common/gpu/gpu_messages.h @@ -174,7 +174,7 @@ IPC_STRUCT_TRAITS_BEGIN(content::GPUVideoMemoryUsageStats) IPC_STRUCT_TRAITS_MEMBER(process_map) IPC_STRUCT_TRAITS_END() -IPC_STRUCT_TRAITS_BEGIN(GpuMemoryAllocationForRenderer) +IPC_STRUCT_TRAITS_BEGIN(content::GpuMemoryAllocationForRenderer) IPC_STRUCT_TRAITS_MEMBER(gpu_resource_size_in_bytes) IPC_STRUCT_TRAITS_MEMBER(suggest_have_backbuffer) IPC_STRUCT_TRAITS_END() @@ -554,7 +554,7 @@ IPC_MESSAGE_ROUTED0(GpuCommandBufferMsg_EnsureBackbuffer) // Sent to proxy when the gpu memory manager changes its memory allocation. IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_SetMemoryAllocation, - GpuMemoryAllocationForRenderer /* allocation */) + content::GpuMemoryAllocationForRenderer /* allocation */) // Sent to stub when proxy is assigned a memory allocation changed callback. IPC_MESSAGE_ROUTED1( diff --git a/content/common/gpu/gpu_watchdog.h b/content/common/gpu/gpu_watchdog.h index bc421ce..3f42513 100644 --- a/content/common/gpu/gpu_watchdog.h +++ b/content/common/gpu/gpu_watchdog.h @@ -5,6 +5,8 @@ #ifndef CONTENT_COMMON_GPU_GPU_WATCHDOG_H_ #define CONTENT_COMMON_GPU_GPU_WATCHDOG_H_ +namespace content { + // Interface for objects that monitor the a GPUProcessor's progress. The // GPUProcessor will regularly invoke CheckArmed. class GpuWatchdog { @@ -19,4 +21,6 @@ class GpuWatchdog { DISALLOW_COPY_AND_ASSIGN(GpuWatchdog); }; +} // namespace content + #endif // CONTENT_COMMON_GPU_GPU_WATCHDOG_H_ diff --git a/content/common/gpu/image_transport_surface.cc b/content/common/gpu/image_transport_surface.cc index 1b1428b..8c1241d 100644 --- a/content/common/gpu/image_transport_surface.cc +++ b/content/common/gpu/image_transport_surface.cc @@ -18,6 +18,8 @@ #include "ui/gl/gl_switches.h" #include "ui/gl/gl_implementation.h" +namespace content { + ImageTransportSurface::ImageTransportSurface() {} ImageTransportSurface::~ImageTransportSurface() {} @@ -337,4 +339,6 @@ gfx::Size PassThroughImageTransportSurface::GetSize() { PassThroughImageTransportSurface::~PassThroughImageTransportSurface() {} +} // namespace content + #endif // defined(ENABLE_GPU) diff --git a/content/common/gpu/image_transport_surface.h b/content/common/gpu/image_transport_surface.h index 348b5f6..3a9849e 100644 --- a/content/common/gpu/image_transport_surface.h +++ b/content/common/gpu/image_transport_surface.h @@ -22,9 +22,6 @@ #include "ui/gl/gl_surface.h" #include "ui/surface/transport_dib.h" -class GpuChannelManager; -class GpuCommandBufferStub; - struct GpuHostMsg_AcceleratedSurfaceNew_Params; struct GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params; struct GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params; @@ -42,6 +39,10 @@ class GLES2Decoder; } } +namespace content { +class GpuChannelManager; +class GpuCommandBufferStub; + // The GPU process is agnostic as to how it displays results. On some platforms // it renders directly to window. On others it renders offscreen and transports // the results to the browser process to display. This file provides a simple @@ -193,6 +194,8 @@ class PassThroughImageTransportSurface DISALLOW_COPY_AND_ASSIGN(PassThroughImageTransportSurface); }; +} // namespace content + #endif // defined(ENABLE_GPU) #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_H_ diff --git a/content/common/gpu/image_transport_surface_android.cc b/content/common/gpu/image_transport_surface_android.cc index 3aa190c..045a4c8 100644 --- a/content/common/gpu/image_transport_surface_android.cc +++ b/content/common/gpu/image_transport_surface_android.cc @@ -9,6 +9,8 @@ #include "content/common/gpu/texture_image_transport_surface.h" #include "ui/gl/gl_surface_egl.h" +namespace content { + // static scoped_refptr<gfx::GLSurface> ImageTransportSurface::CreateSurface( GpuChannelManager* manager, @@ -41,3 +43,5 @@ scoped_refptr<gfx::GLSurface> ImageTransportSurface::CreateSurface( return NULL; } } + +} // namespace content diff --git a/content/common/gpu/image_transport_surface_linux.cc b/content/common/gpu/image_transport_surface_linux.cc index 7957984..ffa2b5a 100644 --- a/content/common/gpu/image_transport_surface_linux.cc +++ b/content/common/gpu/image_transport_surface_linux.cc @@ -6,6 +6,8 @@ #include "content/common/gpu/texture_image_transport_surface.h" +namespace content { + // static scoped_refptr<gfx::GLSurface> ImageTransportSurface::CreateSurface( GpuChannelManager* manager, @@ -31,3 +33,5 @@ scoped_refptr<gfx::GLSurface> ImageTransportSurface::CreateSurface( else return NULL; } + +} // namespace content diff --git a/content/common/gpu/image_transport_surface_mac.cc b/content/common/gpu/image_transport_surface_mac.cc index 729068b..bb9defe 100644 --- a/content/common/gpu/image_transport_surface_mac.cc +++ b/content/common/gpu/image_transport_surface_mac.cc @@ -16,6 +16,7 @@ #include "ui/gl/gl_surface_cgl.h" #include "ui/surface/io_surface_support_mac.h" +namespace content { namespace { // IOSurface dimensions will be rounded up to a multiple of this value in order @@ -438,4 +439,6 @@ scoped_refptr<gfx::GLSurface> ImageTransportSurface::CreateSurface( return NULL; } +} // namespace content + #endif // defined(USE_GPU) diff --git a/content/common/gpu/image_transport_surface_win.cc b/content/common/gpu/image_transport_surface_win.cc index 1510f90..bc4953a 100644 --- a/content/common/gpu/image_transport_surface_win.cc +++ b/content/common/gpu/image_transport_surface_win.cc @@ -24,6 +24,7 @@ #include "ui/gl/gl_implementation.h" #include "ui/gl/gl_surface_egl.h" +namespace content { namespace { // We are backed by an Pbuffer offscreen surface through which ANGLE provides @@ -285,4 +286,6 @@ scoped_refptr<gfx::GLSurface> ImageTransportSurface::CreateSurface( return NULL; } +} // namespace content + #endif // ENABLE_GPU diff --git a/content/common/gpu/media/gpu_video_decode_accelerator.cc b/content/common/gpu/media/gpu_video_decode_accelerator.cc index cc1e247..cf869ad 100644 --- a/content/common/gpu/media/gpu_video_decode_accelerator.cc +++ b/content/common/gpu/media/gpu_video_decode_accelerator.cc @@ -36,6 +36,8 @@ using gpu::gles2::TextureManager; +namespace content { + static bool MakeDecoderContextCurrent( const base::WeakPtr<GpuCommandBufferStub> stub) { if (!stub) { @@ -304,3 +306,5 @@ bool GpuVideoDecodeAccelerator::Send(IPC::Message* message) { DCHECK(sender_); return sender_->Send(message); } + +} // namespace content diff --git a/content/common/gpu/media/gpu_video_decode_accelerator.h b/content/common/gpu/media/gpu_video_decode_accelerator.h index 6f7566c..1574b96 100644 --- a/content/common/gpu/media/gpu_video_decode_accelerator.h +++ b/content/common/gpu/media/gpu_video_decode_accelerator.h @@ -15,6 +15,8 @@ #include "ipc/ipc_sender.h" #include "media/video/video_decode_accelerator.h" +namespace content { + class GpuVideoDecodeAccelerator : public IPC::Listener, public IPC::Sender, @@ -94,4 +96,6 @@ class GpuVideoDecodeAccelerator DISALLOW_IMPLICIT_CONSTRUCTORS(GpuVideoDecodeAccelerator); }; +} // namespace content + #endif // CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_DECODE_ACCELERATOR_H_ diff --git a/content/common/gpu/stream_texture_manager_android.h b/content/common/gpu/stream_texture_manager_android.h index f0529d3..342ff40 100644 --- a/content/common/gpu/stream_texture_manager_android.h +++ b/content/common/gpu/stream_texture_manager_android.h @@ -13,7 +13,6 @@ #include "gpu/command_buffer/service/stream_texture.h" #include "gpu/command_buffer/service/stream_texture_manager.h" -class GpuChannel; struct GpuStreamTextureMsg_MatrixChanged_Params; namespace gfx { @@ -21,6 +20,7 @@ class Size; } namespace content { +class GpuChannel; class SurfaceTextureBridge; diff --git a/content/common/gpu/sync_point_manager.cc b/content/common/gpu/sync_point_manager.cc index 299d499..917871c 100644 --- a/content/common/gpu/sync_point_manager.cc +++ b/content/common/gpu/sync_point_manager.cc @@ -6,6 +6,8 @@ #include "base/logging.h" +namespace content { + SyncPointManager::SyncPointManager() : next_sync_point_(1) { } @@ -54,3 +56,5 @@ void SyncPointManager::AddSyncPointCallback(uint32 sync_point, } callback.Run(); } + +} // namespace content diff --git a/content/common/gpu/sync_point_manager.h b/content/common/gpu/sync_point_manager.h index fde3373..ea33ff3 100644 --- a/content/common/gpu/sync_point_manager.h +++ b/content/common/gpu/sync_point_manager.h @@ -13,6 +13,8 @@ #include "base/synchronization/lock.h" #include "base/threading/thread_checker.h" +namespace content { + // This class manages the sync points, which allow cross-channel // synchronization. class SyncPointManager : public base::RefCountedThreadSafe<SyncPointManager> { @@ -51,4 +53,6 @@ class SyncPointManager : public base::RefCountedThreadSafe<SyncPointManager> { DISALLOW_COPY_AND_ASSIGN(SyncPointManager); }; +} // namespace content + #endif // CONTENT_COMMON_GPU_SYNC_POINT_MANAGER_H_ diff --git a/content/common/gpu/texture_image_transport_surface.cc b/content/common/gpu/texture_image_transport_surface.cc index 7078a3e..ab0a276 100644 --- a/content/common/gpu/texture_image_transport_surface.cc +++ b/content/common/gpu/texture_image_transport_surface.cc @@ -22,6 +22,8 @@ using gpu::gles2::ContextGroup; using gpu::gles2::TextureManager; typedef TextureManager::TextureInfo TextureInfo; +namespace content { + TextureImageTransportSurface::Texture::Texture() : client_id(0), sent_to_client(false) { @@ -305,13 +307,13 @@ bool TextureImageTransportSurface::PostSubBuffer( std::vector<gfx::Rect> regions_to_copy; GetRegionsToCopy(previous_damage_rect_, new_damage_rect, ®ions_to_copy); - content::ScopedFrameBufferBinder fbo_binder(fbo_id_); + ScopedFrameBufferBinder fbo_binder(fbo_id_); glFramebufferTexture2DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, front_texture_service_id, 0); - content::ScopedTextureBinder texture_binder(back_texture_service_id); + ScopedTextureBinder texture_binder(back_texture_service_id); for (size_t i = 0; i < regions_to_copy.size(); ++i) { const gfx::Rect& region_to_copy = regions_to_copy[i]; @@ -445,7 +447,7 @@ void TextureImageTransportSurface::ReleaseTexture(int id) { info->SetServiceId(0); { - content::ScopedFrameBufferBinder fbo_binder(fbo_id_); + ScopedFrameBufferBinder fbo_binder(fbo_id_); glDeleteTextures(1, &service_id); } glFlush(); @@ -488,7 +490,7 @@ void TextureImageTransportSurface::CreateBackTexture(const gfx::Size& size) { } { - content::ScopedTextureBinder texture_binder(service_id); + ScopedTextureBinder texture_binder(service_id); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); @@ -515,7 +517,7 @@ void TextureImageTransportSurface::AttachBackTextureToFBO() { TextureInfo* info = textures_[back()].info; DCHECK(info); - content::ScopedFrameBufferBinder fbo_binder(fbo_id_); + ScopedFrameBufferBinder fbo_binder(fbo_id_); glFramebufferTexture2DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, @@ -546,3 +548,5 @@ void TextureImageTransportSurface::ReleaseParentStub() { } parent_stub_ = NULL; } + +} // namespace content diff --git a/content/common/gpu/texture_image_transport_surface.h b/content/common/gpu/texture_image_transport_surface.h index 66964c9..0d19d0f 100644 --- a/content/common/gpu/texture_image_transport_surface.h +++ b/content/common/gpu/texture_image_transport_surface.h @@ -12,6 +12,7 @@ #include "gpu/command_buffer/service/texture_manager.h" #include "ui/gl/gl_surface.h" +namespace content { class GpuChannelManager; class TextureImageTransportSurface : @@ -124,4 +125,6 @@ class TextureImageTransportSurface : DISALLOW_COPY_AND_ASSIGN(TextureImageTransportSurface); }; +} // namespace content + #endif // CONTENT_COMMON_GPU_TEXTURE_IMAGE_TRANSPORT_SURFACE_H_ |