summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormoshayedi <moshayedi@chromium.org>2016-02-09 13:17:50 -0800
committerCommit bot <commit-bot@chromium.org>2016-02-09 21:19:02 +0000
commit33e36ef54fb34b0e5e8b377357b3dc3a4c2c4602 (patch)
treeb34023770eca5513cebea6cff1658bf68b82975b
parent8fdacca24dda7845954645fc9fba18fb3270af7d (diff)
downloadchromium_src-33e36ef54fb34b0e5e8b377357b3dc3a4c2c4602.zip
chromium_src-33e36ef54fb34b0e5e8b377357b3dc3a4c2c4602.tar.gz
chromium_src-33e36ef54fb34b0e5e8b377357b3dc3a4c2c4602.tar.bz2
mus: Add snapshot mechanism to DisplayManager.
This adds RequestCopyOfOutput() to DisplayManager. We will need this to provide a mojo snapshot API. DisplayManager forwards the request to TopLevelDisplayClient, which submits the request using SurfaceFactory::RequestCopyOfSurface(). BUG=557397 Review URL: https://codereview.chromium.org/1677073004 Cr-Commit-Position: refs/heads/master@{#374469}
-rw-r--r--components/mus/surfaces/top_level_display_client.cc6
-rw-r--r--components/mus/surfaces/top_level_display_client.h4
-rw-r--r--components/mus/ws/BUILD.gn1
-rw-r--r--components/mus/ws/display_manager.cc7
-rw-r--r--components/mus/ws/display_manager.h7
-rw-r--r--components/mus/ws/window_tree_unittest.cc3
6 files changed, 28 insertions, 0 deletions
diff --git a/components/mus/surfaces/top_level_display_client.cc b/components/mus/surfaces/top_level_display_client.cc
index 106d3b1..fc0568a 100644
--- a/components/mus/surfaces/top_level_display_client.cc
+++ b/components/mus/surfaces/top_level_display_client.cc
@@ -6,6 +6,7 @@
#include "base/thread_task_runner_handle.h"
#include "cc/output/compositor_frame.h"
+#include "cc/output/copy_output_request.h"
#include "cc/scheduler/begin_frame_source.h"
#include "cc/surfaces/display.h"
#include "cc/surfaces/display_scheduler.h"
@@ -81,6 +82,11 @@ void TopLevelDisplayClient::SubmitCompositorFrame(
base::Bind(&CallCallback, callback));
}
+void TopLevelDisplayClient::RequestCopyOfOutput(
+ scoped_ptr<cc::CopyOutputRequest> output_request) {
+ factory_.RequestCopyOfSurface(cc_id_, std::move(output_request));
+}
+
void TopLevelDisplayClient::CommitVSyncParameters(base::TimeTicks timebase,
base::TimeDelta interval) {}
diff --git a/components/mus/surfaces/top_level_display_client.h b/components/mus/surfaces/top_level_display_client.h
index c33eba4..ce3e39a 100644
--- a/components/mus/surfaces/top_level_display_client.h
+++ b/components/mus/surfaces/top_level_display_client.h
@@ -13,6 +13,7 @@
#include "cc/surfaces/surface_factory.h"
#include "cc/surfaces/surface_factory_client.h"
#include "components/mus/gles2/gpu_state.h"
+#include "components/mus/public/interfaces/window_manager.mojom.h"
#include "components/mus/surfaces/surfaces_context_provider.h"
#include "components/mus/surfaces/surfaces_context_provider_delegate.h"
#include "components/mus/surfaces/surfaces_state.h"
@@ -20,6 +21,7 @@
#include "ui/gfx/native_widget_types.h"
namespace cc {
+class CopyOutputResult;
class Display;
class DisplayScheduler;
class SurfaceFactory;
@@ -47,6 +49,8 @@ class TopLevelDisplayClient : public cc::DisplayClient,
const base::Closure& callback);
const cc::SurfaceId& surface_id() const { return cc_id_; }
+ void RequestCopyOfOutput(scoped_ptr<cc::CopyOutputRequest> output_request);
+
private:
// DisplayClient implementation.
// TODO(rjkroege, fsamuel): This won't work correctly with multiple displays.
diff --git a/components/mus/ws/BUILD.gn b/components/mus/ws/BUILD.gn
index ad3cd8b..2c7a358 100644
--- a/components/mus/ws/BUILD.gn
+++ b/components/mus/ws/BUILD.gn
@@ -143,6 +143,7 @@ test("window_manager_unittests") {
":test_support",
"//base",
"//base/test:test_config",
+ "//cc:cc",
"//components/mus/common",
"//components/mus/public/cpp",
"//components/mus/public/interfaces",
diff --git a/components/mus/ws/display_manager.cc b/components/mus/ws/display_manager.cc
index 8968293..9c1df75 100644
--- a/components/mus/ws/display_manager.cc
+++ b/components/mus/ws/display_manager.cc
@@ -7,6 +7,7 @@
#include "base/numerics/safe_conversions.h"
#include "build/build_config.h"
#include "cc/output/compositor_frame.h"
+#include "cc/output/copy_output_request.h"
#include "cc/output/delegated_frame_data.h"
#include "cc/quads/render_pass.h"
#include "cc/quads/shared_quad_state.h"
@@ -421,6 +422,12 @@ void DefaultDisplayManager::OnAcceleratedWidgetDestroyed() {
void DefaultDisplayManager::OnActivationChanged(bool active) {}
+void DefaultDisplayManager::RequestCopyOfOutput(
+ scoped_ptr<cc::CopyOutputRequest> output_request) {
+ if (top_level_display_client_)
+ top_level_display_client_->RequestCopyOfOutput(std::move(output_request));
+}
+
} // namespace ws
} // namespace mus
diff --git a/components/mus/ws/display_manager.h b/components/mus/ws/display_manager.h
index cd23a03..de4f628 100644
--- a/components/mus/ws/display_manager.h
+++ b/components/mus/ws/display_manager.h
@@ -15,6 +15,7 @@
#include "base/strings/string16.h"
#include "base/timer/timer.h"
#include "build/build_config.h"
+#include "components/mus/public/interfaces/window_manager.mojom.h"
#include "components/mus/public/interfaces/window_manager_constants.mojom.h"
#include "components/mus/public/interfaces/window_tree.mojom.h"
#include "components/mus/ws/display_manager_delegate.h"
@@ -24,6 +25,7 @@
namespace cc {
class CompositorFrame;
+class CopyOutputRequest;
class SurfaceIdAllocator;
class SurfaceManager;
} // namespace cc
@@ -87,6 +89,9 @@ class DisplayManager {
// Returns true if a compositor frame has been submitted but not drawn yet.
virtual bool IsFramePending() const = 0;
+ virtual void RequestCopyOfOutput(
+ scoped_ptr<cc::CopyOutputRequest> output_request) = 0;
+
// Overrides factory for testing. Default (NULL) value indicates regular
// (non-test) environment.
static void set_factory_for_testing(DisplayManagerFactory* factory) {
@@ -120,6 +125,8 @@ class DefaultDisplayManager : public DisplayManager,
void UpdateTextInputState(const ui::TextInputState& state) override;
void SetImeVisibility(bool visible) override;
bool IsFramePending() const override;
+ void RequestCopyOfOutput(
+ scoped_ptr<cc::CopyOutputRequest> output_request) override;
private:
void WantToDraw();
diff --git a/components/mus/ws/window_tree_unittest.cc b/components/mus/ws/window_tree_unittest.cc
index bf16547..351154d 100644
--- a/components/mus/ws/window_tree_unittest.cc
+++ b/components/mus/ws/window_tree_unittest.cc
@@ -10,6 +10,7 @@
#include "base/macros.h"
#include "base/message_loop/message_loop.h"
#include "base/strings/stringprintf.h"
+#include "cc/output/copy_output_request.h"
#include "components/mus/common/types.h"
#include "components/mus/common/util.h"
#include "components/mus/public/interfaces/window_tree.mojom.h"
@@ -330,6 +331,8 @@ class TestDisplayManager : public DisplayManager {
void UpdateTextInputState(const ui::TextInputState& state) override {}
void SetImeVisibility(bool visible) override {}
bool IsFramePending() const override { return false; }
+ void RequestCopyOfOutput(
+ scoped_ptr<cc::CopyOutputRequest> output_request) override {}
private:
mojom::ViewportMetrics display_metrices_;