| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CC_RESOURCES_VIDEO_RESOURCE_UPDATER_H_ | 5 #ifndef CC_RESOURCES_VIDEO_RESOURCE_UPDATER_H_ |
| 6 #define CC_RESOURCES_VIDEO_RESOURCE_UPDATER_H_ | 6 #define CC_RESOURCES_VIDEO_RESOURCE_UPDATER_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "cc/base/cc_export.h" | 14 #include "cc/base/cc_export.h" |
| 15 #include "cc/resources/release_callback.h" | 15 #include "cc/resources/release_callback_impl.h" |
| 16 #include "cc/resources/resource_format.h" | 16 #include "cc/resources/resource_format.h" |
| 17 #include "cc/resources/texture_mailbox.h" | 17 #include "cc/resources/texture_mailbox.h" |
| 18 #include "ui/gfx/size.h" | 18 #include "ui/gfx/size.h" |
| 19 | 19 |
| 20 namespace media { | 20 namespace media { |
| 21 class SkCanvasVideoRenderer; | 21 class SkCanvasVideoRenderer; |
| 22 class VideoFrame; | 22 class VideoFrame; |
| 23 } | 23 } |
| 24 | 24 |
| 25 namespace cc { | 25 namespace cc { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 43 HOLE, | 43 HOLE, |
| 44 #endif // defined(VIDEO_HOLE) | 44 #endif // defined(VIDEO_HOLE) |
| 45 | 45 |
| 46 // TODO(danakj): Remove this and abstract TextureMailbox into | 46 // TODO(danakj): Remove this and abstract TextureMailbox into |
| 47 // "ExternalResource" that can hold a hardware or software backing. | 47 // "ExternalResource" that can hold a hardware or software backing. |
| 48 SOFTWARE_RESOURCE | 48 SOFTWARE_RESOURCE |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 ResourceType type; | 51 ResourceType type; |
| 52 std::vector<TextureMailbox> mailboxes; | 52 std::vector<TextureMailbox> mailboxes; |
| 53 std::vector<ReleaseCallback> release_callbacks; | 53 std::vector<ReleaseCallbackImpl> release_callbacks; |
| 54 | 54 |
| 55 // TODO(danakj): Remove these too. | 55 // TODO(danakj): Remove these too. |
| 56 std::vector<unsigned> software_resources; | 56 std::vector<unsigned> software_resources; |
| 57 ReleaseCallback software_release_callback; | 57 ReleaseCallbackImpl software_release_callback; |
| 58 | 58 |
| 59 VideoFrameExternalResources(); | 59 VideoFrameExternalResources(); |
| 60 ~VideoFrameExternalResources(); | 60 ~VideoFrameExternalResources(); |
| 61 }; | 61 }; |
| 62 | 62 |
| 63 // VideoResourceUpdater is by the video system to produce frame content as | 63 // VideoResourceUpdater is by the video system to produce frame content as |
| 64 // resources consumable by the compositor. | 64 // resources consumable by the compositor. |
| 65 class CC_EXPORT VideoResourceUpdater | 65 class CC_EXPORT VideoResourceUpdater |
| 66 : public base::SupportsWeakPtr<VideoResourceUpdater> { | 66 : public base::SupportsWeakPtr<VideoResourceUpdater> { |
| 67 public: | 67 public: |
| (...skipping 30 matching lines...) Expand all Loading... |
| 98 | 98 |
| 99 struct RecycleResourceData { | 99 struct RecycleResourceData { |
| 100 unsigned resource_id; | 100 unsigned resource_id; |
| 101 gfx::Size resource_size; | 101 gfx::Size resource_size; |
| 102 ResourceFormat resource_format; | 102 ResourceFormat resource_format; |
| 103 gpu::Mailbox mailbox; | 103 gpu::Mailbox mailbox; |
| 104 }; | 104 }; |
| 105 static void RecycleResource(base::WeakPtr<VideoResourceUpdater> updater, | 105 static void RecycleResource(base::WeakPtr<VideoResourceUpdater> updater, |
| 106 RecycleResourceData data, | 106 RecycleResourceData data, |
| 107 uint32 sync_point, | 107 uint32 sync_point, |
| 108 bool lost_resource); | 108 bool lost_resource, |
| 109 BlockingTaskRunner* main_thread_task_runner); |
| 109 static void ReturnTexture(base::WeakPtr<VideoResourceUpdater> updater, | 110 static void ReturnTexture(base::WeakPtr<VideoResourceUpdater> updater, |
| 110 const scoped_refptr<media::VideoFrame>& video_frame, | 111 const scoped_refptr<media::VideoFrame>& video_frame, |
| 111 uint32 sync_point, | 112 uint32 sync_point, |
| 112 bool lost_resource); | 113 bool lost_resource, |
| 114 BlockingTaskRunner* main_thread_task_runner); |
| 113 | 115 |
| 114 ContextProvider* context_provider_; | 116 ContextProvider* context_provider_; |
| 115 ResourceProvider* resource_provider_; | 117 ResourceProvider* resource_provider_; |
| 116 scoped_ptr<media::SkCanvasVideoRenderer> video_renderer_; | 118 scoped_ptr<media::SkCanvasVideoRenderer> video_renderer_; |
| 117 | 119 |
| 118 std::vector<unsigned> all_resources_; | 120 std::vector<unsigned> all_resources_; |
| 119 std::vector<PlaneResource> recycled_resources_; | 121 std::vector<PlaneResource> recycled_resources_; |
| 120 | 122 |
| 121 DISALLOW_COPY_AND_ASSIGN(VideoResourceUpdater); | 123 DISALLOW_COPY_AND_ASSIGN(VideoResourceUpdater); |
| 122 }; | 124 }; |
| 123 | 125 |
| 124 } // namespace cc | 126 } // namespace cc |
| 125 | 127 |
| 126 #endif // CC_RESOURCES_VIDEO_RESOURCE_UPDATER_H_ | 128 #endif // CC_RESOURCES_VIDEO_RESOURCE_UPDATER_H_ |
| OLD | NEW |