diff options
author | abarth@chromium.org <abarth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-11 22:23:49 +0000 |
---|---|---|
committer | abarth@chromium.org <abarth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-11 22:23:49 +0000 |
commit | e161119d3ec2049e25732b59331053fc7855f13b (patch) | |
tree | 73b24afb97b34fabdef89d19a3b1e6d9667c4096 /mojo/public | |
parent | 9317c24980c39f7134a7a9dbe4ea0cea6ffc9ade (diff) | |
download | chromium_src-e161119d3ec2049e25732b59331053fc7855f13b.zip chromium_src-e161119d3ec2049e25732b59331053fc7855f13b.tar.gz chromium_src-e161119d3ec2049e25732b59331053fc7855f13b.tar.bz2 |
Make mojo_gles2 work properly in the static build
This CL changes the public mojo_gles2 library to follow the same pattern as the
public mojo_system library. Now the dynamic library is jump a trampoline back
into mojo_gles2_impl, which is currently linked into mojo_shell. If we end up
execing a sub executable in the child process, we'll need to link
mojo_gles2_impl into the stub.
R=viettrungluu@chromium.org
Review URL: https://codereview.chromium.org/106863005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@240195 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'mojo/public')
-rw-r--r-- | mojo/public/gles2/gles2.h | 6 | ||||
-rw-r--r-- | mojo/public/gles2/gles2_private.cc | 42 | ||||
-rw-r--r-- | mojo/public/gles2/gles2_private.h | 29 | ||||
-rw-r--r-- | mojo/public/system/core_private.cc | 6 | ||||
-rw-r--r-- | mojo/public/system/core_private.h | 6 |
5 files changed, 77 insertions, 12 deletions
diff --git a/mojo/public/gles2/gles2.h b/mojo/public/gles2/gles2.h index fbcb2c7..7e89712 100644 --- a/mojo/public/gles2/gles2.h +++ b/mojo/public/gles2/gles2.h @@ -9,8 +9,6 @@ #include <stdint.h> -#if defined(COMPONENT_BUILD) - #if defined(WIN32) #if defined(MOJO_GLES2_IMPLEMENTATION) @@ -29,10 +27,6 @@ #endif // defined(WIN32) -#else // !defined(COMPONENT_BUILD) -#define MOJO_GLES2_EXPORT -#endif - #ifdef __cplusplus extern "C" { #endif diff --git a/mojo/public/gles2/gles2_private.cc b/mojo/public/gles2/gles2_private.cc new file mode 100644 index 0000000..8df1660 --- /dev/null +++ b/mojo/public/gles2/gles2_private.cc @@ -0,0 +1,42 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "mojo/public/gles2/gles2_private.h" + +#include <assert.h> +#include <stddef.h> + +static mojo::GLES2Private* g_private = NULL; + +extern "C" { + +void MojoGLES2Initialize() { + g_private->Initialize(); +} + +void MojoGLES2Terminate() { + g_private->Terminate(); +} + +void MojoGLES2MakeCurrent(uint64_t encoded) { + g_private->MakeCurrent(encoded); +} + +void MojoGLES2SwapBuffers() { + g_private->SwapBuffers(); +} + +} // extern "C" + +namespace mojo { + +GLES2Private::~GLES2Private() { +} + +void GLES2Private::Init(GLES2Private* priv) { + assert(!g_private); + g_private = priv; +} + +} // namespace mojo diff --git a/mojo/public/gles2/gles2_private.h b/mojo/public/gles2/gles2_private.h new file mode 100644 index 0000000..8fd0d0c --- /dev/null +++ b/mojo/public/gles2/gles2_private.h @@ -0,0 +1,29 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef MOJO_PUBLIC_SYSTEM_GLES2_PRIVATE_H_ +#define MOJO_PUBLIC_SYSTEM_GLES2_PRIVATE_H_ + +#include "mojo/public/gles2/gles2.h" + +namespace mojo { + +// Implementors of the gles2 APIs can use this interface to install their +// implementation into the mojo_gles2 dynamic library. Mojo clients should not +// call these functions directly. +class MOJO_GLES2_EXPORT GLES2Private { + public: + virtual ~GLES2Private(); + + static void Init(GLES2Private* priv); + + virtual void Initialize() = 0; + virtual void Terminate() = 0; + virtual void MakeCurrent(uint64_t encoded) = 0; + virtual void SwapBuffers() = 0; +}; + +} // namespace mojo + +#endif // MOJO_PUBLIC_SYSTEM_GLES2_PRIVATE_H_ diff --git a/mojo/public/system/core_private.cc b/mojo/public/system/core_private.cc index bc37ac0..3854c65 100644 --- a/mojo/public/system/core_private.cc +++ b/mojo/public/system/core_private.cc @@ -7,7 +7,7 @@ #include <assert.h> #include <stddef.h> -static mojo::Core* g_core = NULL; +static mojo::CorePrivate* g_core = NULL; extern "C" { @@ -67,10 +67,10 @@ MojoTimeTicks MojoGetTimeTicksNow() { namespace mojo { -Core::~Core() { +CorePrivate::~CorePrivate() { } -void Core::Init(Core* core) { +void CorePrivate::Init(CorePrivate* core) { assert(!g_core); g_core = core; } diff --git a/mojo/public/system/core_private.h b/mojo/public/system/core_private.h index adda16f..d72addd 100644 --- a/mojo/public/system/core_private.h +++ b/mojo/public/system/core_private.h @@ -12,11 +12,11 @@ namespace mojo { // Implementors of the core APIs can use this interface to install their // implementation into the mojo_system dynamic library. Mojo clients should not // call these functions directly. -class MOJO_SYSTEM_EXPORT Core { +class MOJO_SYSTEM_EXPORT CorePrivate { public: - virtual ~Core(); + virtual ~CorePrivate(); - static void Init(Core* core); + static void Init(CorePrivate* core); virtual MojoResult Close(MojoHandle handle) = 0; virtual MojoResult Wait(MojoHandle handle, |