Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_SOFTWARE_FRAMEBUFFER_H | |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_SOFTWARE_FRAMEBUFFER_H | |
| 7 | |
| 8 #include <vector> | |
| 9 | |
| 10 #include "base/memory/ref_counted.h" | |
| 11 #include "base/memory/weak_ptr.h" | |
| 12 #include "cc/output/software_frame_data.h" | |
| 13 #include "cc/resources/single_release_callback.h" | |
| 14 #include "cc/resources/texture_mailbox.h" | |
| 15 #include "content/browser/renderer_host/frame_memory_manager.h" | |
| 16 #include "content/browser/renderer_host/render_widget_host_impl.h" | |
| 17 | |
| 18 namespace content { | |
| 19 | |
| 20 class MemoryHolder; | |
| 21 | |
| 22 class SoftwareFramebufferClient { | |
| 23 public: | |
| 24 virtual void CurrentSoftwareFrameWasDiscarded() = 0; | |
| 25 }; | |
| 26 | |
| 27 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
| |
| 28 : 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
| |
| 29 public FrameContainer { | |
| 30 public: | |
| 31 SoftwareFramebuffer(SoftwareFramebufferClient* client, | |
| 32 RenderWidgetHostImpl* render_widget_host_impl); | |
| 33 virtual ~SoftwareFramebuffer(); | |
| 34 void WasShown(); | |
| 35 void WasHidden(); | |
| 36 | |
| 37 // Note that it is possible that the new frame will be evicted immediately | |
| 38 // after being swapped in, so HasCurrentFrame must be checked before using | |
| 39 // the result. | |
| 40 void SwapToNewFrame(uint32 output_surface_id, | |
| 41 const cc::SoftwareFrameData* frame_data, | |
| 42 float frame_scale_factor); | |
| 43 bool HasCurrentFrame() const { return framebuffer_holder_.get(); } | |
| 44 void DiscardCurrentFrame(); | |
| 45 | |
| 46 void GetCurrentFrameMailbox( | |
| 47 cc::TextureMailbox* mailbox, | |
| 48 scoped_ptr<cc::SingleReleaseCallback>* release_callback) const; | |
| 49 gfx::Size GetCurrentFrameSizeInPixels() const; | |
| 50 gfx::Size GetCurrentFrameSizeInDIP() const; | |
| 51 const void* GetCurrentFramePixels() const; | |
| 52 | |
|
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...
| |
| 53 void SendSoftwareFrameAck(uint32 output_surface_id); | |
| 54 void ReleaseSoftwareFrame( | |
| 55 uint32 output_surface_id, | |
| 56 unsigned software_frame_id); | |
| 57 void SendReclaimSoftwareFrames(); | |
| 58 | |
| 59 // FrameContainer implementation: | |
| 60 virtual void ReleaseCurrentFrame() OVERRIDE; | |
| 61 | |
| 62 private: | |
| 63 SoftwareFramebufferClient* client_; | |
| 64 RenderWidgetHostImpl* render_widget_host_impl_; | |
| 65 | |
| 66 // This holds the current software framebuffer. | |
| 67 scoped_refptr<MemoryHolder> framebuffer_holder_; | |
| 68 | |
| 69 struct ReleasedFrameInfo { | |
| 70 ReleasedFrameInfo(uint32 output_id, unsigned software_frame_id) | |
| 71 : output_surface_id(output_id), frame_id(software_frame_id) {} | |
| 72 uint32 output_surface_id; | |
| 73 unsigned frame_id; | |
| 74 }; | |
| 75 std::vector<ReleasedFrameInfo> released_software_frames_; | |
| 76 | |
| 77 DISALLOW_COPY_AND_ASSIGN(SoftwareFramebuffer); | |
| 78 }; | |
| 79 | |
| 80 } | |
| 81 | |
| 82 #endif | |
| OLD | NEW |