Respond with QuotaExceededError when IndexedDB has no disk space on open.
[chromium-blink-merge.git] / content / common / gpu / media / rendering_helper.h
blob2986ad383a64e8ec7be23500e1660eecb734a236
1 // Copyright (c) 2012 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.
5 #ifndef CONTENT_COMMON_GPU_MEDIA_RENDERING_HELPER_H_
6 #define CONTENT_COMMON_GPU_MEDIA_RENDERING_HELPER_H_
8 #include <vector>
10 #include "base/basictypes.h"
11 #include "ui/gfx/size.h"
13 namespace base {
14 class WaitableEvent;
17 namespace content {
19 struct RenderingHelperParams {
20 RenderingHelperParams();
21 ~RenderingHelperParams();
23 bool suppress_swap_to_display;
24 int num_windows;
25 // Dimensions of window(s) created for displaying frames. In the
26 // case of thumbnail rendering, these won't match the frame dimensions.
27 std::vector<gfx::Size> window_dimensions;
28 // Dimensions of video frame texture(s).
29 std::vector<gfx::Size> frame_dimensions;
30 // Whether the frames are rendered as scaled thumbnails within a
31 // larger FBO that is in turn rendered to the window.
32 bool render_as_thumbnails;
33 // The size of the FBO containing all visible thumbnails.
34 gfx::Size thumbnails_page_size;
35 // The size of each thumbnail within the FBO.
36 gfx::Size thumbnail_size;
39 // Creates and draws textures used by the video decoder.
40 // This class is not thread safe and thus all the methods of this class
41 // (except for ctor/dtor) ensure they're being run on a single thread.
42 class RenderingHelper {
43 public:
44 // Create a platform specific implementation of this object.
45 static RenderingHelper* Create();
47 RenderingHelper() {}
48 virtual ~RenderingHelper() {}
50 // Create the render context and windows by the specified dimensions.
51 virtual void Initialize(const RenderingHelperParams& params,
52 base::WaitableEvent* done) = 0;
54 // Undo the effects of Initialize() and signal |*done|.
55 virtual void UnInitialize(base::WaitableEvent* done) = 0;
57 // Return a newly-created GLES2 texture id rendering to a specific window, and
58 // signal |*done|.
59 virtual void CreateTexture(int window_id,
60 uint32 texture_target,
61 uint32* texture_id,
62 base::WaitableEvent* done) = 0;
64 // Render |texture_id| to the screen.
65 virtual void RenderTexture(uint32 texture_id) = 0;
67 // Delete |texture_id|.
68 virtual void DeleteTexture(uint32 texture_id) = 0;
70 // Get the platform specific handle to the OpenGL context.
71 virtual void* GetGLContext() = 0;
73 // Get the platform specific handle to the OpenGL display.
74 virtual void* GetGLDisplay() = 0;
76 // Get rendered thumbnails as RGB.
77 // Sets alpha_solid to true if the alpha channel is entirely 0xff.
78 virtual void GetThumbnailsAsRGB(std::vector<unsigned char>* rgb,
79 bool* alpha_solid,
80 base::WaitableEvent* done) = 0;
83 } // namespace content
85 #endif // CONTENT_COMMON_GPU_MEDIA_RENDERING_HELPER_H_