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

Side by Side Diff: content/test/test_render_view_host.cc

Issue 2297933002: blimp: Set up the CompositorDependencies for blimp in Chrome. (Closed)
Patch Set: retry gpu process failures after crbug.com/643282 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/test/test_render_view_host.h" 5 #include "content/test/test_render_view_host.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 15 matching lines...) Expand all
26 #include "content/public/common/content_client.h" 26 #include "content/public/common/content_client.h"
27 #include "content/public/common/page_state.h" 27 #include "content/public/common/page_state.h"
28 #include "content/public/common/web_preferences.h" 28 #include "content/public/common/web_preferences.h"
29 #include "content/test/test_render_frame_host.h" 29 #include "content/test/test_render_frame_host.h"
30 #include "content/test/test_web_contents.h" 30 #include "content/test/test_web_contents.h"
31 #include "media/base/video_frame.h" 31 #include "media/base/video_frame.h"
32 #include "ui/aura/env.h" 32 #include "ui/aura/env.h"
33 #include "ui/compositor/compositor.h" 33 #include "ui/compositor/compositor.h"
34 #include "ui/gfx/geometry/rect.h" 34 #include "ui/gfx/geometry/rect.h"
35 35
36 #if defined(OS_ANDROID)
37 #include "content/browser/renderer_host/context_provider_factory_impl_android.h"
38 #endif
39
36 namespace content { 40 namespace content {
37 41
38 void InitNavigateParams(FrameHostMsg_DidCommitProvisionalLoad_Params* params, 42 void InitNavigateParams(FrameHostMsg_DidCommitProvisionalLoad_Params* params,
39 int page_id, 43 int page_id,
40 int nav_entry_id, 44 int nav_entry_id,
41 bool did_create_new_entry, 45 bool did_create_new_entry,
42 const GURL& url, 46 const GURL& url,
43 ui::PageTransition transition) { 47 ui::PageTransition transition) {
44 params->page_id = page_id; 48 params->page_id = page_id;
45 params->nav_entry_id = nav_entry_id; 49 params->nav_entry_id = nav_entry_id;
(...skipping 10 matching lines...) Expand all
56 params->method = "GET"; 60 params->method = "GET";
57 params->page_state = PageState::CreateFromURL(url); 61 params->page_state = PageState::CreateFromURL(url);
58 } 62 }
59 63
60 TestRenderWidgetHostView::TestRenderWidgetHostView(RenderWidgetHost* rwh) 64 TestRenderWidgetHostView::TestRenderWidgetHostView(RenderWidgetHost* rwh)
61 : rwh_(RenderWidgetHostImpl::From(rwh)), 65 : rwh_(RenderWidgetHostImpl::From(rwh)),
62 is_showing_(false), 66 is_showing_(false),
63 is_occluded_(false), 67 is_occluded_(false),
64 did_swap_compositor_frame_(false) { 68 did_swap_compositor_frame_(false) {
65 #if defined(OS_ANDROID) 69 #if defined(OS_ANDROID)
66 surface_id_allocator_.reset( 70 // Not all tests initialize or need a context provider factory.
67 new cc::SurfaceIdAllocator(AllocateSurfaceClientId())); 71 if (ContextProviderFactoryImpl::GetInstance()) {
68 GetSurfaceManager()->RegisterSurfaceClientId( 72 surface_id_allocator_.reset(
69 surface_id_allocator_->client_id()); 73 new cc::SurfaceIdAllocator(AllocateSurfaceClientId()));
74 GetSurfaceManager()->RegisterSurfaceClientId(
75 surface_id_allocator_->client_id());
76 }
70 #else 77 #else
71 // Not all tests initialize or need an image transport factory. 78 // Not all tests initialize or need an image transport factory.
72 if (ImageTransportFactory::GetInstance()) { 79 if (ImageTransportFactory::GetInstance()) {
73 surface_id_allocator_.reset( 80 surface_id_allocator_.reset(
74 new cc::SurfaceIdAllocator(AllocateSurfaceClientId())); 81 new cc::SurfaceIdAllocator(AllocateSurfaceClientId()));
75 GetSurfaceManager()->RegisterSurfaceClientId( 82 GetSurfaceManager()->RegisterSurfaceClientId(
76 surface_id_allocator_->client_id()); 83 surface_id_allocator_->client_id());
77 } 84 }
78 #endif 85 #endif
79 86
80 rwh_->SetView(this); 87 rwh_->SetView(this);
81 } 88 }
82 89
83 TestRenderWidgetHostView::~TestRenderWidgetHostView() { 90 TestRenderWidgetHostView::~TestRenderWidgetHostView() {
84 if (GetSurfaceManager()) { 91 cc::SurfaceManager* manager = nullptr;
85 GetSurfaceManager()->InvalidateSurfaceClientId( 92 #if defined(OS_ANDROID)
86 surface_id_allocator_->client_id()); 93 if (ContextProviderFactoryImpl::GetInstance())
94 manager = GetSurfaceManager();
95 #else
96 manager = GetSurfaceManager();
97 #endif
98 if (manager) {
99 manager->InvalidateSurfaceClientId(surface_id_allocator_->client_id());
87 } 100 }
88 } 101 }
89 102
90 RenderWidgetHost* TestRenderWidgetHostView::GetRenderWidgetHost() const { 103 RenderWidgetHost* TestRenderWidgetHostView::GetRenderWidgetHost() const {
91 return rwh_; 104 return rwh_;
92 } 105 }
93 106
94 gfx::Vector2dF TestRenderWidgetHostView::GetLastScrollOffset() const { 107 gfx::Vector2dF TestRenderWidgetHostView::GetLastScrollOffset() const {
95 return gfx::Vector2dF(); 108 return gfx::Vector2dF();
96 } 109 }
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 351
339 TestRenderFrameHost* RenderViewHostImplTestHarness::main_test_rfh() { 352 TestRenderFrameHost* RenderViewHostImplTestHarness::main_test_rfh() {
340 return contents()->GetMainFrame(); 353 return contents()->GetMainFrame();
341 } 354 }
342 355
343 TestWebContents* RenderViewHostImplTestHarness::contents() { 356 TestWebContents* RenderViewHostImplTestHarness::contents() {
344 return static_cast<TestWebContents*>(web_contents()); 357 return static_cast<TestWebContents*>(web_contents());
345 } 358 }
346 359
347 } // namespace content 360 } // namespace content
OLDNEW
« 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