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

Unified Diff: content/renderer/render_view_impl.cc

Issue 10412056: Browser Plugin: Remove MapInstance from BrowserPluginHost + More cross-process navigation work (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Additional small fix to visitedlink (forgot to change one CreateRenderView call) Created 8 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
« no previous file with comments | « content/renderer/render_view_impl.h ('k') | content/test/test_renderer_host.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_view_impl.cc
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
index 83d6546367f9ac2bd9ed963d515ad7b755f6a057..7cc7ebedeb9f6aa25c13e8dea4d4e455205a4af7 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -26,6 +26,7 @@
#include "base/time.h"
#include "base/utf_string_conversions.h"
#include "content/common/appcache/appcache_dispatcher.h"
+#include "content/common/browser_plugin_messages.h"
#include "content/common/child_thread.h"
#include "content/common/clipboard_messages.h"
#include "content/common/database_messages.h"
@@ -55,6 +56,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/browser_plugin_channel_manager.h"
#include "content/renderer/browser_plugin/guest_to_embedder_channel.h"
#include "content/renderer/device_orientation_dispatcher.h"
#include "content/renderer/devtools_agent.h"
@@ -777,6 +779,16 @@ void RenderViewImpl::SetReportLoadProgressEnabled(bool enabled) {
load_progress_tracker_.reset(new LoadProgressTracker(this));
}
+content::GuestToEmbedderChannel*
+ RenderViewImpl::GetGuestToEmbedderChannel() const {
+ return guest_to_embedder_channel_;
+}
+
+void RenderViewImpl::SetGuestToEmbedderChannel(
+ content::GuestToEmbedderChannel* channel) {
+ guest_to_embedder_channel_ = channel;
+}
+
void RenderViewImpl::PluginCrashed(const FilePath& plugin_path) {
Send(new ViewHostMsg_CrashedPlugin(routing_id_, plugin_path));
}
@@ -952,6 +964,25 @@ bool RenderViewImpl::OnMessageReceived(const IPC::Message& message) {
}
void RenderViewImpl::OnNavigate(const ViewMsg_Navigate_Params& params) {
+ // If we don't have guest-to-embedder channel associated with this RenderView
+ // but we need one, grab one now.
+ if (!params.embedder_channel_name.empty() && !GetGuestToEmbedderChannel()) {
+ content::GuestToEmbedderChannel* embedder_channel =
+ RenderThreadImpl::current()->browser_plugin_channel_manager()->
+ GetChannelByName(params.embedder_channel_name);
+ DCHECK(embedder_channel);
+ SetGuestToEmbedderChannel(embedder_channel);
+ host_window_set_ = false;
+ // TODO(fsamuel): This is test code. Need to find a better way to tell
+ // a WebView to drop its context. This needs to change in
+ // GuestToEmbedderChannel::OnContextLost.
+ GetWebView()->loseCompositorContext(1);
+ RenderThreadImpl::current()->browser_plugin_channel_manager()->
+ ReportChannelToEmbedder(this,
+ embedder_channel->embedder_channel_handle(),
+ params.embedder_channel_name,
+ params.embedder_container_id);
+ }
MaybeHandleDebugURL(params.url);
if (!webview())
return;
@@ -1663,9 +1694,9 @@ WebGraphicsContext3D* RenderViewImpl::createGraphicsContext3D(
if (!webview())
return NULL;
- if (guest_to_embedder_channel()) {
+ if (GetGuestToEmbedderChannel()) {
WebGraphicsContext3DCommandBufferImpl* context =
- guest_to_embedder_channel()->CreateWebGraphicsContext3D(
+ GetGuestToEmbedderChannel()->CreateWebGraphicsContext3D(
this, attributes, false);
if (!guest_pp_instance()) {
guest_uninitialized_context_ = context;
@@ -3715,14 +3746,15 @@ bool RenderViewImpl::IsEditableNode(const WebKit::WebNode& node) const {
void RenderViewImpl::GuestReady(PP_Instance instance) {
guest_pp_instance_ = instance;
if (guest_uninitialized_context_) {
- bool success = guest_to_embedder_channel()->CreateGraphicsContext(
+ bool success = GetGuestToEmbedderChannel()->CreateGraphicsContext(
guest_uninitialized_context_,
guest_attributes_,
false,
this);
DCHECK(success);
+ CompleteInit(host_window_);
+ guest_uninitialized_context_ = NULL;
}
- CompleteInit(host_window_);
}
webkit::ppapi::WebPluginImpl* RenderViewImpl::CreateBrowserPlugin(
@@ -4829,8 +4861,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_to_embedder_channel())
- guest_to_embedder_channel()->IssueSwapBuffers(guest_graphics_resource());
+ if (GetGuestToEmbedderChannel())
+ GetGuestToEmbedderChannel()->IssueSwapBuffers(guest_graphics_resource());
}
void RenderViewImpl::DidFlushPaint() {
« no previous file with comments | « content/renderer/render_view_impl.h ('k') | content/test/test_renderer_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698