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

Unified Diff: content/test/test_render_view_host.cc

Issue 2297273004: Revert "Revert of content: Fix Context creation logic in ContextProviderFactoryImpl. (patchset #10 … (Closed)
Patch Set: remove gpu process initialization failure Created 4 years, 3 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/test/mock_gpu_channel_establish_factory.cc ('k') | ui/android/context_provider_factory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/test/test_render_view_host.cc
diff --git a/content/test/test_render_view_host.cc b/content/test/test_render_view_host.cc
index ec9bea112b4c9ee1cb0d779b980a6ac530254a91..7f59729fe37b5e37ea2d061dc7e163ec9983122d 100644
--- a/content/test/test_render_view_host.cc
+++ b/content/test/test_render_view_host.cc
@@ -33,6 +33,10 @@
#include "ui/compositor/compositor.h"
#include "ui/gfx/geometry/rect.h"
+#if defined(OS_ANDROID)
+#include "content/browser/renderer_host/context_provider_factory_impl_android.h"
+#endif
+
namespace content {
void InitNavigateParams(FrameHostMsg_DidCommitProvisionalLoad_Params* params,
@@ -63,10 +67,13 @@ TestRenderWidgetHostView::TestRenderWidgetHostView(RenderWidgetHost* rwh)
is_occluded_(false),
did_swap_compositor_frame_(false) {
#if defined(OS_ANDROID)
- surface_id_allocator_.reset(
- new cc::SurfaceIdAllocator(AllocateSurfaceClientId()));
- GetSurfaceManager()->RegisterSurfaceClientId(
- surface_id_allocator_->client_id());
+ // Not all tests initialize or need a context provider factory.
+ if (ContextProviderFactoryImpl::GetInstance()) {
+ surface_id_allocator_.reset(
+ new cc::SurfaceIdAllocator(AllocateSurfaceClientId()));
+ GetSurfaceManager()->RegisterSurfaceClientId(
+ surface_id_allocator_->client_id());
+ }
#else
// Not all tests initialize or need an image transport factory.
if (ImageTransportFactory::GetInstance()) {
@@ -81,9 +88,15 @@ TestRenderWidgetHostView::TestRenderWidgetHostView(RenderWidgetHost* rwh)
}
TestRenderWidgetHostView::~TestRenderWidgetHostView() {
- if (GetSurfaceManager()) {
- GetSurfaceManager()->InvalidateSurfaceClientId(
- surface_id_allocator_->client_id());
+ cc::SurfaceManager* manager = nullptr;
+#if defined(OS_ANDROID)
+ if (ContextProviderFactoryImpl::GetInstance())
+ manager = GetSurfaceManager();
+#else
+ manager = GetSurfaceManager();
+#endif
+ if (manager) {
+ manager->InvalidateSurfaceClientId(surface_id_allocator_->client_id());
}
}
« no previous file with comments | « content/test/mock_gpu_channel_establish_factory.cc ('k') | ui/android/context_provider_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698