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

Unified Diff: mojo/examples/pepper_container_app/pepper_container_app.cc

Issue 451753003: Mojo multiple command buffer support and sample (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: better casts Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/examples/compositor_app/compositor_app.cc ('k') | mojo/examples/sample_app/sample_app.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/examples/pepper_container_app/pepper_container_app.cc
diff --git a/mojo/examples/pepper_container_app/pepper_container_app.cc b/mojo/examples/pepper_container_app/pepper_container_app.cc
index e74ae8c1313e5b2d04cede82010e1f50da9a5a8a..8d80a47e68326d7e0ad09628a7053b95d58d694d 100644
--- a/mojo/examples/pepper_container_app/pepper_container_app.cc
+++ b/mojo/examples/pepper_container_app/pepper_container_app.cc
@@ -14,6 +14,7 @@
#include "mojo/public/cpp/application/application_delegate.h"
#include "mojo/public/cpp/application/application_impl.h"
#include "mojo/public/cpp/system/core.h"
+#include "mojo/services/public/interfaces/gpu/gpu.mojom.h"
#include "mojo/services/public/interfaces/native_viewport/native_viewport.mojom.h"
#include "ppapi/c/pp_rect.h"
#include "ppapi/shared_impl/proxy_lock.h"
@@ -35,6 +36,9 @@ class PepperContainerApp: public ApplicationDelegate,
app->ConnectToService("mojo:mojo_native_viewport_service", &viewport_);
viewport_.set_client(this);
+ // TODO(jamesr): Should be mojo:mojo_gpu_service
+ app->ConnectToService("mojo:mojo_native_viewport_service", &gpu_service_);
+
RectPtr rect(Rect::New());
rect->x = 10;
rect->y = 10;
@@ -45,7 +49,8 @@ class PepperContainerApp: public ApplicationDelegate,
}
// NativeViewportClient implementation.
- virtual void OnCreated() OVERRIDE {
+ virtual void OnCreated(uint64_t native_viewport_id) OVERRIDE {
+ native_viewport_id_ = native_viewport_id;
ppapi::ProxyAutoLock lock;
plugin_instance_ = plugin_module_->CreateInstance().Pass();
@@ -53,7 +58,7 @@ class PepperContainerApp: public ApplicationDelegate,
plugin_instance_.reset();
}
- virtual void OnDestroyed(const mojo::Callback<void()>& callback) OVERRIDE {
+ virtual void OnDestroyed() OVERRIDE {
ppapi::ProxyAutoLock lock;
if (plugin_instance_) {
@@ -62,7 +67,6 @@ class PepperContainerApp: public ApplicationDelegate,
}
base::MessageLoop::current()->Quit();
- callback.Run();
}
virtual void OnBoundsChanged(RectPtr bounds) OVERRIDE {
@@ -85,14 +89,20 @@ class PepperContainerApp: public ApplicationDelegate,
// MojoPpapiGlobals::Delegate implementation.
virtual ScopedMessagePipeHandle CreateGLES2Context() OVERRIDE {
CommandBufferPtr command_buffer;
- viewport_->CreateGLES2Context(Get(&command_buffer));
+ SizePtr size = Size::New();
+ size->width = 800;
+ size->width = 600;
+ gpu_service_->CreateOnscreenGLES2Context(
+ native_viewport_id_, size.Pass(), Get(&command_buffer));
return command_buffer.PassMessagePipe();
}
private:
MojoPpapiGlobals ppapi_globals_;
+ uint64_t native_viewport_id_;
NativeViewportPtr viewport_;
+ GpuPtr gpu_service_;
scoped_refptr<PluginModule> plugin_module_;
scoped_ptr<PluginInstance> plugin_instance_;
« no previous file with comments | « mojo/examples/compositor_app/compositor_app.cc ('k') | mojo/examples/sample_app/sample_app.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698