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

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

Issue 2166423002: ui::ContextFactory should not create SurfaceIdAllocators (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed Dana's nit Created 4 years, 5 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 params->method = "GET"; 57 params->method = "GET";
58 params->page_state = PageState::CreateFromURL(url); 58 params->page_state = PageState::CreateFromURL(url);
59 } 59 }
60 60
61 TestRenderWidgetHostView::TestRenderWidgetHostView(RenderWidgetHost* rwh) 61 TestRenderWidgetHostView::TestRenderWidgetHostView(RenderWidgetHost* rwh)
62 : rwh_(RenderWidgetHostImpl::From(rwh)), 62 : rwh_(RenderWidgetHostImpl::From(rwh)),
63 is_showing_(false), 63 is_showing_(false),
64 is_occluded_(false), 64 is_occluded_(false),
65 did_swap_compositor_frame_(false) { 65 did_swap_compositor_frame_(false) {
66 #if defined(OS_ANDROID) 66 #if defined(OS_ANDROID)
67 surface_id_allocator_ = CreateSurfaceIdAllocator(); 67 surface_id_allocator_.reset(
68 new cc::SurfaceIdAllocator(AllocateSurfaceClientId()));
69 GetSurfaceManager()->RegisterSurfaceClientId(
70 surface_id_allocator_->client_id());
68 #else 71 #else
69 // Not all tests initialize or need an image transport factory. 72 // Not all tests initialize or need an image transport factory.
70 if (ImageTransportFactory::GetInstance()) 73 if (ImageTransportFactory::GetInstance()) {
71 surface_id_allocator_ = CreateSurfaceIdAllocator(); 74 surface_id_allocator_.reset(
75 new cc::SurfaceIdAllocator(AllocateSurfaceClientId()));
76 GetSurfaceManager()->RegisterSurfaceClientId(
77 surface_id_allocator_->client_id());
78 }
72 #endif 79 #endif
73 80
74 rwh_->SetView(this); 81 rwh_->SetView(this);
75 } 82 }
76 83
77 TestRenderWidgetHostView::~TestRenderWidgetHostView() { 84 TestRenderWidgetHostView::~TestRenderWidgetHostView() {
85 if (GetSurfaceManager()) {
86 GetSurfaceManager()->InvalidateSurfaceClientId(
87 surface_id_allocator_->client_id());
88 }
78 } 89 }
79 90
80 RenderWidgetHost* TestRenderWidgetHostView::GetRenderWidgetHost() const { 91 RenderWidgetHost* TestRenderWidgetHostView::GetRenderWidgetHost() const {
81 return rwh_; 92 return rwh_;
82 } 93 }
83 94
84 gfx::Vector2dF TestRenderWidgetHostView::GetLastScrollOffset() const { 95 gfx::Vector2dF TestRenderWidgetHostView::GetLastScrollOffset() const {
85 return gfx::Vector2dF(); 96 return gfx::Vector2dF();
86 } 97 }
87 98
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 339
329 TestRenderFrameHost* RenderViewHostImplTestHarness::main_test_rfh() { 340 TestRenderFrameHost* RenderViewHostImplTestHarness::main_test_rfh() {
330 return contents()->GetMainFrame(); 341 return contents()->GetMainFrame();
331 } 342 }
332 343
333 TestWebContents* RenderViewHostImplTestHarness::contents() { 344 TestWebContents* RenderViewHostImplTestHarness::contents() {
334 return static_cast<TestWebContents*>(web_contents()); 345 return static_cast<TestWebContents*>(web_contents());
335 } 346 }
336 347
337 } // namespace content 348 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/android/synchronous_compositor_output_surface.cc ('k') | services/ui/surfaces/display_compositor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698