summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorksakamoto@chromium.org <ksakamoto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-18 06:07:26 +0000
committerksakamoto@chromium.org <ksakamoto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-18 06:07:26 +0000
commit206815d10599032d7b59d21a00ae03b2a62bfa5b (patch)
tree7d980ef952568f6394cbae5189e2ba26c6b3aade /content
parent9283bb2c1c5af97ac48c4b5e00a02b68638925a6 (diff)
downloadchromium_src-206815d10599032d7b59d21a00ae03b2a62bfa5b.zip
chromium_src-206815d10599032d7b59d21a00ae03b2a62bfa5b.tar.gz
chromium_src-206815d10599032d7b59d21a00ae03b2a62bfa5b.tar.bz2
Revert 241425 "Aura: Don't create GL context for CreateSharedSur..."
Speculative revert for browser_tests failure on Linux Aura Tests http://build.chromium.org/p/chromium.linux/builders/Linux%20Aura%20Tests/builds/207 > Aura: Don't create GL context for CreateSharedSurfaceHandle() > > The context is used for blocking renders that are trying to create > a context after the GPU process crashed through comparing > gpu process IDs. > > Remove this code as we can handle SwapCompositorFrame > more gracefully nowadays after resources were lost. > But still fail renderer view context creation when > gpu browser compositing gets turned off. > > BUG=270179 > > Review URL: https://codereview.chromium.org/111063003 TBR=sievers@chromium.org Review URL: https://codereview.chromium.org/118003002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@241508 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/browser/aura/gpu_process_transport_factory.cc12
-rw-r--r--content/browser/aura/gpu_process_transport_factory.h4
-rw-r--r--content/browser/aura/image_transport_factory.h8
-rw-r--r--content/browser/aura/no_transport_image_transport_factory.cc5
-rw-r--r--content/browser/aura/no_transport_image_transport_factory.h4
-rw-r--r--content/browser/gpu/browser_gpu_channel_host_factory.cc1
-rw-r--r--content/browser/renderer_host/gpu_message_filter.cc33
-rw-r--r--content/browser/renderer_host/gpu_message_filter.h5
-rw-r--r--content/browser/renderer_host/render_process_host_impl.cc9
-rw-r--r--content/browser/renderer_host/render_process_host_impl.h1
-rw-r--r--content/browser/renderer_host/render_widget_host_impl.cc6
-rw-r--r--content/browser/renderer_host/render_widget_host_impl.h4
-rw-r--r--content/browser/renderer_host/render_widget_host_unittest.cc5
-rw-r--r--content/browser/renderer_host/render_widget_host_view_aura.cc23
-rw-r--r--content/browser/renderer_host/render_widget_host_view_aura.h2
-rw-r--r--content/common/gpu/client/gpu_channel_host.cc5
-rw-r--r--content/common/gpu/client/gpu_channel_host.h4
-rw-r--r--content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc5
-rw-r--r--content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h4
-rw-r--r--content/common/gpu/gpu_messages.h1
-rw-r--r--content/public/browser/render_process_host.h5
-rw-r--r--content/public/test/mock_render_process_host.cc3
-rw-r--r--content/public/test/mock_render_process_host.h1
-rw-r--r--content/renderer/render_thread_impl.cc3
24 files changed, 131 insertions, 22 deletions
diff --git a/content/browser/aura/gpu_process_transport_factory.cc b/content/browser/aura/gpu_process_transport_factory.cc
index 7288155..ee92513 100644
--- a/content/browser/aura/gpu_process_transport_factory.cc
+++ b/content/browser/aura/gpu_process_transport_factory.cc
@@ -283,14 +283,24 @@ ui::ContextFactory* GpuProcessTransportFactory::AsContextFactory() {
return this;
}
-gfx::GLSurfaceHandle GpuProcessTransportFactory::GetSharedSurfaceHandle() {
+gfx::GLSurfaceHandle GpuProcessTransportFactory::CreateSharedSurfaceHandle() {
+ scoped_refptr<cc::ContextProvider> provider =
+ SharedMainThreadContextProvider();
+ if (!provider.get())
+ return gfx::GLSurfaceHandle();
+ typedef WebGraphicsContext3DCommandBufferImpl WGC3DCBI;
+ WGC3DCBI* context = static_cast<WGC3DCBI*>(provider->Context3d());
gfx::GLSurfaceHandle handle = gfx::GLSurfaceHandle(
gfx::kNullPluginWindow, gfx::TEXTURE_TRANSPORT);
+ handle.parent_gpu_process_id = context->GetGPUProcessID();
handle.parent_client_id =
BrowserGpuChannelHostFactory::instance()->GetGpuChannelId();
return handle;
}
+void GpuProcessTransportFactory::DestroySharedSurfaceHandle(
+ gfx::GLSurfaceHandle surface) {}
+
scoped_refptr<ui::Texture> GpuProcessTransportFactory::CreateTransportClient(
float device_scale_factor) {
scoped_refptr<cc::ContextProvider> provider =
diff --git a/content/browser/aura/gpu_process_transport_factory.h b/content/browser/aura/gpu_process_transport_factory.h
index da977b5..13da92b 100644
--- a/content/browser/aura/gpu_process_transport_factory.h
+++ b/content/browser/aura/gpu_process_transport_factory.h
@@ -51,7 +51,9 @@ class GpuProcessTransportFactory
// ImageTransportFactory implementation.
virtual ui::ContextFactory* AsContextFactory() OVERRIDE;
- virtual gfx::GLSurfaceHandle GetSharedSurfaceHandle() OVERRIDE;
+ virtual gfx::GLSurfaceHandle CreateSharedSurfaceHandle() OVERRIDE;
+ virtual void DestroySharedSurfaceHandle(
+ gfx::GLSurfaceHandle surface) OVERRIDE;
virtual scoped_refptr<ui::Texture> CreateTransportClient(
float device_scale_factor) OVERRIDE;
virtual scoped_refptr<ui::Texture> CreateOwnedTexture(
diff --git a/content/browser/aura/image_transport_factory.h b/content/browser/aura/image_transport_factory.h
index 51bce67..fecb442 100644
--- a/content/browser/aura/image_transport_factory.h
+++ b/content/browser/aura/image_transport_factory.h
@@ -67,7 +67,13 @@ class CONTENT_EXPORT ImageTransportFactory {
// Gets the image transport factory as a context factory for the compositor.
virtual ui::ContextFactory* AsContextFactory() = 0;
- virtual gfx::GLSurfaceHandle GetSharedSurfaceHandle() = 0;
+ // Creates a shared surface handle.
+ // Note: the handle may get lost at any time, a state that an
+ // ImageTransportFactoryObserver gets notified of.
+ virtual gfx::GLSurfaceHandle CreateSharedSurfaceHandle() = 0;
+
+ // Destroys a shared surface handle.
+ virtual void DestroySharedSurfaceHandle(gfx::GLSurfaceHandle surface) = 0;
// Creates a transport texture for a given scale factor.
virtual scoped_refptr<ui::Texture> CreateTransportClient(
diff --git a/content/browser/aura/no_transport_image_transport_factory.cc b/content/browser/aura/no_transport_image_transport_factory.cc
index d723e59..7f68e02 100644
--- a/content/browser/aura/no_transport_image_transport_factory.cc
+++ b/content/browser/aura/no_transport_image_transport_factory.cc
@@ -51,10 +51,13 @@ ui::ContextFactory* NoTransportImageTransportFactory::AsContextFactory() {
}
gfx::GLSurfaceHandle
-NoTransportImageTransportFactory::GetSharedSurfaceHandle() {
+NoTransportImageTransportFactory::CreateSharedSurfaceHandle() {
return gfx::GLSurfaceHandle();
}
+void NoTransportImageTransportFactory::DestroySharedSurfaceHandle(
+ gfx::GLSurfaceHandle surface) {}
+
scoped_refptr<ui::Texture>
NoTransportImageTransportFactory::CreateTransportClient(
float device_scale_factor) {
diff --git a/content/browser/aura/no_transport_image_transport_factory.h b/content/browser/aura/no_transport_image_transport_factory.h
index e9fa650..dd551d9 100644
--- a/content/browser/aura/no_transport_image_transport_factory.h
+++ b/content/browser/aura/no_transport_image_transport_factory.h
@@ -23,7 +23,9 @@ class NoTransportImageTransportFactory : public ImageTransportFactory {
// ImageTransportFactory implementation.
virtual ui::ContextFactory* AsContextFactory() OVERRIDE;
- virtual gfx::GLSurfaceHandle GetSharedSurfaceHandle() OVERRIDE;
+ virtual gfx::GLSurfaceHandle CreateSharedSurfaceHandle() OVERRIDE;
+ virtual void DestroySharedSurfaceHandle(gfx::GLSurfaceHandle surface)
+ OVERRIDE;
virtual scoped_refptr<ui::Texture> CreateTransportClient(
float device_scale_factor) OVERRIDE;
virtual scoped_refptr<ui::Texture> CreateOwnedTexture(
diff --git a/content/browser/gpu/browser_gpu_channel_host_factory.cc b/content/browser/gpu/browser_gpu_channel_host_factory.cc
index 5faf7ba..d0ce8b4 100644
--- a/content/browser/gpu/browser_gpu_channel_host_factory.cc
+++ b/content/browser/gpu/browser_gpu_channel_host_factory.cc
@@ -359,6 +359,7 @@ void BrowserGpuChannelHostFactory::GpuChannelEstablished() {
GetContentClient()->SetGpuInfo(pending_request_->gpu_info());
gpu_channel_ = GpuChannelHost::Create(this,
+ pending_request_->gpu_host_id(),
pending_request_->gpu_info(),
pending_request_->channel_handle());
gpu_host_id_ = pending_request_->gpu_host_id();
diff --git a/content/browser/renderer_host/gpu_message_filter.cc b/content/browser/renderer_host/gpu_message_filter.cc
index 4dc49bb..9068a40 100644
--- a/content/browser/renderer_host/gpu_message_filter.cc
+++ b/content/browser/renderer_host/gpu_message_filter.cc
@@ -11,7 +11,6 @@
#include "base/bind.h"
#include "base/command_line.h"
#include "content/browser/gpu/browser_gpu_channel_host_factory.h"
-#include "content/browser/gpu/gpu_data_manager_impl_private.h"
#include "content/browser/gpu/gpu_process_host.h"
#include "content/browser/gpu/gpu_surface_tracker.h"
#include "content/browser/renderer_host/render_widget_helper.h"
@@ -95,6 +94,24 @@ bool GpuMessageFilter::OnMessageReceived(
return handled;
}
+void GpuMessageFilter::SurfaceUpdated(int32 surface_id) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ typedef std::vector<linked_ptr<CreateViewCommandBufferRequest> > RequestList;
+ RequestList retry_requests;
+ retry_requests.swap(pending_requests_);
+ for (RequestList::iterator it = retry_requests.begin();
+ it != retry_requests.end(); ++it) {
+ if ((*it)->surface_id != surface_id) {
+ pending_requests_.push_back(*it);
+ } else {
+ linked_ptr<CreateViewCommandBufferRequest> request = *it;
+ OnCreateViewCommandBuffer(request->surface_id,
+ request->init_params,
+ request->reply.release());
+ }
+ }
+}
+
void GpuMessageFilter::BeginFrameSubscription(
int route_id,
scoped_ptr<RenderWidgetHostViewFrameSubscriber> subscriber) {
@@ -175,10 +192,16 @@ void GpuMessageFilter::OnCreateViewCommandBuffer(
<< " tried to access a surface for renderer " << renderer_id;
}
- if (compositing_surface.parent_client_id &&
- !GpuDataManagerImpl::GetInstance()->CanUseGpuBrowserCompositor()) {
- // For the renderer to fall back to software also.
- compositing_surface = gfx::GLSurfaceHandle();
+ if (compositing_surface.parent_gpu_process_id &&
+ compositing_surface.parent_gpu_process_id != gpu_process_id_) {
+ // If the current handle for the surface is using a different (older) gpu
+ // host, it means the GPU process died and we need to wait until the UI
+ // re-allocates the surface in the new process.
+ linked_ptr<CreateViewCommandBufferRequest> request(
+ new CreateViewCommandBufferRequest(
+ surface_id, init_params, reply.Pass()));
+ pending_requests_.push_back(request);
+ return;
}
GpuProcessHost* host = GpuProcessHost::FromID(gpu_process_id_);
diff --git a/content/browser/renderer_host/gpu_message_filter.h b/content/browser/renderer_host/gpu_message_filter.h
index d43b62e..5492ad9 100644
--- a/content/browser/renderer_host/gpu_message_filter.h
+++ b/content/browser/renderer_host/gpu_message_filter.h
@@ -39,6 +39,10 @@ class GpuMessageFilter : public BrowserMessageFilter {
virtual bool OnMessageReceived(const IPC::Message& message,
bool* message_was_ok) OVERRIDE;
+ // Signals that the handle for a surface id was updated, and it may be time to
+ // unblock existing CreateViewCommandBuffer requests using that surface.
+ void SurfaceUpdated(int32 surface_id);
+
// This set of API is used to subscribe to frame presentation events.
// See RenderWidgetHostViewFrameSubscriber for more details.
void BeginFrameSubscription(
@@ -80,6 +84,7 @@ class GpuMessageFilter : public BrowserMessageFilter {
bool share_contexts_;
scoped_refptr<RenderWidgetHelper> render_widget_helper_;
+ std::vector<linked_ptr<CreateViewCommandBufferRequest> > pending_requests_;
base::WeakPtrFactory<GpuMessageFilter> weak_ptr_factory_;
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
index e13ef7d..17444b3 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -1493,6 +1493,15 @@ base::TimeDelta RenderProcessHostImpl::GetChildProcessIdleTime() const {
return base::TimeTicks::Now() - child_process_activity_time_;
}
+void RenderProcessHostImpl::SurfaceUpdated(int32 surface_id) {
+ if (!gpu_message_filter_)
+ return;
+ BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, base::Bind(
+ &GpuMessageFilter::SurfaceUpdated,
+ gpu_message_filter_,
+ surface_id));
+}
+
void RenderProcessHostImpl::ResumeRequestsForView(int route_id) {
widget_helper_->ResumeRequestsForView(route_id);
}
diff --git a/content/browser/renderer_host/render_process_host_impl.h b/content/browser/renderer_host/render_process_host_impl.h
index 46418dd..d69e568 100644
--- a/content/browser/renderer_host/render_process_host_impl.h
+++ b/content/browser/renderer_host/render_process_host_impl.h
@@ -119,6 +119,7 @@ class CONTENT_EXPORT RenderProcessHostImpl
virtual bool FastShutdownForPageCount(size_t count) OVERRIDE;
virtual bool FastShutdownStarted() const OVERRIDE;
virtual base::TimeDelta GetChildProcessIdleTime() const OVERRIDE;
+ virtual void SurfaceUpdated(int32 surface_id) OVERRIDE;
virtual void ResumeRequestsForView(int route_id) OVERRIDE;
#if defined(ENABLE_WEBRTC)
virtual void EnableAecDump(const base::FilePath& file) OVERRIDE;
diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc
index 586785a..9f064f2 100644
--- a/content/browser/renderer_host/render_widget_host_impl.cc
+++ b/content/browser/renderer_host/render_widget_host_impl.cc
@@ -359,6 +359,12 @@ gfx::GLSurfaceHandle RenderWidgetHostImpl::GetCompositingSurface() {
return gfx::GLSurfaceHandle();
}
+void RenderWidgetHostImpl::CompositingSurfaceUpdated() {
+ GpuSurfaceTracker::Get()->SetSurfaceHandle(
+ surface_id_, GetCompositingSurface());
+ process_->SurfaceUpdated(surface_id_);
+}
+
void RenderWidgetHostImpl::ResetSizeAndRepaintPendingFlags() {
resize_ack_pending_ = false;
if (repaint_ack_pending_) {
diff --git a/content/browser/renderer_host/render_widget_host_impl.h b/content/browser/renderer_host/render_widget_host_impl.h
index d056a2f..22dbdbe 100644
--- a/content/browser/renderer_host/render_widget_host_impl.h
+++ b/content/browser/renderer_host/render_widget_host_impl.h
@@ -493,6 +493,10 @@ class CONTENT_EXPORT RenderWidgetHostImpl : virtual public RenderWidgetHost,
void ParentChanged(gfx::NativeViewId new_parent);
#endif
+ // Signals that the compositing surface was updated, e.g. after a lost context
+ // event.
+ void CompositingSurfaceUpdated();
+
void set_allow_privileged_mouse_lock(bool allow) {
allow_privileged_mouse_lock_ = allow;
}
diff --git a/content/browser/renderer_host/render_widget_host_unittest.cc b/content/browser/renderer_host/render_widget_host_unittest.cc
index cd3abed..967c814 100644
--- a/content/browser/renderer_host/render_widget_host_unittest.cc
+++ b/content/browser/renderer_host/render_widget_host_unittest.cc
@@ -35,11 +35,9 @@
#include "ui/gfx/screen.h"
#if defined(USE_AURA)
-#include "content/browser/aura/image_transport_factory.h"
#include "content/browser/renderer_host/render_widget_host_view_aura.h"
#include "ui/aura/env.h"
#include "ui/aura/test/test_screen.h"
-#include "ui/compositor/test/test_context_factory.h"
#endif
#if defined(OS_WIN) || defined(USE_AURA)
@@ -620,8 +618,6 @@ class RenderWidgetHostTest : public testing::Test {
delegate_.reset(new MockRenderWidgetHostDelegate());
process_ = new RenderWidgetHostProcess(browser_context_.get());
#if defined(USE_AURA)
- ImageTransportFactory::InitializeForUnitTests(
- scoped_ptr<ui::ContextFactory>(new ui::TestContextFactory));
aura::Env::CreateInstance();
screen_.reset(aura::TestScreen::Create());
gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, screen_.get());
@@ -642,7 +638,6 @@ class RenderWidgetHostTest : public testing::Test {
#if defined(USE_AURA)
aura::Env::DeleteInstance();
screen_.reset();
- ImageTransportFactory::Terminate();
#endif
// Process all pending tasks to avoid leaks.
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc
index e6fbafa..2478b1b 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -487,7 +487,6 @@ RenderWidgetHostViewAura::RenderWidgetHostViewAura(RenderWidgetHost* host)
#if defined(OS_WIN)
plugin_parent_window_ = NULL;
#endif
- ImageTransportFactory::GetInstance()->AddObserver(this);
}
////////////////////////////////////////////////////////////////////////////////
@@ -2141,7 +2140,13 @@ void RenderWidgetHostViewAura::OnAccessibilityEvents(
}
gfx::GLSurfaceHandle RenderWidgetHostViewAura::GetCompositingSurface() {
- return ImageTransportFactory::GetInstance()->GetSharedSurfaceHandle();
+ if (shared_surface_handle_.is_null()) {
+ ImageTransportFactory* factory = ImageTransportFactory::GetInstance();
+ shared_surface_handle_ = factory->CreateSharedSurfaceHandle();
+ if (!shared_surface_handle_.is_null())
+ factory->AddObserver(this);
+ }
+ return shared_surface_handle_;
}
bool RenderWidgetHostViewAura::LockMouse() {
@@ -3203,6 +3208,12 @@ void RenderWidgetHostViewAura::OnLostResources() {
// are using is becoming invalid. This sends pending ACKs and needs to happen
// after calling UpdateExternalTexture() which syncs with the impl thread.
RunOnCommitCallbacks();
+
+ DCHECK(!shared_surface_handle_.is_null());
+ ImageTransportFactory* factory = ImageTransportFactory::GetInstance();
+ factory->DestroySharedSurfaceHandle(shared_surface_handle_);
+ shared_surface_handle_ = factory->CreateSharedSurfaceHandle();
+ host_->CompositingSurfaceUpdated();
host_->ScheduleComposite();
}
@@ -3214,9 +3225,11 @@ RenderWidgetHostViewAura::~RenderWidgetHostViewAura() {
paint_observer_->OnViewDestroyed();
if (touch_editing_client_)
touch_editing_client_->OnViewDestroyed();
-
- ImageTransportFactory::GetInstance()->RemoveObserver(this);
-
+ if (!shared_surface_handle_.is_null()) {
+ ImageTransportFactory* factory = ImageTransportFactory::GetInstance();
+ factory->DestroySharedSurfaceHandle(shared_surface_handle_);
+ factory->RemoveObserver(this);
+ }
window_observer_.reset();
if (window_->GetDispatcher())
window_->GetDispatcher()->RemoveRootWindowObserver(this);
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.h b/content/browser/renderer_host/render_widget_host_view_aura.h
index 16a4dee..86db864 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.h
+++ b/content/browser/renderer_host/render_widget_host_view_aura.h
@@ -674,6 +674,8 @@ class CONTENT_EXPORT RenderWidgetHostViewAura
gfx::Size last_swapped_surface_size_;
float last_swapped_surface_scale_factor_;
+ gfx::GLSurfaceHandle shared_surface_handle_;
+
// If non-NULL we're in OnPaint() and this is the supplied canvas.
gfx::Canvas* paint_canvas_;
diff --git a/content/common/gpu/client/gpu_channel_host.cc b/content/common/gpu/client/gpu_channel_host.cc
index 72f80f1..705f4b9d 100644
--- a/content/common/gpu/client/gpu_channel_host.cc
+++ b/content/common/gpu/client/gpu_channel_host.cc
@@ -35,11 +35,12 @@ GpuListenerInfo::~GpuListenerInfo() {}
// static
scoped_refptr<GpuChannelHost> GpuChannelHost::Create(
GpuChannelHostFactory* factory,
+ int gpu_host_id,
const gpu::GPUInfo& gpu_info,
const IPC::ChannelHandle& channel_handle) {
DCHECK(factory->IsMainThread());
scoped_refptr<GpuChannelHost> host = new GpuChannelHost(
- factory, gpu_info);
+ factory, gpu_host_id, gpu_info);
host->Connect(channel_handle);
return host;
}
@@ -59,8 +60,10 @@ bool GpuChannelHost::IsValidGpuMemoryBuffer(
}
GpuChannelHost::GpuChannelHost(GpuChannelHostFactory* factory,
+ int gpu_host_id,
const gpu::GPUInfo& gpu_info)
: factory_(factory),
+ gpu_host_id_(gpu_host_id),
gpu_info_(gpu_info) {
next_transfer_buffer_id_.GetNext();
next_gpu_memory_buffer_id_.GetNext();
diff --git a/content/common/gpu/client/gpu_channel_host.h b/content/common/gpu/client/gpu_channel_host.h
index 03466ea..52ffb38 100644
--- a/content/common/gpu/client/gpu_channel_host.h
+++ b/content/common/gpu/client/gpu_channel_host.h
@@ -93,6 +93,7 @@ class GpuChannelHost : public IPC::Sender,
// Must be called on the main thread (as defined by the factory).
static scoped_refptr<GpuChannelHost> Create(
GpuChannelHostFactory* factory,
+ int gpu_host_id,
const gpu::GPUInfo& gpu_info,
const IPC::ChannelHandle& channel_handle);
@@ -149,6 +150,7 @@ class GpuChannelHost : public IPC::Sender,
void RemoveRoute(int route_id);
GpuChannelHostFactory* factory() const { return factory_; }
+ int gpu_host_id() const { return gpu_host_id_; }
// Returns a handle to the shared memory that can be sent via IPC to the
// GPU process. The caller is responsible for ensuring it is closed. Returns
@@ -177,6 +179,7 @@ class GpuChannelHost : public IPC::Sender,
private:
friend class base::RefCountedThreadSafe<GpuChannelHost>;
GpuChannelHost(GpuChannelHostFactory* factory,
+ int gpu_host_id,
const gpu::GPUInfo& gpu_info);
virtual ~GpuChannelHost();
void Connect(const IPC::ChannelHandle& channel_handle);
@@ -241,6 +244,7 @@ class GpuChannelHost : public IPC::Sender,
// - |next_gpu_memory_buffer_id_|, atomic type
// - |proxies_|, protected by |context_lock_|
GpuChannelHostFactory* const factory_;
+ const int gpu_host_id_;
const gpu::GPUInfo gpu_info_;
diff --git a/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc b/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc
index b4fc17a..4c8be5e 100644
--- a/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc
+++ b/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc
@@ -477,6 +477,11 @@ void WebGraphicsContext3DCommandBufferImpl::Destroy() {
host_ = NULL;
}
+// TODO(apatrick,piman): This should be renamed to something clearer.
+int WebGraphicsContext3DCommandBufferImpl::GetGPUProcessID() {
+ return host_.get() ? host_->gpu_host_id() : 0;
+}
+
gpu::ContextSupport*
WebGraphicsContext3DCommandBufferImpl::GetContextSupport() {
return real_gl_.get();
diff --git a/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h b/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h
index b56c4a4..ca88136 100644
--- a/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h
+++ b/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h
@@ -83,6 +83,10 @@ class WebGraphicsContext3DCommandBufferImpl
virtual ~WebGraphicsContext3DCommandBufferImpl();
+ // The following 3 IDs let one uniquely identify this context.
+ // Gets the GPU process ID for this context.
+ int GetGPUProcessID();
+
CommandBufferProxyImpl* GetCommandBufferProxy() {
return command_buffer_.get();
}
diff --git a/content/common/gpu/gpu_messages.h b/content/common/gpu/gpu_messages.h
index 9e25bc9..936a8a0 100644
--- a/content/common/gpu/gpu_messages.h
+++ b/content/common/gpu/gpu_messages.h
@@ -215,6 +215,7 @@ IPC_ENUM_TRAITS(gfx::SurfaceType)
IPC_STRUCT_TRAITS_BEGIN(gfx::GLSurfaceHandle)
IPC_STRUCT_TRAITS_MEMBER(handle)
IPC_STRUCT_TRAITS_MEMBER(transport_type)
+ IPC_STRUCT_TRAITS_MEMBER(parent_gpu_process_id)
IPC_STRUCT_TRAITS_MEMBER(parent_client_id)
IPC_STRUCT_TRAITS_END()
diff --git a/content/public/browser/render_process_host.h b/content/public/browser/render_process_host.h
index dd2fab6..6ddf375 100644
--- a/content/public/browser/render_process_host.h
+++ b/content/public/browser/render_process_host.h
@@ -201,6 +201,11 @@ class CONTENT_EXPORT RenderProcessHost : public IPC::Sender,
// 10 milliseconds.
virtual base::TimeDelta GetChildProcessIdleTime() const = 0;
+ // Signals that a compositing surface has been updated after a lost context
+ // event, so that we can process requests from the renderer to create contexts
+ // with that surface.
+ virtual void SurfaceUpdated(int32 surface_id) = 0;
+
// Called to resume the requests for a view created through window.open that
// were initially blocked.
virtual void ResumeRequestsForView(int route_id) = 0;
diff --git a/content/public/test/mock_render_process_host.cc b/content/public/test/mock_render_process_host.cc
index eadf339..c579b66 100644
--- a/content/public/test/mock_render_process_host.cc
+++ b/content/public/test/mock_render_process_host.cc
@@ -250,6 +250,9 @@ base::TimeDelta MockRenderProcessHost::GetChildProcessIdleTime() const {
return base::TimeDelta::FromMilliseconds(0);
}
+void MockRenderProcessHost::SurfaceUpdated(int32 surface_id) {
+}
+
void MockRenderProcessHost::ResumeRequestsForView(int route_id) {
}
diff --git a/content/public/test/mock_render_process_host.h b/content/public/test/mock_render_process_host.h
index 60ebef2..c9f20fa 100644
--- a/content/public/test/mock_render_process_host.h
+++ b/content/public/test/mock_render_process_host.h
@@ -73,6 +73,7 @@ class MockRenderProcessHost : public RenderProcessHost {
virtual void AddFilter(BrowserMessageFilter* filter) OVERRIDE;
virtual bool FastShutdownForPageCount(size_t count) OVERRIDE;
virtual base::TimeDelta GetChildProcessIdleTime() const OVERRIDE;
+ virtual void SurfaceUpdated(int32 surface_id) OVERRIDE;
virtual void ResumeRequestsForView(int route_id) OVERRIDE;
#if defined(ENABLE_WEBRTC)
virtual void EnableAecDump(const base::FilePath& file) OVERRIDE;
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc
index 9df1218..9b85289 100644
--- a/content/renderer/render_thread_impl.cc
+++ b/content/renderer/render_thread_impl.cc
@@ -1213,7 +1213,8 @@ GpuChannelHost* RenderThreadImpl::EstablishGpuChannelSync(
io_message_loop_proxy_ = ChildProcess::current()->io_message_loop_proxy();
shutdown_event_ = ChildProcess::current()->GetShutDownEvent();
- gpu_channel_ = GpuChannelHost::Create(this, gpu_info, channel_handle);
+ gpu_channel_ = GpuChannelHost::Create(
+ this, 0, gpu_info, channel_handle);
return gpu_channel_.get();
}