| Index: mojo/services/surfaces/context_provider_mojo.cc
 | 
| diff --git a/mojo/cc/context_provider_mojo.cc b/mojo/services/surfaces/context_provider_mojo.cc
 | 
| similarity index 65%
 | 
| copy from mojo/cc/context_provider_mojo.cc
 | 
| copy to mojo/services/surfaces/context_provider_mojo.cc
 | 
| index aed1712e80a3f22d90e3990af8946306798dc6db..2874794243ada3ec536d24027168d903c2ad414b 100644
 | 
| --- a/mojo/cc/context_provider_mojo.cc
 | 
| +++ b/mojo/services/surfaces/context_provider_mojo.cc
 | 
| @@ -2,42 +2,46 @@
 | 
|  // Use of this source code is governed by a BSD-style license that can be
 | 
|  // found in the LICENSE file.
 | 
|  
 | 
| -#include "mojo/cc/context_provider_mojo.h"
 | 
| +#include "mojo/services/surfaces/context_provider_mojo.h"
 | 
|  
 | 
|  #include "base/logging.h"
 | 
| -#include "mojo/gpu/mojo_gles2_impl_autogen.h"
 | 
| -#include "third_party/mojo/src/mojo/public/cpp/environment/environment.h"
 | 
| +#include "mojo/public/cpp/environment/environment.h"
 | 
|  
 | 
|  namespace mojo {
 | 
|  
 | 
|  ContextProviderMojo::ContextProviderMojo(
 | 
|      ScopedMessagePipeHandle command_buffer_handle)
 | 
|      : command_buffer_handle_(command_buffer_handle.Pass()),
 | 
| +      context_(nullptr),
 | 
|        context_lost_(false) {
 | 
|  }
 | 
|  
 | 
|  bool ContextProviderMojo::BindToCurrentThread() {
 | 
|    DCHECK(command_buffer_handle_.is_valid());
 | 
|    context_ = MojoGLES2CreateContext(command_buffer_handle_.release().value(),
 | 
| -                                    &ContextLostThunk,
 | 
| -                                    this,
 | 
| +                                    &ContextLostThunk, this,
 | 
|                                      Environment::GetDefaultAsyncWaiter());
 | 
| -  context_gl_.reset(new MojoGLES2Impl(context_));
 | 
| +  DCHECK(context_);
 | 
|    return !!context_;
 | 
|  }
 | 
|  
 | 
|  gpu::gles2::GLES2Interface* ContextProviderMojo::ContextGL() {
 | 
| -  return context_gl_.get();
 | 
| +  if (!context_)
 | 
| +    return nullptr;
 | 
| +  return static_cast<gpu::gles2::GLES2Interface*>(
 | 
| +      MojoGLES2GetGLES2Interface(context_));
 | 
|  }
 | 
|  
 | 
|  gpu::ContextSupport* ContextProviderMojo::ContextSupport() {
 | 
|    if (!context_)
 | 
| -    return NULL;
 | 
| +    return nullptr;
 | 
|    return static_cast<gpu::ContextSupport*>(
 | 
|        MojoGLES2GetContextSupport(context_));
 | 
|  }
 | 
|  
 | 
| -class GrContext* ContextProviderMojo::GrContext() { return NULL; }
 | 
| +class GrContext* ContextProviderMojo::GrContext() {
 | 
| +  return NULL;
 | 
| +}
 | 
|  
 | 
|  cc::ContextProvider::Capabilities ContextProviderMojo::ContextCapabilities() {
 | 
|    return capabilities_;
 | 
| @@ -53,16 +57,24 @@ base::Lock* ContextProviderMojo::GetLock() {
 | 
|  bool ContextProviderMojo::IsContextLost() {
 | 
|    return context_lost_;
 | 
|  }
 | 
| -bool ContextProviderMojo::DestroyedOnMainThread() { return !context_; }
 | 
| +bool ContextProviderMojo::DestroyedOnMainThread() {
 | 
| +  return !context_;
 | 
| +}
 | 
| +
 | 
| +void ContextProviderMojo::SetLostContextCallback(
 | 
| +    const LostContextCallback& lost_context_callback) {
 | 
| +  lost_context_callback_ = lost_context_callback;
 | 
| +}
 | 
|  
 | 
|  ContextProviderMojo::~ContextProviderMojo() {
 | 
| -  context_gl_.reset();
 | 
|    if (context_)
 | 
|      MojoGLES2DestroyContext(context_);
 | 
|  }
 | 
|  
 | 
|  void ContextProviderMojo::ContextLost() {
 | 
|    context_lost_ = true;
 | 
| +  if (!lost_context_callback_.is_null())
 | 
| +    lost_context_callback_.Run();
 | 
|  }
 | 
|  
 | 
|  }  // namespace mojo
 | 
| 
 |