Index: content/renderer/render_view_impl.cc |
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc |
index 76e4781125471250e8dee52feb435df631d54f35..359631d8b3f27ca93e72e4925579c0a808da9b89 100644 |
--- a/content/renderer/render_view_impl.cc |
+++ b/content/renderer/render_view_impl.cc |
@@ -53,6 +53,7 @@ |
#include "content/public/renderer/navigation_state.h" |
#include "content/public/renderer/render_view_observer.h" |
#include "content/public/renderer/render_view_visitor.h" |
+#include "content/renderer/browser_plugin/guest_render_view_observer.h" |
#include "content/renderer/device_orientation_dispatcher.h" |
#include "content/renderer/devtools_agent.h" |
#include "content/renderer/dom_automation_controller.h" |
@@ -454,6 +455,7 @@ RenderViewImpl::RenderViewImpl( |
context_is_web_graphics_context_3d_command_buffer_impl_(false), |
ALLOW_THIS_IN_INITIALIZER_LIST(cookie_jar_(this)), |
geolocation_dispatcher_(NULL), |
+ guest_observer_(NULL), |
input_tag_speech_dispatcher_(NULL), |
device_orientation_dispatcher_(NULL), |
media_stream_dispatcher_(NULL), |
@@ -501,13 +503,20 @@ RenderViewImpl::RenderViewImpl( |
// If this is a popup, we must wait for the CreatingNew_ACK message before |
// completing initialization. Otherwise, we can finish it now. |
- if (opener_id == MSG_ROUTING_NONE) { |
+ if (!guest_ && opener_id == MSG_ROUTING_NONE) { |
did_show_ = true; |
CompleteInit(parent_hwnd); |
} |
g_view_map.Get().insert(std::make_pair(webview(), this)); |
webkit_preferences_.Apply(webview()); |
+ |
+ // This needs to be before initializeMainFrame it seems. |
+ // PpapiMsg_CreateChannel messages can get lost if the guest |
+ // observer has not been constructed before a sync message. |
+ if (!guest_observer_) |
jam
2012/04/06 21:05:23
you're in the constructor, so how else would guest
Fady Samuel
2012/04/06 22:46:32
Doh! Lots of unnecessary code sticks around as one
|
+ guest_observer_ = new GuestRenderViewObserver(this); |
+ |
webview()->initializeMainFrame(this); |
if (!frame_name.empty()) |
webview()->mainFrame()->setName(frame_name); |
@@ -838,13 +847,11 @@ bool RenderViewImpl::OnMessageReceived(const IPC::Message& message) { |
// Have the super handle all other messages. |
IPC_MESSAGE_UNHANDLED(handled = RenderWidget::OnMessageReceived(message)) |
IPC_END_MESSAGE_MAP() |
- |
if (!msg_is_ok) { |
// The message had a handler, but its deserialization failed. |
// Kill the renderer to avoid potential spoofing attacks. |
CHECK(false) << "Unable to deserialize message in RenderViewImpl."; |
} |
- |
return handled; |
} |
@@ -1572,6 +1579,11 @@ WebGraphicsContext3D* RenderViewImpl::createGraphicsContext3D( |
const WebGraphicsContext3D::Attributes& attributes) { |
if (!webview()) |
return NULL; |
+ |
+ if (guest_) { |
+ context_is_web_graphics_context_3d_command_buffer_impl_ = true; |
+ return guest_observer_->GetWebGraphicsContext3D(attributes); |
piman
2012/04/06 23:19:26
When the context gets lost, we usually are in a st
Fady Samuel
2012/04/11 22:06:34
I can have the context inform the GuestToHostChann
|
+ } |
// The WebGraphicsContext3DInProcessImpl code path is used for |
// layout tests (though not through this code) as well as for |
// debugging and bringing up new ports. |
@@ -3535,6 +3547,17 @@ bool RenderViewImpl::IsEditableNode(const WebKit::WebNode& node) const { |
return is_editable_node; |
} |
+WebKit::WebPlugin* RenderViewImpl::CreateBrowserPlugin( |
+ base::ProcessHandle process_handle, |
+ const IPC::ChannelHandle& channel_handle, |
+ const WebKit::WebPluginParams& params) { |
+ scoped_refptr<webkit::ppapi::PluginModule> pepper_module( |
+ pepper_delegate_.CreateBrowserPluginModule(process_handle, |
+ channel_handle)); |
+ return new webkit::ppapi::WebPluginImpl( |
+ pepper_module.get(), params, pepper_delegate_.AsWeakPtr()); |
+} |
+ |
WebKit::WebPlugin* RenderViewImpl::CreatePlugin( |
WebKit::WebFrame* frame, |
const webkit::WebPluginInfo& info, |
@@ -4566,6 +4589,8 @@ void RenderViewImpl::WillInitiatePaint() { |
void RenderViewImpl::DidInitiatePaint() { |
// Notify the pepper plugins that we've painted, and are waiting to flush. |
pepper_delegate_.ViewInitiatedPaint(); |
+ if (guest()) |
+ guest_observer_->IssueSwapBuffers(); |
} |
void RenderViewImpl::DidFlushPaint() { |
@@ -4613,6 +4638,10 @@ void RenderViewImpl::OnViewContextSwapBuffersAborted() { |
RenderWidget::OnSwapBuffersAborted(); |
} |
+void RenderViewImpl::OnGuestReady() { |
+ CompleteInit(host_window_); |
+} |
+ |
webkit::ppapi::PluginInstance* RenderViewImpl::GetBitmapForOptimizedPluginPaint( |
const gfx::Rect& paint_bounds, |
TransportDIB** dib, |