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

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

Issue 1159493010: 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_ = 31 software_surface_ = ui::OzonePlatform::GetInstance()
32 ui::SurfaceFactoryOzone::GetInstance()->CreateCanvasForWidget(widget_); 32 ->GetSurfaceFactoryOzone()
33 ->CreateCanvasForWidget(widget_);
33 if (!software_surface_) { 34 if (!software_surface_) {
34 LOG(ERROR) << "Failed to create software surface"; 35 LOG(ERROR) << "Failed to create software surface";
35 return false; 36 return false;
36 } 37 }
37 38
38 software_surface_->ResizeCanvas(size_); 39 software_surface_->ResizeCanvas(size_);
39 vsync_provider_ = software_surface_->CreateVSyncProvider(); 40 vsync_provider_ = software_surface_->CreateVSyncProvider();
40 RenderFrame(); 41 RenderFrame();
41 return true; 42 return true;
42 } 43 }
(...skipping 18 matching lines...) Expand all
61 62
62 timer_.Start(FROM_HERE, vsync_period_, this, &SoftwareRenderer::RenderFrame); 63 timer_.Start(FROM_HERE, vsync_period_, this, &SoftwareRenderer::RenderFrame);
63 } 64 }
64 65
65 void SoftwareRenderer::UpdateVSyncParameters(const base::TimeTicks timebase, 66 void SoftwareRenderer::UpdateVSyncParameters(const base::TimeTicks timebase,
66 const base::TimeDelta interval) { 67 const base::TimeDelta interval) {
67 vsync_period_ = interval; 68 vsync_period_ = interval;
68 } 69 }
69 70
70 } // namespace ui 71 } // 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