Index: content/gpu/gpu_child_thread.h |
diff --git a/content/gpu/gpu_child_thread.h b/content/gpu/gpu_child_thread.h |
index f8337d4fbc2a35bb336a03d539036cf440630bea..ec0e33f683d3aaecf0994bb83a26e85f7ecc5e51 100644 |
--- a/content/gpu/gpu_child_thread.h |
+++ b/content/gpu/gpu_child_thread.h |
@@ -19,6 +19,7 @@ |
#include "base/time/time.h" |
#include "build/build_config.h" |
#include "content/child/child_thread_impl.h" |
+#include "content/common/associated_interface_registry_impl.h" |
#include "gpu/command_buffer/service/gpu_preferences.h" |
#include "gpu/config/gpu_info.h" |
#include "gpu/ipc/service/gpu_channel.h" |
@@ -26,19 +27,16 @@ |
#include "gpu/ipc/service/gpu_channel_manager_delegate.h" |
#include "gpu/ipc/service/gpu_config.h" |
#include "gpu/ipc/service/x_util.h" |
+#include "mojo/public/cpp/bindings/associated_binding_set.h" |
#include "mojo/public/cpp/bindings/binding_set.h" |
#include "services/service_manager/public/interfaces/service_factory.mojom.h" |
+#include "services/ui/gpu/gpu_service.h" |
#include "services/ui/gpu/interfaces/gpu_main.mojom.h" |
#include "ui/gfx/native_widget_types.h" |
namespace gpu { |
class GpuMemoryBufferFactory; |
class GpuWatchdogThread; |
-class SyncPointManager; |
-} |
- |
-namespace media { |
-class MediaGpuChannelManager; |
} |
namespace sandbox { |
@@ -54,7 +52,7 @@ struct EstablishChannelParams; |
// IPC messages to gpu::GpuChannelManager, which is responsible for issuing |
// rendering commands to the GPU. |
class GpuChildThread : public ChildThreadImpl, |
- public gpu::GpuChannelManagerDelegate, |
+ public ui::mojom::GpuMain, |
public base::FieldTrialList::Observer { |
public: |
struct LogMessage { |
@@ -80,7 +78,9 @@ class GpuChildThread : public ChildThreadImpl, |
void Init(const base::Time& process_start_time); |
- gpu::GpuWatchdogThread* watchdog_thread() { return watchdog_thread_.get(); } |
+ gpu::GpuWatchdogThread* watchdog_thread() { |
+ return gpu_service_->watchdog_thread(); |
+ } |
private: |
void CreateGpuMainService(ui::mojom::GpuMainAssociatedRequest request); |
@@ -90,29 +90,24 @@ class GpuChildThread : public ChildThreadImpl, |
bool OnControlMessageReceived(const IPC::Message& msg) override; |
bool OnMessageReceived(const IPC::Message& msg) override; |
- // gpu::GpuChannelManagerDelegate: |
- void SetActiveURL(const GURL& url) override; |
- void DidCreateOffscreenContext(const GURL& active_url) override; |
- void DidDestroyChannel(int client_id) override; |
- void DidDestroyOffscreenContext(const GURL& active_url) override; |
- void DidLoseContext(bool offscreen, |
- gpu::error::ContextLostReason reason, |
- const GURL& active_url) override; |
-#if defined(OS_WIN) |
- void SendAcceleratedSurfaceCreatedChildWindow( |
- gpu::SurfaceHandle parent_window, |
- gpu::SurfaceHandle child_window) override; |
-#endif |
- void StoreShaderToDisk(int32_t client_id, |
- const std::string& key, |
- const std::string& shader) override; |
+ // IPC::Listener implementation via ChildThreadImpl: |
+ void OnAssociatedInterfaceRequest( |
+ const std::string& name, |
+ mojo::ScopedInterfaceEndpointHandle handle) override; |
+ |
+ // ui::mojom::GpuMain: |
+ void CreateGpuService(ui::mojom::GpuServiceRequest request, |
+ ui::mojom::GpuHostPtr gpu_host, |
+ const gpu::GpuPreferences& preferences) override; |
+ void CreateDisplayCompositor( |
+ cc::mojom::DisplayCompositorRequest request, |
+ cc::mojom::DisplayCompositorClientPtr client) override; |
// base::FieldTrialList::Observer: |
void OnFieldTrialGroupFinalized(const std::string& trial_name, |
const std::string& group_name) override; |
// Message handlers. |
- void OnInitialize(const gpu::GpuPreferences& gpu_preferences); |
void OnFinalize(); |
void OnCollectGraphicsInfo(); |
void OnGetVideoMemoryUsageStats(); |
@@ -133,29 +128,24 @@ class GpuChildThread : public ChildThreadImpl, |
void OnWakeUpGpu(); |
void OnDestroyingVideoSurface(int surface_id); |
#endif |
- void OnLoseAllContexts(); |
void BindServiceFactoryRequest( |
service_manager::mojom::ServiceFactoryRequest request); |
+ gpu::GpuChannelManager* gpu_channel_manager() { |
+ return gpu_service_->gpu_channel_manager(); |
+ } |
+ |
// Set this flag to true if a fatal error occurred before we receive the |
// OnInitialize message, in which case we just declare ourselves DOA. |
const bool dead_on_arrival_; |
base::Time process_start_time_; |
- std::unique_ptr<gpu::GpuWatchdogThread> watchdog_thread_; |
#if defined(OS_WIN) |
// Windows specific client sandbox interface. |
sandbox::TargetServices* target_services_; |
#endif |
- // Can be null if overridden by ContentGpuClient. |
- std::unique_ptr<gpu::SyncPointManager> owned_sync_point_manager_; |
- |
- std::unique_ptr<gpu::GpuChannelManager> gpu_channel_manager_; |
- |
- std::unique_ptr<media::MediaGpuChannelManager> media_gpu_channel_manager_; |
- |
// Information about the GPU, such as device and vendor ID. |
gpu::GPUInfo gpu_info_; |
@@ -165,9 +155,6 @@ class GpuChildThread : public ChildThreadImpl, |
// Whether the GPU thread is running in the browser process. |
bool in_browser_process_; |
- // The gpu::GpuMemoryBufferFactory instance used to allocate GpuMemoryBuffers. |
- gpu::GpuMemoryBufferFactory* const gpu_memory_buffer_factory_; |
- |
// ServiceFactory for service_manager::Service hosting. |
std::unique_ptr<GpuServiceFactory> service_factory_; |
@@ -175,6 +162,10 @@ class GpuChildThread : public ChildThreadImpl, |
mojo::BindingSet<service_manager::mojom::ServiceFactory> |
service_factory_bindings_; |
+ AssociatedInterfaceRegistryImpl associated_interfaces_; |
+ std::unique_ptr<ui::GpuService> gpu_service_; |
+ mojo::AssociatedBinding<ui::mojom::GpuMain> gpu_main_binding_; |
+ |
DISALLOW_COPY_AND_ASSIGN(GpuChildThread); |
}; |