summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorapatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-02 23:04:24 +0000
committerapatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-02 23:04:24 +0000
commite6809af7046787a3556ae997bddbbd6d9847a957 (patch)
treeec437ceb42c1c1a485af7258998efab29f9b1f16
parenta9bfb58da45eae71af445253eb0f21d4d497d39d (diff)
downloadchromium_src-e6809af7046787a3556ae997bddbbd6d9847a957.zip
chromium_src-e6809af7046787a3556ae997bddbbd6d9847a957.tar.gz
chromium_src-e6809af7046787a3556ae997bddbbd6d9847a957.tar.bz2
Removed kChromiumRendererIdProperty window property.
This property was used by the GPU process to determine whether a particular renderer process had the right to render to a window. It turns out that this is no longer needed because now the browser tells the GPU process which child compositor window to render to and the GPU process trusts the browser process. Also uncovered and fixed a bug in gpu_channel_host.cc where the renderer would hang if the GPU process failed to return a command buffer. TEST=try BUG=64834 Review URL: http://codereview.chromium.org/5607001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@68096 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view_win.cc14
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view_win.h10
-rw-r--r--chrome/common/chrome_constants.cc2
-rw-r--r--chrome/common/chrome_constants.h2
-rw-r--r--chrome/gpu/gpu_channel.cc27
-rw-r--r--chrome/renderer/gpu_channel_host.cc19
6 files changed, 27 insertions, 47 deletions
diff --git a/chrome/browser/renderer_host/render_widget_host_view_win.cc b/chrome/browser/renderer_host/render_widget_host_view_win.cc
index 4b6271b..ce935f1 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_win.cc
+++ b/chrome/browser/renderer_host/render_widget_host_view_win.cc
@@ -8,7 +8,6 @@
#include "app/l10n_util_win.h"
#include "app/resource_bundle.h"
#include "app/view_prop.h"
-#include "app/win/scoped_prop.h"
#include "base/command_line.h"
#include "base/i18n/rtl.h"
#include "base/metrics/histogram.h"
@@ -61,6 +60,8 @@ using WebKit::WebMouseEvent;
using WebKit::WebTextDirection;
using webkit_glue::WebPluginGeometry;
+const wchar_t kRenderWidgetHostHWNDClass[] = L"Chrome_RenderWidgetHostHWND";
+
namespace {
// Tooltips will wrap after this width. Yes, wrap. Imagine that!
@@ -308,16 +309,6 @@ RenderWidgetHostViewWin::~RenderWidgetHostViewWin() {
void RenderWidgetHostViewWin::CreateWnd(HWND parent) {
Create(parent); // ATL function to create the window.
-
- // Add a property indicating that a particular renderer is associated with
- // this window. Used by the GPU process to validate window handles it
- // receives from renderer processes. As this is used by a separate process we
- // have to use ScopedProp here instead of ViewProp.
- int renderer_id = render_widget_host_->process()->id();
- renderer_id_prop_.reset(
- new app::win::ScopedProp(m_hWnd,
- chrome::kChromiumRendererIdProperty,
- reinterpret_cast<HANDLE>(renderer_id)));
}
///////////////////////////////////////////////////////////////////////////////
@@ -871,7 +862,6 @@ void RenderWidgetHostViewWin::OnDestroy() {
// sequence as part of the usual cleanup when the plugin instance goes away.
EnumChildWindows(m_hWnd, DetachPluginWindowsCallback, NULL);
- renderer_id_prop_.reset();
props_.reset();
CleanupCompositorWindow();
diff --git a/chrome/browser/renderer_host/render_widget_host_view_win.h b/chrome/browser/renderer_host/render_widget_host_view_win.h
index 27a9372..1195a0c 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_win.h
+++ b/chrome/browser/renderer_host/render_widget_host_view_win.h
@@ -22,15 +22,11 @@
#include "chrome/browser/renderer_host/render_widget_host_view.h"
#include "chrome/common/notification_observer.h"
#include "chrome/common/notification_registrar.h"
+#include "gfx/native_widget_types.h"
#include "webkit/glue/webcursor.h"
namespace app {
-
class ViewProp;
-
-namespace win {
-class ScopedProp;
-}
}
namespace gfx {
@@ -48,8 +44,7 @@ class RenderWidgetHost;
typedef CWinTraits<WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, 0>
RenderWidgetHostHWNDTraits;
-static const wchar_t* const kRenderWidgetHostHWNDClass =
- L"Chrome_RenderWidgetHostHWND";
+extern const wchar_t kRenderWidgetHostHWNDClass[];
///////////////////////////////////////////////////////////////////////////////
// RenderWidgetHostViewWin
@@ -355,7 +350,6 @@ class RenderWidgetHostViewWin
WebKit::WebTextInputType text_input_type_;
ScopedVector<app::ViewProp> props_;
- scoped_ptr<app::win::ScopedProp> renderer_id_prop_;
DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewWin);
};
diff --git a/chrome/common/chrome_constants.cc b/chrome/common/chrome_constants.cc
index 2047798..e6a3246 100644
--- a/chrome/common/chrome_constants.cc
+++ b/chrome/common/chrome_constants.cc
@@ -132,8 +132,6 @@ const int kHistogramSynchronizerReservedSequenceNumber = 0;
const int kMaxSessionHistoryEntries = 50;
-const wchar_t kChromiumRendererIdProperty[] = L"ChromiumRendererId";
-
const char* const kUnknownLanguageCode = "und";
} // namespace chrome
diff --git a/chrome/common/chrome_constants.h b/chrome/common/chrome_constants.h
index 6510409b..bc4d4bf 100644
--- a/chrome/common/chrome_constants.h
+++ b/chrome/common/chrome_constants.h
@@ -91,8 +91,6 @@ extern const int kHistogramSynchronizerReservedSequenceNumber;
// The maximum number of session history entries per tab.
extern const int kMaxSessionHistoryEntries;
-extern const wchar_t kChromiumRendererIdProperty[];
-
// The language code used when the language of a page could not be detected.
// (Matches what the CLD -Compact Language Detection- library reports.)
extern const char* const kUnknownLanguageCode;
diff --git a/chrome/gpu/gpu_channel.cc b/chrome/gpu/gpu_channel.cc
index 0805316..10641ed 100644
--- a/chrome/gpu/gpu_channel.cc
+++ b/chrome/gpu/gpu_channel.cc
@@ -119,25 +119,22 @@ void GpuChannel::OnCreateViewCommandBuffer(
int32 render_view_id,
const GPUCreateCommandBufferConfig& init_params,
int32* route_id) {
- *route_id = 0;
+ *route_id = MSG_ROUTING_NONE;
#if defined(ENABLE_GPU)
gfx::PluginWindowHandle handle = gfx::kNullPluginWindow;
#if defined(OS_WIN)
- gfx::NativeView view = gfx::NativeViewFromId(view_id);
-
- // Check that the calling renderer is allowed to render to this window.
- // TODO(apatrick): consider killing the renderer process rather than failing.
- int view_renderer_id = reinterpret_cast<int>(
- GetProp(view, chrome::kChromiumRendererIdProperty));
- if (view_renderer_id != renderer_id_)
- return;
-
- // Note, we don't actually render into the view HWND. Instead, inside
- // the GpuCommandBufferStub, we will create a child window within the view
- // HWND into which we will render.
- handle = view;
+ // TODO(apatrick): We don't actually need the window handle on the Windows
+ // platform. At this point, it only indicates to the GpuCommandBufferStub
+ // whether onscreen or offscreen rendering is requested. The window handle
+ // that will be rendered to is the child compositor window and that window
+ // handle is provided by the browser process. Looking at what we are doing on
+ // this and other platforms, I think a redesign is in order here. Perhaps
+ // on all platforms the renderer just indicates whether it wants onscreen or
+ // offscreen rendering and the browser provides whichever platform specific
+ // "render target" the GpuCommandBufferStub targets.
+ handle = gfx::NativeViewFromId(view_id);
#elif defined(OS_LINUX)
ChildThread* gpu_thread = ChildThread::current();
// Ask the browser for the view's XID.
@@ -194,7 +191,7 @@ void GpuChannel::OnCreateOffscreenCommandBuffer(
router_.AddRoute(*route_id, stub.get());
stubs_.AddWithID(stub.release(), *route_id);
#else
- *route_id = 0;
+ *route_id = MSG_ROUTING_NONE;
#endif
}
diff --git a/chrome/renderer/gpu_channel_host.cc b/chrome/renderer/gpu_channel_host.cc
index 3d7faaf..c59f2f1 100644
--- a/chrome/renderer/gpu_channel_host.cc
+++ b/chrome/renderer/gpu_channel_host.cc
@@ -97,15 +97,16 @@ CommandBufferProxy* GpuChannelHost::CreateViewCommandBuffer(
GPUCreateCommandBufferConfig init_params(allowed_extensions, attribs);
int32 route_id;
- if (!Send(new GpuChannelMsg_CreateViewCommandBuffer(
- view,
- render_view_id,
- init_params,
- &route_id)) &&
- route_id != MSG_ROUTING_NONE) {
+ if (!Send(new GpuChannelMsg_CreateViewCommandBuffer(view,
+ render_view_id,
+ init_params,
+ &route_id))) {
return NULL;
}
+ if (route_id == MSG_ROUTING_NONE)
+ return NULL;
+
CommandBufferProxy* command_buffer = new CommandBufferProxy(this, route_id);
router_.AddRoute(route_id, command_buffer);
proxies_[route_id] = command_buffer;
@@ -133,11 +134,13 @@ CommandBufferProxy* GpuChannelHost::CreateOffscreenCommandBuffer(
size,
init_params,
parent_texture_id,
- &route_id)) &&
- route_id != MSG_ROUTING_NONE) {
+ &route_id))) {
return NULL;
}
+ if (route_id == MSG_ROUTING_NONE)
+ return NULL;
+
CommandBufferProxy* command_buffer = new CommandBufferProxy(this, route_id);
router_.AddRoute(route_id, command_buffer);
proxies_[route_id] = command_buffer;