Index: mojo/examples/surfaces_app/child_gl_app.cc |
diff --git a/mojo/examples/surfaces_app/child_app.cc b/mojo/examples/surfaces_app/child_gl_app.cc |
similarity index 60% |
copy from mojo/examples/surfaces_app/child_app.cc |
copy to mojo/examples/surfaces_app/child_gl_app.cc |
index 215f496caec51e7d54ec69106e69e5013c278de3..d62d93f88809bcca552ce5199020d5b439495e26 100644 |
--- a/mojo/examples/surfaces_app/child_app.cc |
+++ b/mojo/examples/surfaces_app/child_gl_app.cc |
@@ -2,23 +2,27 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#include "mojo/examples/surfaces_app/child_impl.h" |
+#include "base/threading/platform_thread.h" |
+#include "mojo/examples/surfaces_app/child_gl_impl.h" |
#include "mojo/public/cpp/application/application_connection.h" |
#include "mojo/public/cpp/application/application_delegate.h" |
#include "mojo/public/cpp/application/application_impl.h" |
#include "mojo/public/cpp/bindings/string.h" |
+#include "mojo/services/public/interfaces/native_viewport/native_viewport.mojom.h" |
namespace mojo { |
namespace examples { |
-class ChildApp : public ApplicationDelegate, public InterfaceFactory<Child> { |
+class ChildGLApp : public ApplicationDelegate, public InterfaceFactory<Child> { |
public: |
- ChildApp() {} |
- virtual ~ChildApp() {} |
+ ChildGLApp() {} |
+ virtual ~ChildGLApp() {} |
virtual void Initialize(ApplicationImpl* app) OVERRIDE { |
surfaces_service_connection_ = |
app->ConnectToApplication("mojo:mojo_surfaces_service"); |
+ app->ConnectToService("mojo:mojo_native_viewport_service", |
+ &native_viewport_); |
} |
// ApplicationDelegate implementation. |
@@ -31,20 +35,25 @@ class ChildApp : public ApplicationDelegate, public InterfaceFactory<Child> { |
// InterfaceFactory<Child> implementation. |
virtual void Create(ApplicationConnection* connection, |
InterfaceRequest<Child> request) OVERRIDE { |
- BindToRequest(new ChildImpl(surfaces_service_connection_), &request); |
+ CommandBufferPtr command_buffer; |
+ native_viewport_->CreateOffscreenGLES2Context(Get(&command_buffer)); |
+ BindToRequest( |
+ new ChildGLImpl(surfaces_service_connection_, command_buffer.Pass()), |
+ &request); |
} |
private: |
ApplicationConnection* surfaces_service_connection_; |
+ NativeViewportPtr native_viewport_; |
- DISALLOW_COPY_AND_ASSIGN(ChildApp); |
+ DISALLOW_COPY_AND_ASSIGN(ChildGLApp); |
}; |
} // namespace examples |
// static |
ApplicationDelegate* ApplicationDelegate::Create() { |
- return new examples::ChildApp(); |
+ return new examples::ChildGLApp(); |
} |
} // namespace mojo |