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

Unified Diff: content/browser/compositor/surface_display_output_surface.cc

Issue 307693005: Add use-surfaces command-line flag (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | « content/browser/compositor/surface_display_output_surface.h ('k') | content/content_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/compositor/surface_display_output_surface.cc
diff --git a/content/browser/compositor/surface_display_output_surface.cc b/content/browser/compositor/surface_display_output_surface.cc
new file mode 100644
index 0000000000000000000000000000000000000000..ed81a005c764d09106e1022774c7eafe6d10a71a
--- /dev/null
+++ b/content/browser/compositor/surface_display_output_surface.cc
@@ -0,0 +1,49 @@
+// 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 "content/browser/compositor/surface_display_output_surface.h"
+
+#include "cc/output/compositor_frame.h"
+#include "cc/surfaces/display.h"
+#include "cc/surfaces/surface.h"
+#include "cc/surfaces/surface_manager.h"
+
+namespace content {
+
+SurfaceDisplayOutputSurface::SurfaceDisplayOutputSurface(
+ cc::Display* display,
+ cc::SurfaceManager* surface_manager,
+ const scoped_refptr<cc::ContextProvider>& context_provider,
+ scoped_ptr<cc::SoftwareOutputDevice> software_device)
+ : cc::OutputSurface(context_provider, software_device.Pass()),
+ display_(display),
+ surface_manager_(surface_manager) {
+ capabilities_.delegated_rendering = true;
+ capabilities_.max_frames_pending = 1;
+}
+
+SurfaceDisplayOutputSurface::~SurfaceDisplayOutputSurface() {
+}
+
+void SurfaceDisplayOutputSurface::SwapBuffers(cc::CompositorFrame* frame) {
+ gfx::Size frame_size =
+ frame->delegated_frame_data->render_pass_list.back()->output_rect.size();
+ display_->Resize(frame_size);
+ int surface_id = display_->CurrentSurfaceID();
+ cc::Surface* surface = surface_manager_->GetSurfaceForID(surface_id);
+ if (!surface)
+ return;
+
+ scoped_ptr<cc::CompositorFrame> frame_copy(new cc::CompositorFrame());
+ frame->AssignTo(frame_copy.get());
+ surface->QueueFrame(frame_copy.Pass());
+
+ if (!display_->Draw())
+ return;
+
+ client_->DidSwapBuffers();
+ client_->DidSwapBuffersComplete();
+}
+
+} // namespace content
« no previous file with comments | « content/browser/compositor/surface_display_output_surface.h ('k') | content/content_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698