Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(383)

Side by Side Diff: chromecast/public/cast_egl_platform.h

Issue 1059073002: Loads CastEglPlatform implementation from shared library. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed all Chromium types from shared library interface Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 CHROMECAST_OZONE_CAST_EGL_PLATFORM_H_ 5 #ifndef CHROMECAST_PUBLIC_CAST_EGL_PLATFORM_H_
6 #define CHROMECAST_OZONE_CAST_EGL_PLATFORM_H_ 6 #define CHROMECAST_PUBLIC_CAST_EGL_PLATFORM_H_
7
8 #include "ui/ozone/public/surface_factory_ozone.h"
9
10 namespace gfx {
11 class Size;
12 }
13 7
14 namespace chromecast { 8 namespace chromecast {
15 namespace ozone {
16 9
17 // Interface representing all the hardware-specific elements of an Ozone 10 // Interface representing all the hardware-specific elements of an Ozone
18 // implementation for Cast. Supply an implementation of this interface 11 // implementation for Cast. Supply an implementation of this interface
19 // to OzonePlatformCast to create a complete Ozone implementation. 12 // to OzonePlatformCast to create a complete Ozone implementation.
20 class CastEglPlatform { 13 class CastEglPlatform {
21 public: 14 public:
22 typedef ui::SurfaceFactoryOzone::AddGLLibraryCallback AddGLLibraryCallback; 15
23 typedef ui::SurfaceFactoryOzone::SetGLGetProcAddressProcCallback 16 // Avoiding Chromium types in shared library interfaces, so no gfx::Size.
24 SetGLGetProcAddressProcCallback; 17 struct Size {
18 Size(int width, int height)
19 : width_(width),
20 height_(height) {}
21 const int width_;
22 const int height_;
byungchul 2015/04/03 06:10:07 Remove trailing '_' because they are public member
halliwell 2015/04/04 01:40:06 Done.
23 };
25 24
26 virtual ~CastEglPlatform() {} 25 virtual ~CastEglPlatform() {}
27 26
28 // Default display size is used for initial display and also as a minimum 27 // Default display size is used for initial display and also as a minimum
29 // resolution for applications. 28 // resolution for applications.
30 virtual gfx::Size GetDefaultDisplaySize() const = 0; 29 virtual Size GetDefaultDisplaySize() const = 0;
31 30
32 // Returns an array of EGL properties, which can be used in any EGL function 31 // Returns an array of EGL properties, which can be used in any EGL function
33 // used to select a display configuration. Note that all properties should be 32 // used to select a display configuration. Note that all properties should be
34 // immediately followed by the corresponding desired value and array should be 33 // immediately followed by the corresponding desired value and array should be
35 // terminated with EGL_NONE. Ownership of the array is not transferred to 34 // terminated with EGL_NONE. Ownership of the array is not transferred to
36 // caller. desired_list contains list of desired EGL properties and values. 35 // caller. desired_list contains list of desired EGL properties and values.
37 virtual const int32* GetEGLSurfaceProperties(const int32* desired_list) = 0; 36 virtual const int32* GetEGLSurfaceProperties(const int32* desired_list) = 0;
38 37
39 // Initialize/ShutdownHardware are called at most once each over the object's 38 // Initialize/ShutdownHardware are called at most once each over the object's
40 // lifetime. Initialize will be called before creating display type or 39 // lifetime. Initialize will be called before creating display type or
41 // window. If Initialize fails, return false (Shutdown will still be called). 40 // window. If Initialize fails, return false (Shutdown will still be called).
42 virtual bool InitializeHardware() = 0; 41 virtual bool InitializeHardware() = 0;
43 virtual void ShutdownHardware() = 0; 42 virtual void ShutdownHardware() = 0;
44 43
45 // Called once after hardware successfully initialized. Implementation needs 44 // These three are called once after hardware is successfully initialized.
46 // to add the EGL and GLES2 libraries through add_gl_library and also supply 45 // The implementation must load the libraries containing EGL and GLES2
47 // a pointer to eglGetProcAddress (or equivalent function). 46 // bindings (return the pointer obtained from dlopen). It must also supply
48 virtual bool LoadEGLGLES2Bindings( 47 // a function pointer to eglGetProcAddress or equivalent.
49 AddGLLibraryCallback add_gl_library, 48 virtual void* GetEglLibrary() = 0;
50 SetGLGetProcAddressProcCallback set_gl_get_proc_address) = 0; 49 virtual void* GetGles2Library() = 0;
50
51 typedef void* (*GLGetProcAddressProc)(const char* name);
52 virtual GLGetProcAddressProc GetGLProcAddressProc() = 0;
51 53
52 // Create/destroy an EGLNativeDisplayType. These may be called multiple times 54 // Create/destroy an EGLNativeDisplayType. These may be called multiple times
byungchul 2015/04/03 05:58:17 Creates/destroys
halliwell 2015/04/04 01:40:06 Done.
53 // over the object's lifetime, for example to release the display when 55 // over the object's lifetime, for example to release the display when
54 // switching to an external application. There will be at most one display 56 // switching to an external application. There will be at most one display
55 // type at a time. 57 // type at a time.
56 virtual intptr_t CreateDisplayType(const gfx::Size& size) = 0; 58 virtual intptr_t CreateDisplayType(const Size& size) = 0;
byungchul 2015/04/03 15:28:52 I understood that it is a subset of ui::SurfaceFac
halliwell 2015/04/04 01:40:06 I switched intptr_t usage to void*, with typedefs
57 virtual void DestroyDisplayType(intptr_t display_type) = 0; 59 virtual void DestroyDisplayType(intptr_t display_type) = 0;
58 60
59 // Create/destroy an EGLNativeWindow. There will be at most one window at a 61 // Create/destroy an EGLNativeWindow. There will be at most one window at a
byungchul 2015/04/03 05:58:17 Creates/destroys
halliwell 2015/04/04 01:40:06 Done.
60 // time, created within a valid display type. 62 // time, created within a valid display type.
61 virtual intptr_t CreateWindow(intptr_t display_type, 63 virtual intptr_t CreateWindow(intptr_t display_type, const Size& size) = 0;
62 const gfx::Size& size) = 0;
63 virtual void DestroyWindow(intptr_t window) = 0; 64 virtual void DestroyWindow(intptr_t window) = 0;
64 }; 65 };
65 66
66 } // namespace ozone
67 } // namespace chromecast 67 } // namespace chromecast
68 68
69 #endif // CHROMECAST_OZONE_CAST_EGL_PLATFORM_H_ 69 #endif // CHROMECAST_PUBLIC_CAST_EGL_PLATFORM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698