summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjbauman <jbauman@chromium.org>2014-08-28 16:34:14 -0700
committerCommit bot <commit-bot@chromium.org>2014-08-28 23:36:29 +0000
commit115bf013f41605a7244e3fa0d505581bdc1aee2d (patch)
tree0fc128ceb6fce188d8736eeaa6c3e68cd9665198
parentfd0069d61b1f3281a2634bf907a96bebee7fb396 (diff)
downloadchromium_src-115bf013f41605a7244e3fa0d505581bdc1aee2d.zip
chromium_src-115bf013f41605a7244e3fa0d505581bdc1aee2d.tar.gz
chromium_src-115bf013f41605a7244e3fa0d505581bdc1aee2d.tar.bz2
Allow requesting a copy of a surface.
Instead of requesting a layer, a copy of the entire surface is requested. Actually handling the request isn't implemented yet. BUG=397730 Review URL: https://codereview.chromium.org/509193002 Cr-Commit-Position: refs/heads/master@{#292498}
-rw-r--r--cc/surfaces/surface.cc6
-rw-r--r--cc/surfaces/surface.h2
-rw-r--r--cc/surfaces/surface_factory.cc13
-rw-r--r--cc/surfaces/surface_factory.h3
-rw-r--r--content/browser/compositor/delegated_frame_host.cc6
5 files changed, 28 insertions, 2 deletions
diff --git a/cc/surfaces/surface.cc b/cc/surfaces/surface.cc
index b3565a5..0e08ec4 100644
--- a/cc/surfaces/surface.cc
+++ b/cc/surfaces/surface.cc
@@ -5,6 +5,7 @@
#include "cc/surfaces/surface.h"
#include "cc/output/compositor_frame.h"
+#include "cc/output/copy_output_request.h"
#include "cc/surfaces/surface_factory.h"
namespace cc {
@@ -50,6 +51,11 @@ void Surface::QueueFrame(scoped_ptr<CompositorFrame> frame,
draw_callback_ = callback;
}
+void Surface::RequestCopyOfOutput(scoped_ptr<CopyOutputRequest> copy_request) {
+ // TODO(jbauman): Make this work.
+ copy_request->SendEmptyResult();
+}
+
const CompositorFrame* Surface::GetEligibleFrame() {
return current_frame_.get();
}
diff --git a/cc/surfaces/surface.h b/cc/surfaces/surface.h
index b12c34f..3d48196 100644
--- a/cc/surfaces/surface.h
+++ b/cc/surfaces/surface.h
@@ -15,6 +15,7 @@
namespace cc {
class CompositorFrame;
+class CopyOutputRequest;
class SurfaceManager;
class SurfaceFactory;
class SurfaceResourceHolder;
@@ -29,6 +30,7 @@ class CC_SURFACES_EXPORT Surface {
void QueueFrame(scoped_ptr<CompositorFrame> frame,
const base::Closure& draw_callback);
+ void RequestCopyOfOutput(scoped_ptr<CopyOutputRequest> copy_request);
// Returns the most recent frame that is eligible to be rendered.
const CompositorFrame* GetEligibleFrame();
diff --git a/cc/surfaces/surface_factory.cc b/cc/surfaces/surface_factory.cc
index 94f98fc..79bbe5e 100644
--- a/cc/surfaces/surface_factory.cc
+++ b/cc/surfaces/surface_factory.cc
@@ -5,6 +5,7 @@
#include "cc/surfaces/surface_factory.h"
#include "cc/output/compositor_frame.h"
+#include "cc/output/copy_output_request.h"
#include "cc/surfaces/surface.h"
#include "cc/surfaces/surface_manager.h"
#include "ui/gfx/geometry/size.h"
@@ -44,6 +45,18 @@ void SurfaceFactory::SubmitFrame(SurfaceId surface_id,
manager_->SurfaceModified(surface_id);
}
+void SurfaceFactory::RequestCopyOfSurface(
+ SurfaceId surface_id,
+ scoped_ptr<CopyOutputRequest> copy_request) {
+ OwningSurfaceMap::iterator it = surface_map_.find(surface_id);
+ if (it == surface_map_.end()) {
+ copy_request->SendEmptyResult();
+ return;
+ }
+ DCHECK(it->second->factory() == this);
+ it->second->RequestCopyOfOutput(copy_request.Pass());
+}
+
void SurfaceFactory::ReceiveFromChild(
const TransferableResourceArray& resources) {
holder_.ReceiveFromChild(resources);
diff --git a/cc/surfaces/surface_factory.h b/cc/surfaces/surface_factory.h
index fafa53c54..0a2ece7 100644
--- a/cc/surfaces/surface_factory.h
+++ b/cc/surfaces/surface_factory.h
@@ -19,6 +19,7 @@ class Size;
namespace cc {
class CompositorFrame;
+class CopyOutputRequest;
class Surface;
class SurfaceFactoryClient;
class SurfaceManager;
@@ -42,6 +43,8 @@ class CC_SURFACES_EXPORT SurfaceFactory
void SubmitFrame(SurfaceId surface_id,
scoped_ptr<CompositorFrame> frame,
const base::Closure& callback);
+ void RequestCopyOfSurface(SurfaceId surface_id,
+ scoped_ptr<CopyOutputRequest> copy_request);
SurfaceFactoryClient* client() { return client_; }
diff --git a/content/browser/compositor/delegated_frame_host.cc b/content/browser/compositor/delegated_frame_host.cc
index 488b138..26a0b29 100644
--- a/content/browser/compositor/delegated_frame_host.cc
+++ b/content/browser/compositor/delegated_frame_host.cc
@@ -131,8 +131,10 @@ bool DelegatedFrameHost::ShouldCreateResizeLock() {
void DelegatedFrameHost::RequestCopyOfOutput(
scoped_ptr<cc::CopyOutputRequest> request) {
if (use_surfaces_) {
- // TODO(jbauman): Make this work with surfaces.
- request->SendEmptyResult();
+ if (surface_factory_ && !surface_id_.is_null())
+ surface_factory_->RequestCopyOfSurface(surface_id_, request.Pass());
+ else
+ request->SendEmptyResult();
} else {
client_->GetLayer()->RequestCopyOfOutput(request.Pass());
}