summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-26 21:21:22 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-26 21:21:22 +0000
commit4432769ac309c0c14eeed2769cbbfabef7f9e59a (patch)
treed91e06840aa03f0c412077da168be4c0e8b7c682 /content
parentfef2673b5a02496db07a537143b90a81e6efd055 (diff)
downloadchromium_src-4432769ac309c0c14eeed2769cbbfabef7f9e59a.zip
chromium_src-4432769ac309c0c14eeed2769cbbfabef7f9e59a.tar.gz
chromium_src-4432769ac309c0c14eeed2769cbbfabef7f9e59a.tar.bz2
Fix layering violation in content\browser\renderer_host. That directory shouldn't be including web_contents.
It looks like this regressed because we forgot to update the DEPS exclusion after the tab_contents->web_contents rename. I've fixed the non test case, added exclusion for tests, and put a temporary workaround for the media subdirectory. It seems that the media subdirectory should move to content\browser since it has dependencies on web_contents. Review URL: https://codereview.chromium.org/12319119 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@184735 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/browser/browser_plugin/browser_plugin_guest.cc4
-rw-r--r--content/browser/browser_plugin/browser_plugin_guest.h3
-rw-r--r--content/browser/gpu/gpu_data_manager_impl.cc27
-rw-r--r--content/browser/gpu/gpu_data_manager_impl.h11
-rw-r--r--content/browser/renderer_host/DEPS8
-rw-r--r--content/browser/renderer_host/media/DEPS4
-rw-r--r--content/browser/renderer_host/render_message_filter.cc30
-rw-r--r--content/browser/renderer_host/render_widget_host_view_guest.cc10
-rw-r--r--content/browser/renderer_host/test_render_view_host.cc1
-rw-r--r--content/browser/web_contents/web_contents_impl.cc6
-rw-r--r--content/browser/web_contents/web_contents_impl.h2
-rw-r--r--content/public/browser/gpu_data_manager.h1
-rw-r--r--content/public/browser/gpu_data_manager_observer.h14
-rw-r--r--content/public/browser/web_contents_observer.h7
14 files changed, 70 insertions, 58 deletions
diff --git a/content/browser/browser_plugin/browser_plugin_guest.cc b/content/browser/browser_plugin/browser_plugin_guest.cc
index ad0bacc..cf451f2 100644
--- a/content/browser/browser_plugin/browser_plugin_guest.cc
+++ b/content/browser/browser_plugin/browser_plugin_guest.cc
@@ -184,6 +184,10 @@ BrowserPluginGuest* BrowserPluginGuest::Create(
web_contents, params);
}
+RenderWidgetHostView* BrowserPluginGuest::GetEmbedderRenderWidgetHostView() {
+ return embedder_web_contents_->GetRenderWidgetHostView();
+}
+
void BrowserPluginGuest::UpdateVisibility() {
OnSetVisibility(instance_id_, visible());
}
diff --git a/content/browser/browser_plugin/browser_plugin_guest.h b/content/browser/browser_plugin/browser_plugin_guest.h
index 71241f9..4eba76c9 100644
--- a/content/browser/browser_plugin/browser_plugin_guest.h
+++ b/content/browser/browser_plugin/browser_plugin_guest.h
@@ -58,6 +58,7 @@ namespace content {
class BrowserPluginHostFactory;
class BrowserPluginEmbedder;
class RenderProcessHost;
+class RenderWidgetHostView;
// A browser plugin guest provides functionality for WebContents to operate in
// the guest role and implements guest specific overrides for ViewHostMsg_*
@@ -97,6 +98,8 @@ class CONTENT_EXPORT BrowserPluginGuest : public NotificationObserver,
return embedder_web_contents_;
}
+ RenderWidgetHostView* GetEmbedderRenderWidgetHostView();
+
bool focused() const { return focused_; }
bool visible() const { return guest_visible_; }
void clear_damage_buffer() { damage_buffer_.reset(); }
diff --git a/content/browser/gpu/gpu_data_manager_impl.cc b/content/browser/gpu/gpu_data_manager_impl.cc
index a085bc4..834bf55 100644
--- a/content/browser/gpu/gpu_data_manager_impl.cc
+++ b/content/browser/gpu/gpu_data_manager_impl.cc
@@ -23,6 +23,7 @@
#include "content/browser/gpu/gpu_util.h"
#include "content/common/gpu/gpu_messages.h"
#include "content/gpu/gpu_info_collector.h"
+#include "content/public/browser/browser_thread.h"
#include "content/public/browser/gpu_data_manager_observer.h"
#include "content/public/common/content_client.h"
#include "content/public/common/content_constants.h"
@@ -560,9 +561,21 @@ void GpuDataManagerImpl::BlockDomainFrom3DAPIs(
BlockDomainFrom3DAPIsAtTime(url, guilt, base::Time::Now());
}
-GpuDataManagerImpl::DomainBlockStatus
-GpuDataManagerImpl::Are3DAPIsBlocked(const GURL& url) const {
- return Are3DAPIsBlockedAtTime(url, base::Time::Now());
+bool GpuDataManagerImpl::Are3DAPIsBlocked(const GURL& url,
+ int render_process_id,
+ int render_view_id,
+ ThreeDAPIType requester) {
+ bool blocked = Are3DAPIsBlockedAtTime(url, base::Time::Now()) !=
+ GpuDataManagerImpl::DOMAIN_BLOCK_STATUS_NOT_BLOCKED;
+ if (blocked) {
+ BrowserThread::PostTask(
+ BrowserThread::UI, FROM_HERE,
+ base::Bind(&GpuDataManagerImpl::Notify3DAPIBlocked,
+ base::Unretained(this), url, render_process_id,
+ render_view_id, requester));
+ }
+
+ return blocked;
}
void GpuDataManagerImpl::DisableDomainBlockingFor3DAPIsForTesting() {
@@ -782,4 +795,12 @@ int64 GpuDataManagerImpl::GetBlockAllDomainsDurationInMs() const {
return kBlockAllDomainsMs;
}
+void GpuDataManagerImpl::Notify3DAPIBlocked(const GURL& url,
+ int render_process_id,
+ int render_view_id,
+ ThreeDAPIType requester) {
+ observer_list_->Notify(&GpuDataManagerObserver::DidBlock3DAPIs,
+ url, render_process_id, render_view_id, requester);
+}
+
} // namespace content
diff --git a/content/browser/gpu/gpu_data_manager_impl.h b/content/browser/gpu/gpu_data_manager_impl.h
index e41f191..c862ab0 100644
--- a/content/browser/gpu/gpu_data_manager_impl.h
+++ b/content/browser/gpu/gpu_data_manager_impl.h
@@ -22,6 +22,7 @@
#include "content/public/browser/gpu_data_manager.h"
#include "content/public/common/gpu_info.h"
#include "content/public/common/gpu_memory_stats.h"
+#include "content/public/common/three_d_api_types.h"
class CommandLine;
class GURL;
@@ -146,7 +147,10 @@ class CONTENT_EXPORT GpuDataManagerImpl
// Note that the unblocking API must be part of the content API
// because it is called from Chrome side code.
void BlockDomainFrom3DAPIs(const GURL& url, DomainGuilt guilt);
- DomainBlockStatus Are3DAPIsBlocked(const GURL& url) const;
+ bool Are3DAPIsBlocked(const GURL& url,
+ int render_process_id,
+ int render_view_id,
+ ThreeDAPIType requester);
// Disables domain blocking for 3D APIs. For use only in tests.
void DisableDomainBlockingFor3DAPIsForTesting();
@@ -218,6 +222,11 @@ class CONTENT_EXPORT GpuDataManagerImpl
const GURL& url, base::Time at_time) const;
int64 GetBlockAllDomainsDurationInMs() const;
+ void Notify3DAPIBlocked(const GURL& url,
+ int render_process_id,
+ int render_view_id,
+ ThreeDAPIType requester);
+
bool complete_gpu_info_already_requested_;
GpuFeatureType blacklisted_features_;
diff --git a/content/browser/renderer_host/DEPS b/content/browser/renderer_host/DEPS
index 2f890a9..2d80d38 100644
--- a/content/browser/renderer_host/DEPS
+++ b/content/browser/renderer_host/DEPS
@@ -8,5 +8,11 @@ include_rules = [
# The renderer_host files should only call upwards in the layering via the
# delegate interfaces.
- "-content/browser/tab_contents",
+ "-content/browser/web_contents",
]
+
+specific_include_rules = {
+ ".*_(unit|browser)test\.cc": [
+ "+content/browser/web_contents",
+ ],
+}
diff --git a/content/browser/renderer_host/media/DEPS b/content/browser/renderer_host/media/DEPS
index c3a5b96..1bb0da8 100644
--- a/content/browser/renderer_host/media/DEPS
+++ b/content/browser/renderer_host/media/DEPS
@@ -1,3 +1,7 @@
include_rules = [
"+media",
+
+ # TODO: this is temporary, this directory doesn't belong under renderer_host
+ # since it depends on web_contents.
+ "+content/browser/web_contents",
]
diff --git a/content/browser/renderer_host/render_message_filter.cc b/content/browser/renderer_host/render_message_filter.cc
index 0b4d5b5..e94286a 100644
--- a/content/browser/renderer_host/render_message_filter.cc
+++ b/content/browser/renderer_host/render_message_filter.cc
@@ -29,7 +29,6 @@
#include "content/browser/renderer_host/render_process_host_impl.h"
#include "content/browser/renderer_host/render_view_host_delegate.h"
#include "content/browser/renderer_host/render_widget_helper.h"
-#include "content/browser/web_contents/web_contents_impl.h"
#include "content/common/child_process_host_impl.h"
#include "content/common/child_process_messages.h"
#include "content/common/desktop_notification_messages.h"
@@ -201,22 +200,6 @@ class OpenChannelToPpapiBrokerCallback
int request_id_;
};
-void RaiseInfobarForBlocked3DContentOnUIThread(
- int render_process_id,
- int render_view_id,
- const GURL& url,
- content::ThreeDAPIType requester) {
- RenderViewHost* rvh = RenderViewHost::FromID(
- render_process_id, render_view_id);
- if (!rvh)
- return;
- WebContentsImpl* web_contents = static_cast<WebContentsImpl*>(
- WebContents::FromRenderViewHost(rvh));
- if (!web_contents)
- return;
- web_contents->DidBlock3DAPIs(url, requester);
-}
-
} // namespace
class RenderMessageFilter::OpenChannelToNpapiPluginCallback
@@ -1074,17 +1057,8 @@ void RenderMessageFilter::OnAre3DAPIsBlocked(int render_view_id,
const GURL& top_origin_url,
ThreeDAPIType requester,
bool* blocked) {
- GpuDataManagerImpl::DomainBlockStatus block_status =
- GpuDataManagerImpl::GetInstance()->Are3DAPIsBlocked(top_origin_url);
- *blocked = (block_status !=
- GpuDataManagerImpl::DOMAIN_BLOCK_STATUS_NOT_BLOCKED);
- if (*blocked) {
- BrowserThread::PostTask(
- BrowserThread::UI, FROM_HERE,
- base::Bind(&RaiseInfobarForBlocked3DContentOnUIThread,
- render_process_id_, render_view_id,
- top_origin_url, requester));
- }
+ *blocked = GpuDataManagerImpl::GetInstance()->Are3DAPIsBlocked(
+ top_origin_url, render_process_id_, render_view_id, requester);
}
void RenderMessageFilter::OnDidLose3DContext(
diff --git a/content/browser/renderer_host/render_widget_host_view_guest.cc b/content/browser/renderer_host/render_widget_host_view_guest.cc
index 065cd87..1fad1a7 100644
--- a/content/browser/renderer_host/render_widget_host_view_guest.cc
+++ b/content/browser/renderer_host/render_widget_host_view_guest.cc
@@ -8,7 +8,6 @@
#include "content/browser/browser_plugin/browser_plugin_guest.h"
#include "content/browser/renderer_host/render_view_host_impl.h"
#include "content/browser/renderer_host/render_widget_host_view_guest.h"
-#include "content/browser/web_contents/web_contents_impl.h"
#include "content/common/browser_plugin_messages.h"
#include "content/common/gpu/gpu_messages.h"
#include "content/common/view_messages.h"
@@ -159,18 +158,15 @@ void RenderWidgetHostViewGuest::InitAsFullscreen(
}
gfx::NativeView RenderWidgetHostViewGuest::GetNativeView() const {
- return guest_->embedder_web_contents()->GetRenderWidgetHostView()->
- GetNativeView();
+ return guest_->GetEmbedderRenderWidgetHostView()->GetNativeView();
}
gfx::NativeViewId RenderWidgetHostViewGuest::GetNativeViewId() const {
- return guest_->embedder_web_contents()->GetRenderWidgetHostView()->
- GetNativeViewId();
+ return guest_->GetEmbedderRenderWidgetHostView()->GetNativeViewId();
}
gfx::NativeViewAccessible RenderWidgetHostViewGuest::GetNativeViewAccessible() {
- return guest_->embedder_web_contents()->GetRenderWidgetHostView()->
- GetNativeViewAccessible();
+ return guest_->GetEmbedderRenderWidgetHostView()->GetNativeViewAccessible();
}
void RenderWidgetHostViewGuest::MovePluginWindows(
diff --git a/content/browser/renderer_host/test_render_view_host.cc b/content/browser/renderer_host/test_render_view_host.cc
index c0cd33a..e0e5b5e 100644
--- a/content/browser/renderer_host/test_render_view_host.cc
+++ b/content/browser/renderer_host/test_render_view_host.cc
@@ -8,7 +8,6 @@
#include "content/browser/dom_storage/session_storage_namespace_impl.h"
#include "content/browser/renderer_host/test_backing_store.h"
#include "content/browser/site_instance_impl.h"
-#include "content/browser/web_contents/navigation_controller_impl.h"
#include "content/common/view_messages.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/navigation_controller.h"
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index e8e55a7..c11103d 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -2499,12 +2499,6 @@ void WebContentsImpl::OnFrameDetached(int64 frame_id) {
FrameDetached(message_source_, frame_id));
}
-void WebContentsImpl::DidBlock3DAPIs(const GURL& url,
- ThreeDAPIType requester) {
- FOR_EACH_OBSERVER(WebContentsObserver, observers_,
- DidBlock3DAPIs(url, requester));
-}
-
void WebContentsImpl::DidChangeVisibleSSLState() {
FOR_EACH_OBSERVER(WebContentsObserver, observers_,
DidChangeVisibleSSLState());
diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h
index a1e01b7..f4e6c71 100644
--- a/content/browser/web_contents/web_contents_impl.h
+++ b/content/browser/web_contents/web_contents_impl.h
@@ -177,8 +177,6 @@ class CONTENT_EXPORT WebContentsImpl
// MSG_ROUTING_NONE when there is no fullscreen render widget.
int GetFullscreenWidgetRoutingID() const;
- void DidBlock3DAPIs(const GURL& url, ThreeDAPIType requester);
-
// Invoked when visible SSL state (as defined by SSLStatus) changes.
void DidChangeVisibleSSLState();
diff --git a/content/public/browser/gpu_data_manager.h b/content/public/browser/gpu_data_manager.h
index ebe56d6..d6cdb4f 100644
--- a/content/public/browser/gpu_data_manager.h
+++ b/content/public/browser/gpu_data_manager.h
@@ -8,6 +8,7 @@
#include <list>
#include <string>
+#include "base/callback_forward.h"
#include "base/process.h"
#include "content/common/content_export.h"
#include "content/public/common/gpu_feature_type.h"
diff --git a/content/public/browser/gpu_data_manager_observer.h b/content/public/browser/gpu_data_manager_observer.h
index c5b1b3d..1db650b 100644
--- a/content/public/browser/gpu_data_manager_observer.h
+++ b/content/public/browser/gpu_data_manager_observer.h
@@ -7,6 +7,9 @@
#include "content/common/content_export.h"
#include "content/public/common/gpu_memory_stats.h"
+#include "content/public/common/three_d_api_types.h"
+
+class GURL;
namespace content {
@@ -15,11 +18,18 @@ namespace content {
class GpuDataManagerObserver {
public:
// Called for any observers whenever there is a GPU info update.
- virtual void OnGpuInfoUpdate() = 0;
+ virtual void OnGpuInfoUpdate() {}
// Called for any observers whenever there is a GPU video memory update.
virtual void OnVideoMemoryUsageStatsUpdate(
- const GPUVideoMemoryUsageStats& video_memory_usage_stats) = 0;
+ const GPUVideoMemoryUsageStats& video_memory_usage_stats) {}
+
+ // Indicates that client 3D APIs (Pepper 3D, WebGL) were just blocked on the
+ // given page, specifically because the GPU was reset recently.
+ virtual void DidBlock3DAPIs(const GURL& url,
+ int render_process_id,
+ int render_view_id,
+ ThreeDAPIType requester) {}
protected:
virtual ~GpuDataManagerObserver() {}
diff --git a/content/public/browser/web_contents_observer.h b/content/public/browser/web_contents_observer.h
index a66e428..3209a4b 100644
--- a/content/public/browser/web_contents_observer.h
+++ b/content/public/browser/web_contents_observer.h
@@ -10,7 +10,6 @@
#include "content/common/content_export.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/common/page_transition_types.h"
-#include "content/public/common/three_d_api_types.h"
#include "ipc/ipc_listener.h"
#include "ipc/ipc_sender.h"
#include "ui/base/window_open_disposition.h"
@@ -234,12 +233,6 @@ class CONTENT_EXPORT WebContentsObserver : public IPC::Listener,
// Called when the user agent override for a WebContents has been changed.
virtual void UserAgentOverrideSet(const std::string& user_agent) {}
- // Indicates that client 3D APIs (Pepper 3D, WebGL) were just
- // blocked on the current page, specifically because the GPU was
- // reset recently.
- virtual void DidBlock3DAPIs(const GURL& url,
- ThreeDAPIType requester) {}
-
// Invoked when new FaviconURL candidates are received from the renderer.
virtual void DidUpdateFaviconURL(int32 page_id,
const std::vector<FaviconURL>& candidates) {}