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

Side by Side Diff: mojo/examples/sample_app/gles2_client_impl.h

Issue 384513003: Remove RequestAnimationFrame from mojo, add delayed tasks to RunLoop (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #ifndef MOJO_EXAMPLES_SAMPLE_APP_GLES2_CLIENT_IMPL_H_ 5 #ifndef MOJO_EXAMPLES_SAMPLE_APP_GLES2_CLIENT_IMPL_H_
6 #define MOJO_EXAMPLES_SAMPLE_APP_GLES2_CLIENT_IMPL_H_ 6 #define MOJO_EXAMPLES_SAMPLE_APP_GLES2_CLIENT_IMPL_H_
7 7
8 #include "mojo/examples/sample_app/spinning_cube.h" 8 #include "mojo/examples/sample_app/spinning_cube.h"
9 #include "mojo/public/c/gles2/gles2.h" 9 #include "mojo/public/c/gles2/gles2.h"
10 #include "mojo/services/public/interfaces/geometry/geometry.mojom.h" 10 #include "mojo/services/public/interfaces/geometry/geometry.mojom.h"
11 #include "mojo/services/public/interfaces/native_viewport/native_viewport.mojom. h" 11 #include "mojo/services/public/interfaces/native_viewport/native_viewport.mojom. h"
12 12
13 namespace examples { 13 namespace examples {
14 14
15 class GLES2ClientImpl { 15 class GLES2ClientImpl {
16 public: 16 public:
17 explicit GLES2ClientImpl(mojo::CommandBufferPtr command_buffer); 17 explicit GLES2ClientImpl(mojo::CommandBufferPtr command_buffer);
18 virtual ~GLES2ClientImpl(); 18 virtual ~GLES2ClientImpl();
19 19
20 void SetSize(const mojo::Size& size); 20 void SetSize(const mojo::Size& size);
21 void HandleInputEvent(const mojo::Event& event); 21 void HandleInputEvent(const mojo::Event& event);
22 void Draw();
22 23
23 private: 24 private:
24 void ContextLost(); 25 void ContextLost();
25 static void ContextLostThunk(void* closure); 26 static void ContextLostThunk(void* closure);
26 void DrawAnimationFrame(); 27 void WantToDraw();
27 static void DrawAnimationFrameThunk(void* closure);
28
29 void RequestAnimationFrames();
30 void CancelAnimationFrames();
31 28
32 MojoTimeTicks last_time_; 29 MojoTimeTicks last_time_;
33 mojo::Size size_; 30 mojo::Size size_;
34 SpinningCube cube_; 31 SpinningCube cube_;
35 mojo::Point capture_point_; 32 mojo::Point capture_point_;
36 mojo::Point last_drag_point_; 33 mojo::Point last_drag_point_;
37 MojoTimeTicks drag_start_time_; 34 MojoTimeTicks drag_start_time_;
38 bool getting_animation_frames_; 35 bool waiting_to_draw_;
39 36
40 MojoGLES2Context context_; 37 MojoGLES2Context context_;
41 38
42 MOJO_DISALLOW_COPY_AND_ASSIGN(GLES2ClientImpl); 39 MOJO_DISALLOW_COPY_AND_ASSIGN(GLES2ClientImpl);
43 }; 40 };
44 41
45 } // namespace examples 42 } // namespace examples
46 43
47 #endif // MOJO_EXAMPLES_SAMPLE_APP_GLES2_CLIENT_IMPL_H_ 44 #endif // MOJO_EXAMPLES_SAMPLE_APP_GLES2_CLIENT_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698