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

Unified Diff: mojo/examples/compositor_app/compositor_host.cc

Issue 640023004: cc: Make OutputSurface::SwapBuffers pure virtual (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@latinfo
Patch Set: rebase, comment, removed unused includes Created 6 years, 2 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
« no previous file with comments | « mojo/examples/compositor_app/compositor_host.h ('k') | mojo/mojo.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/examples/compositor_app/compositor_host.cc
diff --git a/mojo/examples/compositor_app/compositor_host.cc b/mojo/examples/compositor_app/compositor_host.cc
deleted file mode 100644
index 0cd6fb9f119b61356925298ab691c853bd4a2d79..0000000000000000000000000000000000000000
--- a/mojo/examples/compositor_app/compositor_host.cc
+++ /dev/null
@@ -1,97 +0,0 @@
-// Copyright 2013 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/compositor_host.h"
-
-#include "cc/layers/layer.h"
-#include "cc/layers/solid_color_layer.h"
-#include "cc/output/begin_frame_args.h"
-#include "cc/output/context_provider.h"
-#include "cc/output/output_surface.h"
-#include "cc/trees/layer_tree_host.h"
-#include "mojo/cc/context_provider_mojo.h"
-
-namespace mojo {
-namespace examples {
-
-CompositorHost::CompositorHost(ScopedMessagePipeHandle command_buffer_handle)
- : command_buffer_handle_(command_buffer_handle.Pass()),
- compositor_thread_("compositor") {
- DCHECK(command_buffer_handle_.is_valid());
- bool started = compositor_thread_.Start();
- DCHECK(started);
-
- cc::LayerTreeSettings settings;
- tree_ = cc::LayerTreeHost::CreateThreaded(
- this,
- NULL,
- settings,
- base::MessageLoopProxy::current(),
- compositor_thread_.message_loop_proxy());
- SetupScene();
-}
-
-CompositorHost::~CompositorHost() {}
-
-void CompositorHost::SetSize(const gfx::Size& viewport_size) {
- tree_->SetViewportSize(viewport_size);
- tree_->SetLayerTreeHostClientReady();
-}
-
-void CompositorHost::SetupScene() {
- scoped_refptr<cc::Layer> root_layer = cc::SolidColorLayer::Create();
- root_layer->SetBounds(gfx::Size(500, 500));
- root_layer->SetBackgroundColor(SK_ColorBLUE);
- root_layer->SetIsDrawable(true);
- tree_->SetRootLayer(root_layer);
-
- child_layer_ = cc::SolidColorLayer::Create();
- child_layer_->SetBounds(gfx::Size(100, 100));
- child_layer_->SetBackgroundColor(SK_ColorGREEN);
- child_layer_->SetIsDrawable(true);
- gfx::Transform child_transform;
- child_transform.Translate(200, 200);
- child_layer_->SetTransform(child_transform);
- root_layer->AddChild(child_layer_);
-}
-
-void CompositorHost::WillBeginMainFrame(int frame_id) {}
-void CompositorHost::DidBeginMainFrame() {}
-
-void CompositorHost::BeginMainFrame(const cc::BeginFrameArgs& args) {
- // TODO(jamesr): Should use cc's animation system.
- static const double kDegreesPerSecond = 70.0;
- double time_in_seconds = (args.frame_time - base::TimeTicks()).InSecondsF();
- double child_rotation_degrees = kDegreesPerSecond * time_in_seconds;
- gfx::Transform child_transform;
- child_transform.Translate(200, 200);
- child_transform.Rotate(child_rotation_degrees);
- child_layer_->SetTransform(child_transform);
- tree_->SetNeedsAnimate();
-}
-
-void CompositorHost::Layout() {}
-void CompositorHost::ApplyViewportDeltas(const gfx::Vector2d& inner_delta,
- const gfx::Vector2d& outer_delta,
- float page_scale,
- float top_controls_delta) {}
-void CompositorHost::ApplyViewportDeltas(const gfx::Vector2d& scroll_delta,
- float page_scale,
- float top_controls_delta) {}
-
-void CompositorHost::RequestNewOutputSurface(bool fallback) {
- tree_->SetOutputSurface(make_scoped_ptr(new cc::OutputSurface(
- new ContextProviderMojo(command_buffer_handle_.Pass()))));
-}
-
-void CompositorHost::DidInitializeOutputSurface() {
-}
-
-void CompositorHost::WillCommit() {}
-void CompositorHost::DidCommit() {}
-void CompositorHost::DidCommitAndDrawFrame() {}
-void CompositorHost::DidCompleteSwapBuffers() {}
-
-} // namespace examples
-} // namespace mojo
« no previous file with comments | « mojo/examples/compositor_app/compositor_host.h ('k') | mojo/mojo.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698