OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 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_FRAME_MANAGER_H_ | |
6 #define CONTENT_BROWSER_RENDERER_HOST_SOFTWARE_FRAME_MANAGER_H_ | |
7 | |
8 #include "base/basictypes.h" | |
9 #include "base/memory/ref_counted.h" | |
10 #include "base/memory/shared_memory.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 "ui/gfx/size.h" | |
16 | |
17 namespace content { | |
18 class SoftwareFrame; | |
19 class SoftwareFrameMemoryManager; | |
20 | |
21 class SoftwareFrameManagerClient { | |
22 public: | |
23 // Called when the memory for the current software frame was freed. | |
24 virtual void SoftwareFrameWasFreed( | |
25 uint32 output_surface_id, unsigned frame_id) = 0; | |
26 // Called immediately after CurrentSoftwareFrameWasFreed if the frame | |
piman
2013/10/22 22:32:48
nit: "CurrentSoftwareFrameWasFreed" doesn't exist,
ccameron
2013/10/23 01:05:58
Done
piman
2013/10/23 23:41:40
Ok, sorry, I had missed that.
| |
27 // was freed because the FrameMemoryManager requested it be freed. | |
28 virtual void CurrentSoftwareFrameWasEvicted() = 0; | |
29 }; | |
30 | |
31 class SoftwareFrameManager { | |
32 public: | |
33 SoftwareFrameManager(base::WeakPtr<SoftwareFrameManagerClient> client); | |
piman
2013/10/22 22:32:48
nit: explicit
ccameron
2013/10/23 01:05:58
Done.
| |
34 ~SoftwareFrameManager(); | |
35 | |
36 // Swap to a new frame from shared memory. This frame is guaranteed to | |
piman
2013/10/22 22:32:48
nit: Swaps
ccameron
2013/10/23 01:05:58
Done.
| |
37 // not be evicted until SwapToNewFrameComplete is called. | |
38 bool SwapToNewFrame( | |
39 uint32 output_surface_id, | |
40 const cc::SoftwareFrameData* frame_data, | |
41 float frame_device_scale_factor, | |
42 base::ProcessHandle process_handle); | |
43 void SwapToNewFrameComplete(bool visible); | |
44 void SetVisibility(bool visible); | |
45 bool HasCurrentFrame() const; | |
46 void DiscardCurrentFrame(); | |
47 void GetCurrentFrameMailbox( | |
48 cc::TextureMailbox* mailbox, | |
49 scoped_ptr<cc::SingleReleaseCallback>* callback); | |
50 const void* GetCurrentFramePixels() const; | |
51 gfx::Size GetCurrentFrameSizeInPixels() const; | |
52 gfx::Size GetCurrentFrameSizeInDIP() const; | |
53 | |
54 // Called by SoftwareFrameMemoryManager to demand that the current frame | |
55 // be evicted. | |
piman
2013/10/22 22:32:48
nit: maybe make it private and make SoftwareFrameM
ccameron
2013/10/23 01:05:58
Done.
| |
56 void EvictCurrentFrame(); | |
57 | |
58 private: | |
59 base::WeakPtr<SoftwareFrameManagerClient> client_; | |
60 | |
61 // This holds the current software framebuffer. | |
62 scoped_refptr<SoftwareFrame> current_frame_; | |
piman
2013/10/22 22:32:48
nit: DISALLOW_COPY_AND_ASSIGN
ccameron
2013/10/23 01:05:58
Done.
| |
63 }; | |
64 | |
65 } // namespace content | |
66 | |
67 #endif // CONTENT_BROWSER_RENDERER_HOST_SOFTWARE_FRAME_MANAGER_H_ | |
OLD | NEW |