diff options
author | fsamuel <fsamuel@chromium.org> | 2015-09-29 21:07:35 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-09-30 04:08:19 +0000 |
commit | 3279b740840cc3aa2ce1107b2d300d3d5d92e945 (patch) | |
tree | 6c491c5bfe4c4e39333389aae26ddb7a145e0a51 | |
parent | fb081a50c48b20a7169abdd3430bf09564316437 (diff) | |
download | chromium_src-3279b740840cc3aa2ce1107b2d300d3d5d92e945.zip chromium_src-3279b740840cc3aa2ce1107b2d300d3d5d92e945.tar.gz chromium_src-3279b740840cc3aa2ce1107b2d300d3d5d92e945.tar.bz2 |
mus: remove mojo/cc
mus is the only consumer of mojo/cc.
1. Moved DirectOutputSurface to components/mus/surfaces.
2. Deleted surfaces_output_surface.*
3. Moved ContextProviderMojo and OutputSurfaceMojo to components/mus/public/cpp and dropped the mojo in the name.
4. Updated all include guards and namespaces appropriately.
5. Deleted mojo/cc.
BUG=none
Review URL: https://codereview.chromium.org/1374743004
Cr-Commit-Position: refs/heads/master@{#351487}
23 files changed, 137 insertions, 245 deletions
diff --git a/components/html_viewer/BUILD.gn b/components/html_viewer/BUILD.gn index 3c6fb1b..e66c2d8 100644 --- a/components/html_viewer/BUILD.gn +++ b/components/html_viewer/BUILD.gn @@ -164,7 +164,6 @@ source_set("lib") { "//media/mojo", "//mojo/application/public/cpp", "//mojo/application/public/interfaces", - "//mojo/cc", "//mojo/common", "//mojo/converters/surfaces", "//mojo/gles2:headers", diff --git a/components/html_viewer/web_graphics_context_3d_command_buffer_impl.cc b/components/html_viewer/web_graphics_context_3d_command_buffer_impl.cc index 7b01690..f9e4c5b 100644 --- a/components/html_viewer/web_graphics_context_3d_command_buffer_impl.cc +++ b/components/html_viewer/web_graphics_context_3d_command_buffer_impl.cc @@ -6,10 +6,10 @@ #include "components/html_viewer/blink_basic_type_converters.h" #include "components/html_viewer/global_state.h" +#include "components/mus/public/cpp/context_provider.h" #include "components/mus/public/interfaces/gpu.mojom.h" #include "gpu/command_buffer/common/gles2_cmd_utils.h" #include "mojo/application/public/cpp/application_impl.h" -#include "mojo/cc/context_provider_mojo.h" #include "mojo/gles2/gles2_context.h" #include "mojo/gpu/mojo_gles2_impl_autogen.h" #include "third_party/mojo/src/mojo/public/cpp/environment/environment.h" diff --git a/components/html_viewer/web_layer_tree_view_impl.cc b/components/html_viewer/web_layer_tree_view_impl.cc index b4f1cc4..2ee1c75 100644 --- a/components/html_viewer/web_layer_tree_view_impl.cc +++ b/components/html_viewer/web_layer_tree_view_impl.cc @@ -10,9 +10,9 @@ #include "cc/output/begin_frame_args.h" #include "cc/scheduler/begin_frame_source.h" #include "cc/trees/layer_tree_host.h" +#include "components/mus/public/cpp/context_provider.h" +#include "components/mus/public/cpp/output_surface.h" #include "components/mus/public/cpp/view.h" -#include "mojo/cc/context_provider_mojo.h" -#include "mojo/cc/output_surface_mojo.h" #include "mojo/converters/surfaces/surfaces_type_converters.h" #include "third_party/WebKit/public/web/WebWidget.h" #include "ui/gfx/buffer_types.h" @@ -66,9 +66,9 @@ void WebLayerTreeViewImpl::Initialize(mojo::GpuPtr gpu_service, mojo::CommandBufferPtr cb; gpu_service->CreateOffscreenGLES2Context(GetProxy(&cb)); scoped_refptr<cc::ContextProvider> context_provider( - new mojo::ContextProviderMojo(cb.PassInterface().PassHandle())); + new mus::ContextProvider(cb.PassInterface().PassHandle())); output_surface_.reset( - new mojo::OutputSurfaceMojo(context_provider, view_->RequestSurface())); + new mus::OutputSurface(context_provider, view_->RequestSurface())); } layer_tree_host_->SetLayerTreeHostClientReady(); } diff --git a/components/html_viewer/web_layer_tree_view_impl.h b/components/html_viewer/web_layer_tree_view_impl.h index 3a48bc3..ed16fab 100644 --- a/components/html_viewer/web_layer_tree_view_impl.h +++ b/components/html_viewer/web_layer_tree_view_impl.h @@ -11,8 +11,8 @@ #include "base/memory/weak_ptr.h" #include "base/single_thread_task_runner.h" #include "cc/trees/layer_tree_host_client.h" +#include "components/mus/public/cpp/output_surface.h" #include "components/mus/public/interfaces/gpu.mojom.h" -#include "mojo/cc/output_surface_mojo.h" #include "third_party/WebKit/public/platform/WebLayerTreeView.h" namespace base { diff --git a/components/mus/BUILD.gn b/components/mus/BUILD.gn index 04e7179..3570b02 100644 --- a/components/mus/BUILD.gn +++ b/components/mus/BUILD.gn @@ -82,10 +82,6 @@ source_set("lib") { "window_manager_access_policy.h", ] - public_deps = [ - "//components/mus/public/cpp", - ] - deps = [ "//base", "//cc", diff --git a/components/mus/public/cpp/BUILD.gn b/components/mus/public/cpp/BUILD.gn index aa2d276..8344828 100644 --- a/components/mus/public/cpp/BUILD.gn +++ b/components/mus/public/cpp/BUILD.gn @@ -7,8 +7,9 @@ import("//third_party/mojo/src/mojo/public/mojo_sdk.gni") mojo_sdk_source_set("cpp") { restrict_external_deps = false sources = [ - "args.h", - "lib/args.cc", + "context_provider.h", + "lib/context_provider.cc", + "lib/output_surface.cc", "lib/scoped_view_ptr.cc", "lib/view.cc", "lib/view_observer.cc", @@ -19,6 +20,7 @@ mojo_sdk_source_set("cpp") { "lib/view_tree_client_impl.h", "lib/view_tree_delegate.cc", "lib/view_tree_host_factory.cc", + "output_surface.h", "scoped_view_ptr.h", "view.h", "view_observer.h", @@ -39,12 +41,19 @@ mojo_sdk_source_set("cpp") { ] deps = [ + "//base", + "//cc", + "//cc/surfaces", + "//cc/surfaces:surface_id", "//mojo/application/public/cpp", "//mojo/application/public/interfaces", "//mojo/converters/surfaces", + "//mojo/gles2:headers", + "//mojo/gpu:mojo_gles2_implementation", + "//third_party/mojo/src/mojo/public/cpp/environment", + "//third_party/mojo/src/mojo/public/cpp/system", "//ui/mojo/events:interfaces", "//ui/mojo/geometry:interfaces", - "//base", ] mojo_sdk_deps = [ @@ -56,8 +65,10 @@ mojo_sdk_source_set("cpp") { source_set("common") { sources = [ + "args.h", "keys.cc", "keys.h", + "lib/args.cc", "types.h", "util.h", ] diff --git a/mojo/cc/context_provider_mojo.h b/components/mus/public/cpp/context_provider.h index cc465d0..12b7735 100644 --- a/mojo/cc/context_provider_mojo.h +++ b/components/mus/public/cpp/context_provider.h @@ -12,11 +12,11 @@ #include "third_party/mojo/src/mojo/public/c/gles2/gles2.h" #include "third_party/mojo/src/mojo/public/cpp/system/core.h" -namespace mojo { +namespace mus { -class ContextProviderMojo : public cc::ContextProvider { +class ContextProvider : public cc::ContextProvider { public: - explicit ContextProviderMojo(ScopedMessagePipeHandle command_buffer_handle); + explicit ContextProvider(mojo::ScopedMessagePipeHandle command_buffer_handle); // cc::ContextProvider implementation. bool BindToCurrentThread() override; @@ -37,25 +37,25 @@ class ContextProviderMojo : public cc::ContextProvider { override {} protected: - friend class base::RefCountedThreadSafe<ContextProviderMojo>; - ~ContextProviderMojo() override; + friend class base::RefCountedThreadSafe<ContextProvider>; + ~ContextProvider() override; private: static void ContextLostThunk(void* closure) { - static_cast<ContextProviderMojo*>(closure)->ContextLost(); + static_cast<ContextProvider*>(closure)->ContextLost(); } void ContextLost(); cc::ContextProvider::Capabilities capabilities_; - ScopedMessagePipeHandle command_buffer_handle_; + mojo::ScopedMessagePipeHandle command_buffer_handle_; MojoGLES2Context context_; scoped_ptr<gpu::gles2::GLES2Interface> context_gl_; base::Lock context_lock_; - DISALLOW_COPY_AND_ASSIGN(ContextProviderMojo); + DISALLOW_COPY_AND_ASSIGN(ContextProvider); }; -} // namespace mojo +} // namespace mus #endif // MOJO_CC_CONTEXT_PROVIDER_MOJO_H_ diff --git a/components/mus/public/cpp/lib/DEPS b/components/mus/public/cpp/lib/DEPS new file mode 100644 index 0000000..5e8f71d --- /dev/null +++ b/components/mus/public/cpp/lib/DEPS @@ -0,0 +1,4 @@ +include_rules = [ + "+mojo/gles2", + "+mojo/gpu" +] diff --git a/components/mus/public/cpp/lib/context_provider.cc b/components/mus/public/cpp/lib/context_provider.cc new file mode 100644 index 0000000..e56557f --- /dev/null +++ b/components/mus/public/cpp/lib/context_provider.cc @@ -0,0 +1,70 @@ +// 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 "components/mus/public/cpp/context_provider.h" + +#include "base/logging.h" +#include "mojo/gles2/gles2_context.h" +#include "mojo/gpu/mojo_gles2_impl_autogen.h" +#include "third_party/mojo/src/mojo/public/cpp/environment/environment.h" + +namespace mus { + +ContextProvider::ContextProvider( + mojo::ScopedMessagePipeHandle command_buffer_handle) + : command_buffer_handle_(command_buffer_handle.Pass()), context_(nullptr) { + // Enabled the CHROMIUM_image extension to use GpuMemoryBuffers. The + // implementation of which is used in CommandBufferDriver. + capabilities_.gpu.image = true; +} + +bool ContextProvider::BindToCurrentThread() { + DCHECK(command_buffer_handle_.is_valid()); + context_ = MojoGLES2CreateContext(command_buffer_handle_.release().value(), + nullptr, &ContextLostThunk, this, + mojo::Environment::GetDefaultAsyncWaiter()); + context_gl_.reset(new mojo::MojoGLES2Impl(context_)); + return !!context_; +} + +gpu::gles2::GLES2Interface* ContextProvider::ContextGL() { + return context_gl_.get(); +} + +gpu::ContextSupport* ContextProvider::ContextSupport() { + if (!context_) + return NULL; + // TODO(rjkroege): Ensure that UIP does not take this code path. + return static_cast<gles2::GLES2Context*>(context_)->context_support(); +} + +class GrContext* ContextProvider::GrContext() { + return NULL; +} + +void ContextProvider::InvalidateGrContext(uint32_t state) {} + +cc::ContextProvider::Capabilities ContextProvider::ContextCapabilities() { + return capabilities_; +} + +void ContextProvider::SetupLock() {} + +base::Lock* ContextProvider::GetLock() { + return &context_lock_; +} + +bool ContextProvider::DestroyedOnMainThread() { + return !context_; +} + +ContextProvider::~ContextProvider() { + context_gl_.reset(); + if (context_) + MojoGLES2DestroyContext(context_); +} + +void ContextProvider::ContextLost() {} + +} // namespace mus diff --git a/mojo/cc/output_surface_mojo.cc b/components/mus/public/cpp/lib/output_surface.cc index f06835f..77b2422 100644 --- a/mojo/cc/output_surface_mojo.cc +++ b/components/mus/public/cpp/lib/output_surface.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "mojo/cc/output_surface_mojo.h" +#include "components/mus/public/cpp/output_surface.h" #include "base/bind.h" #include "cc/output/compositor_frame.h" @@ -11,9 +11,9 @@ #include "components/mus/public/cpp/view_surface.h" #include "mojo/converters/surfaces/surfaces_type_converters.h" -namespace mojo { +namespace mus { -OutputSurfaceMojo::OutputSurfaceMojo( +OutputSurface::OutputSurface( const scoped_refptr<cc::ContextProvider>& context_provider, scoped_ptr<mus::ViewSurface> surface) : cc::OutputSurface(context_provider), surface_(surface.Pass()) { @@ -21,33 +21,31 @@ OutputSurfaceMojo::OutputSurfaceMojo( capabilities_.max_frames_pending = 1; } -OutputSurfaceMojo::~OutputSurfaceMojo() { -} +OutputSurface::~OutputSurface() {} -bool OutputSurfaceMojo::BindToClient(cc::OutputSurfaceClient* client) { +bool OutputSurface::BindToClient(cc::OutputSurfaceClient* client) { surface_->BindToThread(); surface_->set_client(this); return cc::OutputSurface::BindToClient(client); } -void OutputSurfaceMojo::DetachFromClient() { +void OutputSurface::DetachFromClient() { surface_.reset(); cc::OutputSurface::DetachFromClient(); } -void OutputSurfaceMojo::SwapBuffers(cc::CompositorFrame* frame) { +void OutputSurface::SwapBuffers(cc::CompositorFrame* frame) { // TODO(fsamuel, rjkroege): We should probably throttle compositor frames. client_->DidSwapBuffers(); - // OutputSurfaceMojo owns ViewSurface, and so if OutputSurfaceMojo is + // OutputSurface owns ViewSurface, and so if OutputSurface is // destroyed then SubmitCompositorFrame's callback will never get called. // Thus, base::Unretained is safe here. surface_->SubmitCompositorFrame( mojo::CompositorFrame::From(*frame), - base::Bind(&OutputSurfaceMojo::SwapBuffersComplete, - base::Unretained(this))); + base::Bind(&OutputSurface::SwapBuffersComplete, base::Unretained(this))); } -void OutputSurfaceMojo::OnResourcesReturned( +void OutputSurface::OnResourcesReturned( mus::ViewSurface* surface, mojo::Array<mojo::ReturnedResourcePtr> resources) { cc::CompositorFrameAck cfa; @@ -55,8 +53,8 @@ void OutputSurfaceMojo::OnResourcesReturned( ReclaimResources(&cfa); } -void OutputSurfaceMojo::SwapBuffersComplete() { +void OutputSurface::SwapBuffersComplete() { client_->DidSwapBuffersComplete(); } -} // namespace mojo +} // namespace mus diff --git a/mojo/cc/output_surface_mojo.h b/components/mus/public/cpp/output_surface.h index 3e37455..7faa8fe 100644 --- a/mojo/cc/output_surface_mojo.h +++ b/components/mus/public/cpp/output_surface.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef MOJO_CC_OUTPUT_SURFACE_MOJO_H_ -#define MOJO_CC_OUTPUT_SURFACE_MOJO_H_ +#ifndef COMPONENTS_MUS_PUBLIC_CPP_OUTPUT_SURFACE_H_ +#define COMPONENTS_MUS_PUBLIC_CPP_OUTPUT_SURFACE_H_ #include "base/macros.h" #include "cc/output/output_surface.h" @@ -12,14 +12,13 @@ #include "components/mus/public/cpp/view_surface_client.h" #include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h" -namespace mojo { +namespace mus { -class OutputSurfaceMojo : public cc::OutputSurface, - public mus::ViewSurfaceClient { +class OutputSurface : public cc::OutputSurface, public ViewSurfaceClient { public: - OutputSurfaceMojo(const scoped_refptr<cc::ContextProvider>& context_provider, - scoped_ptr<mus::ViewSurface> surface); - ~OutputSurfaceMojo() override; + OutputSurface(const scoped_refptr<cc::ContextProvider>& context_provider, + scoped_ptr<ViewSurface> surface); + ~OutputSurface() override; // cc::OutputSurface implementation. void SwapBuffers(cc::CompositorFrame* frame) override; @@ -29,15 +28,15 @@ class OutputSurfaceMojo : public cc::OutputSurface, private: // ViewSurfaceClient implementation: void OnResourcesReturned( - mus::ViewSurface* surface, + ViewSurface* surface, mojo::Array<mojo::ReturnedResourcePtr> resources) override; void SwapBuffersComplete(); - scoped_ptr<mus::ViewSurface> surface_; + scoped_ptr<ViewSurface> surface_; - DISALLOW_COPY_AND_ASSIGN(OutputSurfaceMojo); + DISALLOW_COPY_AND_ASSIGN(OutputSurface); }; } -#endif // MOJO_CC_OUTPUT_SURFACE_MOJO_H_ +#endif // COMPONENTS_MUS_PUBLIC_CPP_OUTPUT_SURFACE_H_ diff --git a/components/mus/surfaces/BUILD.gn b/components/mus/surfaces/BUILD.gn index 18326b0..7686eae 100644 --- a/components/mus/surfaces/BUILD.gn +++ b/components/mus/surfaces/BUILD.gn @@ -4,11 +4,11 @@ source_set("surfaces") { sources = [ + "direct_output_surface.cc", + "direct_output_surface.h", "surfaces_context_provider.cc", "surfaces_context_provider.h", "surfaces_context_provider_delegate.h", - "surfaces_output_surface.cc", - "surfaces_output_surface.h", "surfaces_scheduler.cc", "surfaces_scheduler.h", "surfaces_state.cc", diff --git a/components/mus/surfaces/surfaces_output_surface.cc b/components/mus/surfaces/direct_output_surface.cc index 46ccdb6..048e5a7 100644 --- a/components/mus/surfaces/surfaces_output_surface.cc +++ b/components/mus/surfaces/direct_output_surface.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "components/mus/surfaces/surfaces_output_surface.h" +#include "components/mus/surfaces/direct_output_surface.h" #include "base/bind.h" #include "cc/output/compositor_frame.h" diff --git a/components/mus/surfaces/surfaces_output_surface.h b/components/mus/surfaces/direct_output_surface.h index 3bd62df..f4be727 100644 --- a/components/mus/surfaces/surfaces_output_surface.h +++ b/components/mus/surfaces/direct_output_surface.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_MUS_SURFACES_SURFACES_OUTPUT_SURFACE_H_ -#define COMPONENTS_MUS_SURFACES_SURFACES_OUTPUT_SURFACE_H_ +#ifndef COMPONENTS_MUS_SURFACES_DIRECT_OUTPUT_SURFACE_H_ +#define COMPONENTS_MUS_SURFACES_DIRECT_OUTPUT_SURFACE_H_ #include "cc/output/output_surface.h" @@ -26,4 +26,4 @@ class DirectOutputSurface : public cc::OutputSurface { } // namespace mus -#endif // COMPONENTS_MUS_SURFACES_SURFACES_OUTPUT_SURFACE_H_
\ No newline at end of file +#endif // COMPONENTS_MUS_SURFACES_DIRECT_OUTPUT_SURFACE_H_ diff --git a/components/mus/surfaces/top_level_display_client.cc b/components/mus/surfaces/top_level_display_client.cc index abde9ef..aba70d0 100644 --- a/components/mus/surfaces/top_level_display_client.cc +++ b/components/mus/surfaces/top_level_display_client.cc @@ -8,8 +8,8 @@ #include "cc/surfaces/display.h" #include "cc/surfaces/surface.h" #include "components/mus/gles2/gpu_state.h" +#include "components/mus/surfaces/direct_output_surface.h" #include "components/mus/surfaces/surfaces_context_provider.h" -#include "components/mus/surfaces/surfaces_output_surface.h" #include "components/mus/surfaces/surfaces_scheduler.h" #include "components/mus/surfaces/surfaces_state.h" diff --git a/mandoline/ui/aura/BUILD.gn b/mandoline/ui/aura/BUILD.gn index 831f176..873539fb 100644 --- a/mandoline/ui/aura/BUILD.gn +++ b/mandoline/ui/aura/BUILD.gn @@ -36,7 +36,6 @@ source_set("aura") { "//skia", "//mojo/application/public/cpp", "//mojo/application/public/interfaces", - "//mojo/cc", "//mojo/converters/geometry", "//mojo/converters/ime", "//mojo/converters/input_events", diff --git a/mandoline/ui/aura/surface_binding.cc b/mandoline/ui/aura/surface_binding.cc index 8048373..321defd 100644 --- a/mandoline/ui/aura/surface_binding.cc +++ b/mandoline/ui/aura/surface_binding.cc @@ -14,14 +14,14 @@ #include "cc/output/output_surface_client.h" #include "cc/output/software_output_device.h" #include "cc/resources/shared_bitmap_manager.h" +#include "components/mus/public/cpp/context_provider.h" +#include "components/mus/public/cpp/output_surface.h" #include "components/mus/public/cpp/view.h" #include "components/mus/public/cpp/view_tree_connection.h" #include "components/mus/public/interfaces/gpu.mojom.h" #include "mandoline/ui/aura/window_tree_host_mojo.h" #include "mojo/application/public/cpp/connect.h" #include "mojo/application/public/interfaces/shell.mojom.h" -#include "mojo/cc/context_provider_mojo.h" -#include "mojo/cc/output_surface_mojo.h" #include "mojo/converters/geometry/geometry_type_converters.h" #include "mojo/converters/surfaces/surfaces_type_converters.h" #include "mojo/public/cpp/bindings/binding.h" @@ -98,9 +98,9 @@ SurfaceBinding::PerConnectionState::CreateOutputSurface(mus::View* view) { gpu_->CreateOffscreenGLES2Context(GetProxy(&cb)); scoped_refptr<cc::ContextProvider> context_provider( - new mojo::ContextProviderMojo(cb.PassInterface().PassHandle())); + new mus::ContextProvider(cb.PassInterface().PassHandle())); return make_scoped_ptr( - new mojo::OutputSurfaceMojo(context_provider, view->RequestSurface())); + new mus::OutputSurface(context_provider, view->RequestSurface())); } SurfaceBinding::PerConnectionState::PerConnectionState( diff --git a/mojo/cc/BUILD.gn b/mojo/cc/BUILD.gn deleted file mode 100644 index c903ce0..0000000 --- a/mojo/cc/BUILD.gn +++ /dev/null @@ -1,33 +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. - -# GYP version: mojo/mojo.gyp:mojo_cc_support -source_set("cc") { - deps = [ - "//base", - "//cc", - "//cc/surfaces", - "//cc/surfaces:surface_id", - "//components/mus/public/interfaces", - "//components/mus/public/cpp", - "//gpu/command_buffer/client:gles2_implementation", - "//gpu/command_buffer/client:gles2_interface", - "//mojo/converters/surfaces", - "//mojo/gles2:headers", - "//mojo/gpu:mojo_gles2_implementation", - "//skia", - "//third_party/mojo/src/mojo/public/c/gles2", - "//third_party/mojo/src/mojo/public/cpp/environment", - "//third_party/mojo/src/mojo/public/cpp/system", - ] - - sources = [ - "context_provider_mojo.cc", - "context_provider_mojo.h", - "direct_output_surface.cc", - "direct_output_surface.h", - "output_surface_mojo.cc", - "output_surface_mojo.h", - ] -} diff --git a/mojo/cc/DEPS b/mojo/cc/DEPS deleted file mode 100644 index 9218a8b..0000000 --- a/mojo/cc/DEPS +++ /dev/null @@ -1,7 +0,0 @@ -include_rules = [ - "+cc", - "-cc/blink", - "+components/mus/public/cpp", - "+gpu/command_buffer/client", - "+mojo/gpu", -] diff --git a/mojo/cc/OWNERS b/mojo/cc/OWNERS deleted file mode 100644 index c92691f..0000000 --- a/mojo/cc/OWNERS +++ /dev/null @@ -1 +0,0 @@ -fsamuel@chromium.org diff --git a/mojo/cc/context_provider_mojo.cc b/mojo/cc/context_provider_mojo.cc deleted file mode 100644 index ed8643d..0000000 --- a/mojo/cc/context_provider_mojo.cc +++ /dev/null @@ -1,72 +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/cc/context_provider_mojo.h" - -#include "base/logging.h" -#include "mojo/gles2/gles2_context.h" -#include "mojo/gpu/mojo_gles2_impl_autogen.h" -#include "third_party/mojo/src/mojo/public/cpp/environment/environment.h" - -namespace mojo { - -ContextProviderMojo::ContextProviderMojo( - ScopedMessagePipeHandle command_buffer_handle) - : command_buffer_handle_(command_buffer_handle.Pass()), - context_(nullptr) { - // Enabled the CHROMIUM_image extension to use GpuMemoryBuffers. The - // implementation of which is used in CommandBufferDriver. - capabilities_.gpu.image = true; -} - -bool ContextProviderMojo::BindToCurrentThread() { - DCHECK(command_buffer_handle_.is_valid()); - context_ = MojoGLES2CreateContext(command_buffer_handle_.release().value(), - nullptr, - &ContextLostThunk, - this, - Environment::GetDefaultAsyncWaiter()); - context_gl_.reset(new MojoGLES2Impl(context_)); - return !!context_; -} - -gpu::gles2::GLES2Interface* ContextProviderMojo::ContextGL() { - return context_gl_.get(); -} - -gpu::ContextSupport* ContextProviderMojo::ContextSupport() { - if (!context_) - return NULL; - // TODO(rjkroege): Ensure that UIP does not take this code path. - return static_cast<gles2::GLES2Context*>(context_)->context_support(); -} - -class GrContext* ContextProviderMojo::GrContext() { return NULL; } - -void ContextProviderMojo::InvalidateGrContext(uint32_t state) { -} - -cc::ContextProvider::Capabilities ContextProviderMojo::ContextCapabilities() { - return capabilities_; -} - -void ContextProviderMojo::SetupLock() { -} - -base::Lock* ContextProviderMojo::GetLock() { - return &context_lock_; -} - -bool ContextProviderMojo::DestroyedOnMainThread() { return !context_; } - -ContextProviderMojo::~ContextProviderMojo() { - context_gl_.reset(); - if (context_) - MojoGLES2DestroyContext(context_); -} - -void ContextProviderMojo::ContextLost() { -} - -} // namespace mojo diff --git a/mojo/cc/direct_output_surface.cc b/mojo/cc/direct_output_surface.cc deleted file mode 100644 index 0899c4e..0000000 --- a/mojo/cc/direct_output_surface.cc +++ /dev/null @@ -1,42 +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/cc/direct_output_surface.h" - -#include "base/bind.h" -#include "cc/output/compositor_frame.h" -#include "cc/output/context_provider.h" -#include "cc/output/output_surface_client.h" -#include "gpu/command_buffer/client/context_support.h" -#include "gpu/command_buffer/client/gles2_interface.h" - -namespace mojo { - -DirectOutputSurface::DirectOutputSurface( - const scoped_refptr<cc::ContextProvider>& context_provider) - : cc::OutputSurface(context_provider), weak_ptr_factory_(this) { -} - -DirectOutputSurface::~DirectOutputSurface() {} - -void DirectOutputSurface::SwapBuffers(cc::CompositorFrame* frame) { - DCHECK(context_provider_.get()); - DCHECK(frame->gl_frame_data); - if (frame->gl_frame_data->sub_buffer_rect == - gfx::Rect(frame->gl_frame_data->size)) { - context_provider_->ContextSupport()->Swap(); - } else { - context_provider_->ContextSupport()->PartialSwapBuffers( - frame->gl_frame_data->sub_buffer_rect); - } - uint32_t sync_point = - context_provider_->ContextGL()->InsertSyncPointCHROMIUM(); - context_provider_->ContextSupport()->SignalSyncPoint( - sync_point, - base::Bind(&OutputSurface::OnSwapBuffersComplete, - weak_ptr_factory_.GetWeakPtr())); - client_->DidSwapBuffers(); -} - -} // namespace mojo diff --git a/mojo/cc/direct_output_surface.h b/mojo/cc/direct_output_surface.h deleted file mode 100644 index fa997b0..0000000 --- a/mojo/cc/direct_output_surface.h +++ /dev/null @@ -1,29 +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. - -#ifndef MOJO_CC_DIRECT_OUTPUT_SURFACE_H_ -#define MOJO_CC_DIRECT_OUTPUT_SURFACE_H_ - -#include "cc/output/output_surface.h" - -namespace mojo { - -// An OutputSurface implementation that directly draws and -// swaps to an actual GL surface. -class DirectOutputSurface : public cc::OutputSurface { - public: - explicit DirectOutputSurface( - const scoped_refptr<cc::ContextProvider>& context_provider); - ~DirectOutputSurface() override; - - // cc::OutputSurface implementation - void SwapBuffers(cc::CompositorFrame* frame) override; - -private: - base::WeakPtrFactory<DirectOutputSurface> weak_ptr_factory_; -}; - -} // namespace mojo - -#endif // MOJO_CC_DIRECT_OUTPUT_SURFACE_H_ |