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

Side by Side Diff: ui/ozone/demo/software_renderer.cc

Issue 1167533007: Revert of ozone: Remove singleton pattern for SurfaceFactoryOzone. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « ui/gl/gl_surface_ozone.cc ('k') | ui/ozone/gpu/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ui/ozone/demo/software_renderer.h" 5 #include "ui/ozone/demo/software_renderer.h"
6 6
7 #include "third_party/skia/include/core/SkCanvas.h" 7 #include "third_party/skia/include/core/SkCanvas.h"
8 #include "third_party/skia/include/core/SkSurface.h" 8 #include "third_party/skia/include/core/SkSurface.h"
9 #include "ui/gfx/vsync_provider.h" 9 #include "ui/gfx/vsync_provider.h"
10 #include "ui/ozone/public/surface_factory_ozone.h" 10 #include "ui/ozone/public/surface_factory_ozone.h"
(...skipping 10 matching lines...) Expand all
21 const gfx::Size& size) 21 const gfx::Size& size)
22 : RendererBase(widget, size), 22 : RendererBase(widget, size),
23 vsync_period_(base::TimeDelta::FromMilliseconds(kFrameDelayMilliseconds)), 23 vsync_period_(base::TimeDelta::FromMilliseconds(kFrameDelayMilliseconds)),
24 weak_ptr_factory_(this) { 24 weak_ptr_factory_(this) {
25 } 25 }
26 26
27 SoftwareRenderer::~SoftwareRenderer() { 27 SoftwareRenderer::~SoftwareRenderer() {
28 } 28 }
29 29
30 bool SoftwareRenderer::Initialize() { 30 bool SoftwareRenderer::Initialize() {
31 software_surface_ = ui::OzonePlatform::GetInstance() 31 software_surface_ =
32 ->GetSurfaceFactoryOzone() 32 ui::SurfaceFactoryOzone::GetInstance()->CreateCanvasForWidget(widget_);
33 ->CreateCanvasForWidget(widget_);
34 if (!software_surface_) { 33 if (!software_surface_) {
35 LOG(ERROR) << "Failed to create software surface"; 34 LOG(ERROR) << "Failed to create software surface";
36 return false; 35 return false;
37 } 36 }
38 37
39 software_surface_->ResizeCanvas(size_); 38 software_surface_->ResizeCanvas(size_);
40 vsync_provider_ = software_surface_->CreateVSyncProvider(); 39 vsync_provider_ = software_surface_->CreateVSyncProvider();
41 RenderFrame(); 40 RenderFrame();
42 return true; 41 return true;
43 } 42 }
(...skipping 18 matching lines...) Expand all
62 61
63 timer_.Start(FROM_HERE, vsync_period_, this, &SoftwareRenderer::RenderFrame); 62 timer_.Start(FROM_HERE, vsync_period_, this, &SoftwareRenderer::RenderFrame);
64 } 63 }
65 64
66 void SoftwareRenderer::UpdateVSyncParameters(const base::TimeTicks timebase, 65 void SoftwareRenderer::UpdateVSyncParameters(const base::TimeTicks timebase,
67 const base::TimeDelta interval) { 66 const base::TimeDelta interval) {
68 vsync_period_ = interval; 67 vsync_period_ = interval;
69 } 68 }
70 69
71 } // namespace ui 70 } // namespace ui
OLDNEW
« no previous file with comments | « ui/gl/gl_surface_ozone.cc ('k') | ui/ozone/gpu/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698