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

Side by Side Diff: mojo/services/gles2/gles2_impl.cc

Issue 128813002: Remove dependencies on base from SampleApp (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove unnecessary change Created 6 years, 11 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
« no previous file with comments | « mojo/services/gles2/gles2_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "mojo/services/gles2/gles2_impl.h" 5 #include "mojo/services/gles2/gles2_impl.h"
6 6
7 #include <stdio.h> 7 #include <stdio.h>
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "gpu/command_buffer/client/gl_in_process_context.h" 9 #include "gpu/command_buffer/client/gl_in_process_context.h"
10 #include "gpu/command_buffer/client/gles2_implementation.h" 10 #include "gpu/command_buffer/client/gles2_implementation.h"
11 11
12 namespace mojo { 12 namespace mojo {
13 namespace services { 13 namespace services {
14 14
15 GLES2Impl::GLES2Impl(ScopedMessagePipeHandle client) 15 GLES2Impl::GLES2Impl(ScopedMessagePipeHandle client)
16 : client_(client.Pass(), this) { 16 : client_(client.Pass(), this) {
17 } 17 }
18 18
19 GLES2Impl::~GLES2Impl() { 19 GLES2Impl::~GLES2Impl() {
20 } 20 }
21 21
22 void GLES2Impl::RequestAnimationFrames() {
23 timer_.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(16),
24 this, &GLES2Impl::DrawAnimationFrame);
25 }
26
27 void GLES2Impl::CancelAnimationFrames() {
28 timer_.Stop();
29 }
30
22 void GLES2Impl::Destroy() { 31 void GLES2Impl::Destroy() {
23 gl_context_.reset(); 32 gl_context_.reset();
24 } 33 }
25 34
26 void GLES2Impl::CreateContext(gfx::AcceleratedWidget widget, 35 void GLES2Impl::CreateContext(gfx::AcceleratedWidget widget,
27 const gfx::Size& size) { 36 const gfx::Size& size) {
28 gpu::GLInProcessContextAttribs attribs; 37 gpu::GLInProcessContextAttribs attribs;
29 gl_context_.reset(gpu::GLInProcessContext::CreateContext( 38 gl_context_.reset(gpu::GLInProcessContext::CreateContext(
30 false, widget, size, false, attribs, gfx::PreferDiscreteGpu)); 39 false, widget, size, false, attribs, gfx::PreferDiscreteGpu));
31 gl_context_->SetContextLostCallback(base::Bind( 40 gl_context_->SetContextLostCallback(base::Bind(
32 &GLES2Impl::OnGLContextLost, base::Unretained(this))); 41 &GLES2Impl::OnGLContextLost, base::Unretained(this)));
33 42
34 gpu::gles2::GLES2Interface* gl = gl_context_->GetImplementation(); 43 gpu::gles2::GLES2Interface* gl = gl_context_->GetImplementation();
35 uint64_t encoded_gl = static_cast<uint64_t>(reinterpret_cast<uintptr_t>(gl)); 44 uint64_t encoded_gl = static_cast<uint64_t>(reinterpret_cast<uintptr_t>(gl));
36 45
37 client_->DidCreateContext(encoded_gl, size.width(), size.height()); 46 client_->DidCreateContext(encoded_gl, size.width(), size.height());
38 } 47 }
39 48
40 void GLES2Impl::OnGLContextLost() { 49 void GLES2Impl::OnGLContextLost() {
41 client_->ContextLost(); 50 client_->ContextLost();
42 } 51 }
43 52
53 void GLES2Impl::DrawAnimationFrame() {
54 client_->DrawAnimationFrame();
55 }
56
44 } // namespace services 57 } // namespace services
45 } // namespace mojo 58 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/services/gles2/gles2_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698