summaryrefslogtreecommitdiffstats
path: root/mojo/examples/compositor_app
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-06 22:34:24 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-06 22:34:24 +0000
commit78ecb7ca3cca6b4199236c846b6d5413ffb710ab (patch)
tree29d50f8c4cfc6df401e73a1a732447a8ec9f35d9 /mojo/examples/compositor_app
parent5d8507b3c0d878e9462a5523ae31372ead7e23d6 (diff)
downloadchromium_src-78ecb7ca3cca6b4199236c846b6d5413ffb710ab.zip
chromium_src-78ecb7ca3cca6b4199236c846b6d5413ffb710ab.tar.gz
chromium_src-78ecb7ca3cca6b4199236c846b6d5413ffb710ab.tar.bz2
Shuffles around some files
I'm moving these files into a more common location so that they can be used by the view manager. BUG=365012 TEST=none R=ben@chromium.org Review URL: https://codereview.chromium.org/262093008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@268627 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'mojo/examples/compositor_app')
-rw-r--r--mojo/examples/compositor_app/compositor_host.cc4
-rw-r--r--mojo/examples/compositor_app/mojo_context_provider.cc58
-rw-r--r--mojo/examples/compositor_app/mojo_context_provider.h48
3 files changed, 2 insertions, 108 deletions
diff --git a/mojo/examples/compositor_app/compositor_host.cc b/mojo/examples/compositor_app/compositor_host.cc
index 87534ed..7c7e701 100644
--- a/mojo/examples/compositor_app/compositor_host.cc
+++ b/mojo/examples/compositor_app/compositor_host.cc
@@ -9,7 +9,7 @@
#include "cc/output/context_provider.h"
#include "cc/output/output_surface.h"
#include "cc/trees/layer_tree_host.h"
-#include "mojo/examples/compositor_app/mojo_context_provider.h"
+#include "mojo/cc/context_provider_mojo.h"
namespace mojo {
namespace examples {
@@ -73,7 +73,7 @@ void CompositorHost::ApplyScrollAndScale(const gfx::Vector2d& scroll_delta,
scoped_ptr<cc::OutputSurface> CompositorHost::CreateOutputSurface(
bool fallback) {
return make_scoped_ptr(
- new cc::OutputSurface(new MojoContextProvider(gl_pipe_.Pass())));
+ new cc::OutputSurface(new ContextProviderMojo(gl_pipe_.Pass())));
}
void CompositorHost::DidInitializeOutputSurface() {
diff --git a/mojo/examples/compositor_app/mojo_context_provider.cc b/mojo/examples/compositor_app/mojo_context_provider.cc
deleted file mode 100644
index 3b52d1e..0000000
--- a/mojo/examples/compositor_app/mojo_context_provider.cc
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "mojo/examples/compositor_app/mojo_context_provider.h"
-
-#include "base/logging.h"
-
-namespace mojo {
-namespace examples {
-
-MojoContextProvider::MojoContextProvider(ScopedMessagePipeHandle gl_pipe)
- : gl_pipe_(gl_pipe.Pass()) {}
-
-bool MojoContextProvider::BindToCurrentThread() {
- DCHECK(gl_pipe_.is_valid());
- context_ = MojoGLES2CreateContext(
- gl_pipe_.release().value(), &ContextLostThunk, NULL, this);
- return !!context_;
-}
-
-gpu::gles2::GLES2Interface* MojoContextProvider::ContextGL() {
- if (!context_)
- return NULL;
- return static_cast<gpu::gles2::GLES2Interface*>(
- MojoGLES2GetGLES2Interface(context_));
-}
-
-gpu::ContextSupport* MojoContextProvider::ContextSupport() {
- if (!context_)
- return NULL;
- return static_cast<gpu::ContextSupport*>(
- MojoGLES2GetContextSupport(context_));
-}
-
-class GrContext* MojoContextProvider::GrContext() { return NULL; }
-
-cc::ContextProvider::Capabilities MojoContextProvider::ContextCapabilities() {
- return capabilities_;
-}
-
-bool MojoContextProvider::IsContextLost() { return !context_; }
-bool MojoContextProvider::DestroyedOnMainThread() { return !context_; }
-
-MojoContextProvider::~MojoContextProvider() {
- if (context_)
- MojoGLES2DestroyContext(context_);
-}
-
-void MojoContextProvider::ContextLost() {
- if (context_) {
- MojoGLES2DestroyContext(context_);
- context_ = NULL;
- }
-}
-
-} // namespace examples
-} // namespace mojo
diff --git a/mojo/examples/compositor_app/mojo_context_provider.h b/mojo/examples/compositor_app/mojo_context_provider.h
deleted file mode 100644
index bcee248..0000000
--- a/mojo/examples/compositor_app/mojo_context_provider.h
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "cc/output/context_provider.h"
-#include "mojo/public/c/gles2/gles2.h"
-#include "mojo/public/cpp/system/core.h"
-
-namespace mojo {
-namespace examples {
-
-class MojoContextProvider : public cc::ContextProvider {
- public:
- explicit MojoContextProvider(ScopedMessagePipeHandle gl_pipe);
-
- // cc::ContextProvider implementation.
- virtual bool BindToCurrentThread() OVERRIDE;
- virtual gpu::gles2::GLES2Interface* ContextGL() OVERRIDE;
- virtual gpu::ContextSupport* ContextSupport() OVERRIDE;
- virtual class GrContext* GrContext() OVERRIDE;
- virtual Capabilities ContextCapabilities() OVERRIDE;
- virtual bool IsContextLost() OVERRIDE;
- virtual void VerifyContexts() OVERRIDE {}
- virtual void DeleteCachedResources() OVERRIDE {}
- virtual bool DestroyedOnMainThread() OVERRIDE;
- virtual void SetLostContextCallback(
- const LostContextCallback& lost_context_callback) OVERRIDE {}
- virtual void SetMemoryPolicyChangedCallback(
- const MemoryPolicyChangedCallback& memory_policy_changed_callback)
- OVERRIDE {}
-
- protected:
- friend class base::RefCountedThreadSafe<MojoContextProvider>;
- virtual ~MojoContextProvider();
-
- private:
- static void ContextLostThunk(void* closure) {
- static_cast<MojoContextProvider*>(closure)->ContextLost();
- }
- void ContextLost();
-
- cc::ContextProvider::Capabilities capabilities_;
- ScopedMessagePipeHandle gl_pipe_;
- MojoGLES2Context context_;
-};
-
-} // namespace examples
-} // namespace mojo