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

Unified Diff: components/surfaces/surfaces_context_provider.cc

Issue 1138293002: core_services: Add mojo:surfaces_service to core_services. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: components/surfaces/surfaces_context_provider.cc
diff --git a/components/surfaces/context_provider_mojo.cc b/components/surfaces/surfaces_context_provider.cc
similarity index 55%
rename from components/surfaces/context_provider_mojo.cc
rename to components/surfaces/surfaces_context_provider.cc
index 8e8ebc38de3c2876fadfa5f23f43d6c082529809..41ab76cd4842715a292df28f07fbd4315acc3edb 100644
--- a/components/surfaces/context_provider_mojo.cc
+++ b/components/surfaces/surfaces_context_provider.cc
@@ -2,82 +2,83 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "components/surfaces/context_provider_mojo.h"
+#include "components/surfaces/surfaces_context_provider.h"
#include "base/logging.h"
#include "third_party/mojo/src/mojo/public/cpp/environment/environment.h"
-namespace mojo {
+namespace surfaces {
-ContextProviderMojo::ContextProviderMojo(
- ScopedMessagePipeHandle command_buffer_handle)
+SurfacesContextProvider::SurfacesContextProvider(
+ mojo::ScopedMessagePipeHandle command_buffer_handle)
: command_buffer_handle_(command_buffer_handle.Pass()),
context_(nullptr),
context_lost_(false) {
}
-bool ContextProviderMojo::BindToCurrentThread() {
+bool SurfacesContextProvider::BindToCurrentThread() {
DCHECK(command_buffer_handle_.is_valid());
context_ = MojoGLES2CreateContext(command_buffer_handle_.release().value(),
&ContextLostThunk, this,
- Environment::GetDefaultAsyncWaiter());
+ mojo::Environment::GetDefaultAsyncWaiter());
DCHECK(context_);
return !!context_;
}
-gpu::gles2::GLES2Interface* ContextProviderMojo::ContextGL() {
+gpu::gles2::GLES2Interface* SurfacesContextProvider::ContextGL() {
if (!context_)
return nullptr;
return static_cast<gpu::gles2::GLES2Interface*>(
MojoGLES2GetGLES2Interface(context_));
}
-gpu::ContextSupport* ContextProviderMojo::ContextSupport() {
+gpu::ContextSupport* SurfacesContextProvider::ContextSupport() {
if (!context_)
return nullptr;
return static_cast<gpu::ContextSupport*>(
MojoGLES2GetContextSupport(context_));
}
-class GrContext* ContextProviderMojo::GrContext() {
+class GrContext* SurfacesContextProvider::GrContext() {
return NULL;
}
-void ContextProviderMojo::InvalidateGrContext(uint32_t state) {
+void SurfacesContextProvider::InvalidateGrContext(uint32_t state) {
}
-cc::ContextProvider::Capabilities ContextProviderMojo::ContextCapabilities() {
+cc::ContextProvider::Capabilities
+SurfacesContextProvider::ContextCapabilities() {
return capabilities_;
}
-void ContextProviderMojo::SetupLock() {
+void SurfacesContextProvider::SetupLock() {
}
-base::Lock* ContextProviderMojo::GetLock() {
+base::Lock* SurfacesContextProvider::GetLock() {
return &context_lock_;
}
-bool ContextProviderMojo::IsContextLost() {
+bool SurfacesContextProvider::IsContextLost() {
return context_lost_;
}
-bool ContextProviderMojo::DestroyedOnMainThread() {
+bool SurfacesContextProvider::DestroyedOnMainThread() {
return !context_;
}
-void ContextProviderMojo::SetLostContextCallback(
+void SurfacesContextProvider::SetLostContextCallback(
const LostContextCallback& lost_context_callback) {
lost_context_callback_ = lost_context_callback;
}
-ContextProviderMojo::~ContextProviderMojo() {
+SurfacesContextProvider::~SurfacesContextProvider() {
if (context_)
MojoGLES2DestroyContext(context_);
}
-void ContextProviderMojo::ContextLost() {
+void SurfacesContextProvider::ContextLost() {
context_lost_ = true;
if (!lost_context_callback_.is_null())
lost_context_callback_.Run();
}
-} // namespace mojo
+} // namespace surfaces

Powered by Google App Engine
This is Rietveld 408576698