summaryrefslogtreecommitdiffstats
path: root/mojo/examples/sample_app
diff options
context:
space:
mode:
authorabarth@chromium.org <abarth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-02 23:13:56 +0000
committerabarth@chromium.org <abarth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-02 23:13:56 +0000
commit5ad68f63427c91e30e78d76085842ffa703a6e30 (patch)
treeaa10c5e2600a56235bbe996a2a4a5a65678a4d84 /mojo/examples/sample_app
parent357edd26b23b7109932e3403b98d03d6785c6b5f (diff)
downloadchromium_src-5ad68f63427c91e30e78d76085842ffa703a6e30.zip
chromium_src-5ad68f63427c91e30e78d76085842ffa703a6e30.tar.gz
chromium_src-5ad68f63427c91e30e78d76085842ffa703a6e30.tar.bz2
[Mojo] Fix race condition in sample_app's SwapBuffers
The in-process command buffer expects all of its callers to be on a single thread. Prior to this CL, we were bouncing back to the shell thread to call swap buffers. Now we call SwapBuffers from sample_app's thread. R=davemoore@chromium.org Review URL: https://codereview.chromium.org/99323005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@238223 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'mojo/examples/sample_app')
-rw-r--r--mojo/examples/sample_app/native_viewport_client_impl.cc1
-rw-r--r--mojo/examples/sample_app/sample_gles2_delegate.cc6
-rw-r--r--mojo/examples/sample_app/sample_gles2_delegate.h6
3 files changed, 7 insertions, 6 deletions
diff --git a/mojo/examples/sample_app/native_viewport_client_impl.cc b/mojo/examples/sample_app/native_viewport_client_impl.cc
index 7701a18..6f10990 100644
--- a/mojo/examples/sample_app/native_viewport_client_impl.cc
+++ b/mojo/examples/sample_app/native_viewport_client_impl.cc
@@ -17,6 +17,7 @@ NativeViewportClientImpl::NativeViewportClientImpl(ScopedMessagePipeHandle pipe)
}
NativeViewportClientImpl::~NativeViewportClientImpl() {
+ service_->Close();
}
void NativeViewportClientImpl::Open() {
diff --git a/mojo/examples/sample_app/sample_gles2_delegate.cc b/mojo/examples/sample_app/sample_gles2_delegate.cc
index 8245ce6..4bac022 100644
--- a/mojo/examples/sample_app/sample_gles2_delegate.cc
+++ b/mojo/examples/sample_app/sample_gles2_delegate.cc
@@ -19,7 +19,7 @@ SampleGLES2Delegate::~SampleGLES2Delegate() {
}
void SampleGLES2Delegate::DidCreateContext(
- GLES2* gl, uint32_t width, uint32_t height) {
+ GLES2ClientImpl* gl, uint32_t width, uint32_t height) {
gl_ = gl;
cube_.Init(width, height);
last_time_ = base::Time::Now();
@@ -36,9 +36,9 @@ void SampleGLES2Delegate::Draw() {
gl_->SwapBuffers();
}
-void SampleGLES2Delegate::ContextLost(GLES2* gl) {
- timer_.Stop();
+void SampleGLES2Delegate::ContextLost(GLES2ClientImpl* gl) {
gl_ = NULL;
+ timer_.Stop();
}
} // namespace examples
diff --git a/mojo/examples/sample_app/sample_gles2_delegate.h b/mojo/examples/sample_app/sample_gles2_delegate.h
index 226b8ac..efd4872 100644
--- a/mojo/examples/sample_app/sample_gles2_delegate.h
+++ b/mojo/examples/sample_app/sample_gles2_delegate.h
@@ -19,15 +19,15 @@ class SampleGLES2Delegate : public GLES2Delegate {
private:
virtual void DidCreateContext(
- GLES2* gl, uint32_t width, uint32_t height) MOJO_OVERRIDE;
- virtual void ContextLost(GLES2* gl) MOJO_OVERRIDE;
+ GLES2ClientImpl* gl, uint32_t width, uint32_t height) MOJO_OVERRIDE;
+ virtual void ContextLost(GLES2ClientImpl* gl) MOJO_OVERRIDE;
void Draw();
base::Time last_time_;
base::RepeatingTimer<SampleGLES2Delegate> timer_;
- GLES2* gl_;
SpinningCube cube_;
+ GLES2ClientImpl* gl_;
};
} // namespace examples