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

Unified Diff: content/browser/gpu/gpu_process_host.h

Issue 7054005: Fix gpu acceleration with --in-process-gpu (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: cleanup Created 9 years, 7 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
Index: content/browser/gpu/gpu_process_host.h
diff --git a/content/browser/gpu/gpu_process_host.h b/content/browser/gpu/gpu_process_host.h
index abf72801234e19b4480744eec1153d0eab4f6505..0718702bff0bd252e06fbe7c60abad6df4f7ee36 100644
--- a/content/browser/gpu/gpu_process_host.h
+++ b/content/browser/gpu/gpu_process_host.h
@@ -6,14 +6,13 @@
#define CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_
#pragma once
-#include <map>
#include <queue>
-#include "base/callback_old.h"
-#include "base/memory/linked_ptr.h"
+#include "base/memory/scoped_ptr.h"
#include "base/threading/non_thread_safe.h"
#include "content/browser/browser_child_process_host.h"
#include "content/common/gpu/gpu_info.h"
+#include "content/browser/gpu/gpu_message_hub.h"
#include "content/common/gpu/gpu_process_launch_causes.h"
#include "ui/gfx/native_widget_types.h"
@@ -53,33 +52,7 @@ class GpuProcessHost : public BrowserChildProcessHost,
virtual bool OnMessageReceived(const IPC::Message& message);
virtual void OnChannelConnected(int32 peer_pid);
- typedef Callback3<const IPC::ChannelHandle&,
- base::ProcessHandle,
- const GPUInfo&>::Type
- EstablishChannelCallback;
-
- // Tells the GPU process to create a new channel for communication with a
- // renderer. Once the GPU process responds asynchronously with the IPC handle
- // and GPUInfo, we call the callback.
- void EstablishGpuChannel(
- int renderer_id, EstablishChannelCallback* callback);
-
- typedef Callback0::Type SynchronizeCallback;
-
- // Sends a reply message later when the next GpuHostMsg_SynchronizeReply comes
- // in.
- void Synchronize(SynchronizeCallback* callback);
-
- typedef Callback1<int32>::Type CreateCommandBufferCallback;
-
- // Tells the GPU process to create a new command buffer that draws into the
- // window associated with the given renderer.
- void CreateViewCommandBuffer(
- gfx::PluginWindowHandle compositing_surface,
- int32 render_view_id,
- int32 renderer_id,
- const GPUCreateCommandBufferConfig& init_params,
- CreateCommandBufferCallback* callback);
+ GpuMessageHub* GetMessageHub() { return message_hub_.get(); }
private:
GpuProcessHost(int host_id);
@@ -87,70 +60,28 @@ class GpuProcessHost : public BrowserChildProcessHost,
bool Init();
- // Post an IPC message to the UI shim's message handler on the UI thread.
- void RouteOnUIThread(const IPC::Message& message);
-
virtual bool CanShutdown();
virtual void OnProcessLaunched();
virtual void OnChildDied();
virtual void OnProcessCrashed(int exit_code);
- // Message handlers.
- void OnChannelEstablished(const IPC::ChannelHandle& channel_handle);
- void OnSynchronizeReply();
- void OnCommandBufferCreated(const int32 route_id);
- void OnDestroyCommandBuffer(
- gfx::PluginWindowHandle window, int32 renderer_id, int32 render_view_id);
- void OnGraphicsInfoCollected(const GPUInfo& gpu_info);
-
bool LaunchGpuProcess();
void SendOutstandingReplies();
- void EstablishChannelError(
- EstablishChannelCallback* callback,
- const IPC::ChannelHandle& channel_handle,
- base::ProcessHandle renderer_process_for_gpu,
- const GPUInfo& gpu_info);
- void CreateCommandBufferError(CreateCommandBufferCallback* callback,
- int32 route_id);
- void SynchronizeError(SynchronizeCallback* callback);
// The serial number of the GpuProcessHost / GpuProcessHostUIShim pair.
int host_id_;
- // These are the channel requests that we have already sent to
- // the GPU process, but haven't heard back about yet.
- std::queue<linked_ptr<EstablishChannelCallback> > channel_requests_;
-
- // The pending synchronization requests we need to reply to.
- std::queue<linked_ptr<SynchronizeCallback> > synchronize_requests_;
-
- // The pending create command buffer requests we need to reply to.
- std::queue<linked_ptr<CreateCommandBufferCallback> >
- create_command_buffer_requests_;
-
-#if defined(OS_LINUX)
- typedef std::pair<int32 /* renderer_id */,
- int32 /* render_view_id */> ViewID;
-
- // Encapsulates surfaces that we lock when creating view command buffers.
- // We release this lock once the command buffer (or associated GPU process)
- // is destroyed. This prevents the browser from destroying the surface
- // while the GPU process is drawing to it.
-
- // Multimap is used to simulate reference counting, see comment in
- // GpuProcessHostUIShim::CreateViewCommandBuffer.
- class SurfaceRef;
- typedef std::multimap<ViewID, linked_ptr<SurfaceRef> > SurfaceRefMap;
- SurfaceRefMap surface_refs_;
-#endif
-
// Qeueud messages to send when the process launches.
std::queue<IPC::Message*> queued_messages_;
// The handle for the GPU process or null if it is not known to be launched.
base::ProcessHandle gpu_process_;
+ // This member handles incoming messages from the GPU process that
+ // are either going to the UI thread or are replies to the renderer.
+ scoped_ptr<GpuMessageHub> message_hub_;
+
DISALLOW_COPY_AND_ASSIGN(GpuProcessHost);
};

Powered by Google App Engine
This is Rietveld 408576698