#ifndef CONTENT_BROWSER_RENDERER_HOST_SOFTWARE_FRAME_MANAGER_H_
#define CONTENT_BROWSER_RENDERER_HOST_SOFTWARE_FRAME_MANAGER_H_
#include <list>
#include <set>
#include "base/basictypes.h"
#include "base/memory/ref_counted.h"
#include "base/memory/shared_memory.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/renderer_frame_manager.h"
#include "content/common/content_export.h"
#include "ui/gfx/size.h"
namespace content {
class SoftwareFrame;
class CONTENT_EXPORT SoftwareFrameManagerClient {
public:
virtual void SoftwareFrameWasFreed(
uint32 output_surface_id, unsigned frame_id) = 0;
virtual void ReleaseReferencesToSoftwareFrame() = 0;
};
class CONTENT_EXPORT SoftwareFrameManager : public RendererFrameManagerClient {
public:
explicit SoftwareFrameManager(
base::WeakPtr<SoftwareFrameManagerClient> client);
virtual ~SoftwareFrameManager();
bool SwapToNewFrame(
uint32 output_surface_id,
const cc::SoftwareFrameData* frame_data,
float frame_device_scale_factor,
base::ProcessHandle process_handle);
void SwapToNewFrameComplete(bool visible);
void SetVisibility(bool visible);
bool HasCurrentFrame() const;
void DiscardCurrentFrame();
uint32 GetCurrentFrameOutputSurfaceId() const;
void GetCurrentFrameMailbox(
cc::TextureMailbox* mailbox,
scoped_ptr<cc::SingleReleaseCallback>* callback);
void* GetCurrentFramePixels() const;
float GetCurrentFrameDeviceScaleFactor() const;
gfx::Size GetCurrentFrameSizeInPixels() const;
gfx::Size GetCurrentFrameSizeInDIP() const;
private:
virtual void EvictCurrentFrame() OVERRIDE;
base::WeakPtr<SoftwareFrameManagerClient> client_;
scoped_refptr<SoftwareFrame> current_frame_;
DISALLOW_COPY_AND_ASSIGN(SoftwareFrameManager);
};
}
#endif