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

Unified Diff: content/browser/renderer_host/software_framebuffer.h

Issue 25942002: Make software compositing work on Mac. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Touch-ups Created 7 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
Index: content/browser/renderer_host/software_framebuffer.h
diff --git a/content/browser/renderer_host/software_framebuffer.h b/content/browser/renderer_host/software_framebuffer.h
new file mode 100644
index 0000000000000000000000000000000000000000..6a24f60abe2589436c1a250aac57110a66a8ad4f
--- /dev/null
+++ b/content/browser/renderer_host/software_framebuffer.h
@@ -0,0 +1,82 @@
+// Copyright (c) 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.
+
+#ifndef CONTENT_BROWSER_RENDERER_HOST_SOFTWARE_FRAMEBUFFER_H
+#define CONTENT_BROWSER_RENDERER_HOST_SOFTWARE_FRAMEBUFFER_H
+
+#include <vector>
+
+#include "base/memory/ref_counted.h"
+#include "base/memory/weak_ptr.h"
+#include "cc/output/software_frame_data.h"
+#include "cc/resources/single_release_callback.h"
+#include "cc/resources/texture_mailbox.h"
+#include "content/browser/renderer_host/frame_memory_manager.h"
+#include "content/browser/renderer_host/render_widget_host_impl.h"
+
+namespace content {
+
+class MemoryHolder;
+
+class SoftwareFramebufferClient {
+ public:
+ virtual void CurrentSoftwareFrameWasDiscarded() = 0;
+};
+
+class SoftwareFramebuffer
piman 2013/10/08 02:58:38 Naming nitpicking... Just trying to convey the rig
ccameron 2013/10/22 07:15:55 I changed this from MemoryHolder/RWHVAura/FrameMem
+ : public base::SupportsWeakPtr<SoftwareFramebuffer>,
piman 2013/10/08 02:58:38 We try to avoid SupportsWeakPtr if we can, replaci
ccameron 2013/10/22 07:15:55 Changed this to a WeakPtrFactory hanging off of th
+ public FrameContainer {
+ public:
+ SoftwareFramebuffer(SoftwareFramebufferClient* client,
+ RenderWidgetHostImpl* render_widget_host_impl);
+ virtual ~SoftwareFramebuffer();
+ void WasShown();
+ void WasHidden();
+
+ // Note that it is possible that the new frame will be evicted immediately
+ // after being swapped in, so HasCurrentFrame must be checked before using
+ // the result.
+ void SwapToNewFrame(uint32 output_surface_id,
+ const cc::SoftwareFrameData* frame_data,
+ float frame_scale_factor);
+ bool HasCurrentFrame() const { return framebuffer_holder_.get(); }
+ void DiscardCurrentFrame();
+
+ void GetCurrentFrameMailbox(
+ cc::TextureMailbox* mailbox,
+ scoped_ptr<cc::SingleReleaseCallback>* release_callback) const;
+ gfx::Size GetCurrentFrameSizeInPixels() const;
+ gfx::Size GetCurrentFrameSizeInDIP() const;
+ const void* GetCurrentFramePixels() const;
+
ccameron 2013/10/03 21:46:00 This part of the interface seems a bit sloppy. I i
ccameron 2013/10/22 07:15:55 This is gone now...
+ void SendSoftwareFrameAck(uint32 output_surface_id);
+ void ReleaseSoftwareFrame(
+ uint32 output_surface_id,
+ unsigned software_frame_id);
+ void SendReclaimSoftwareFrames();
+
+ // FrameContainer implementation:
+ virtual void ReleaseCurrentFrame() OVERRIDE;
+
+ private:
+ SoftwareFramebufferClient* client_;
+ RenderWidgetHostImpl* render_widget_host_impl_;
+
+ // This holds the current software framebuffer.
+ scoped_refptr<MemoryHolder> framebuffer_holder_;
+
+ struct ReleasedFrameInfo {
+ ReleasedFrameInfo(uint32 output_id, unsigned software_frame_id)
+ : output_surface_id(output_id), frame_id(software_frame_id) {}
+ uint32 output_surface_id;
+ unsigned frame_id;
+ };
+ std::vector<ReleasedFrameInfo> released_software_frames_;
+
+ DISALLOW_COPY_AND_ASSIGN(SoftwareFramebuffer);
+};
+
+}
+
+#endif

Powered by Google App Engine
This is Rietveld 408576698