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

Side by Side Diff: mojo/services/surfaces/surfaces_service_application.cc

Issue 771043002: Move surfaces service implementation to //services (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "mojo/services/surfaces/surfaces_service_application.h"
6
7 #include "cc/surfaces/display.h"
8 #include "mojo/application/application_runner_chromium.h"
9 #include "mojo/common/tracing_impl.h"
10 #include "mojo/public/c/system/main.h"
11 #include "mojo/services/surfaces/surfaces_service_impl.h"
12
13 namespace mojo {
14
15 SurfacesServiceApplication::SurfacesServiceApplication()
16 : tick_interval_(base::TimeDelta::FromMilliseconds(17)),
17 next_id_namespace_(1u),
18 display_(NULL),
19 draw_timer_(false, false) {
20 }
21
22 SurfacesServiceApplication::~SurfacesServiceApplication() {
23 }
24
25 void SurfacesServiceApplication::Initialize(ApplicationImpl* app) {
26 TracingImpl::Create(app);
27 }
28
29 bool SurfacesServiceApplication::ConfigureIncomingConnection(
30 ApplicationConnection* connection) {
31 connection->AddService(this);
32 return true;
33 }
34
35 void SurfacesServiceApplication::Create(
36 ApplicationConnection* connection,
37 InterfaceRequest<SurfacesService> request) {
38 new SurfacesServiceImpl(&manager_, &next_id_namespace_, this, request.Pass());
39 }
40
41 void SurfacesServiceApplication::OnVSyncParametersUpdated(
42 base::TimeTicks timebase,
43 base::TimeDelta interval) {
44 tick_interval_ = interval;
45 }
46
47 void SurfacesServiceApplication::FrameSubmitted() {
48 if (!draw_timer_.IsRunning() && display_) {
49 draw_timer_.Start(FROM_HERE, tick_interval_,
50 base::Bind(base::IgnoreResult(&cc::Display::Draw),
51 base::Unretained(display_)));
52 }
53 }
54
55 void SurfacesServiceApplication::SetDisplay(cc::Display* display) {
56 draw_timer_.Stop();
57 display_ = display;
58 }
59
60 void SurfacesServiceApplication::OnDisplayBeingDestroyed(cc::Display* display) {
61 if (display_ == display)
62 SetDisplay(nullptr);
63 }
64
65 } // namespace mojo
66
67 MojoResult MojoMain(MojoHandle shell_handle) {
68 mojo::ApplicationRunnerChromium runner(new mojo::SurfacesServiceApplication);
69 return runner.Run(shell_handle);
70 }
OLDNEW
« no previous file with comments | « mojo/services/surfaces/surfaces_service_application.h ('k') | mojo/services/surfaces/surfaces_service_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698