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

Unified Diff: mojo/services/html_viewer/html_viewer.cc

Issue 558343004: Compositor bindings for mojo html_viewer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mojo_view_manager_surface
Patch Set: Add missing m/s/p/cpp/v_m -> m/s/p/cpp/surfaces dep in GN Created 6 years, 3 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/services/html_viewer/html_document_view.cc ('k') | mojo/services/html_viewer/weblayertreeview_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/services/html_viewer/html_viewer.cc
diff --git a/mojo/services/html_viewer/html_viewer.cc b/mojo/services/html_viewer/html_viewer.cc
index e8b5c76314bbf01afa43a1b6b037f18a495b866b..2a8e766679b01c982763bd01230c41718c61f38a 100644
--- a/mojo/services/html_viewer/html_viewer.cc
+++ b/mojo/services/html_viewer/html_viewer.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "base/message_loop/message_loop.h"
+#include "base/threading/thread.h"
#include "mojo/public/c/system/main.h"
#include "mojo/public/cpp/application/application_connection.h"
#include "mojo/public/cpp/application/application_delegate.h"
@@ -20,7 +21,9 @@ class HTMLViewer;
class ContentHandlerImpl : public InterfaceImpl<ContentHandler> {
public:
- explicit ContentHandlerImpl(Shell* shell) : shell_(shell) {}
+ ContentHandlerImpl(Shell* shell,
+ scoped_refptr<base::MessageLoopProxy> compositor_thread)
+ : shell_(shell), compositor_thread_(compositor_thread) {}
virtual ~ContentHandlerImpl() {}
private:
@@ -29,40 +32,51 @@ class ContentHandlerImpl : public InterfaceImpl<ContentHandler> {
const mojo::String& url,
URLResponsePtr response,
InterfaceRequest<ServiceProvider> service_provider_request) OVERRIDE {
- new HTMLDocumentView(
- response.Pass(), service_provider_request.Pass(), shell_);
+ new HTMLDocumentView(response.Pass(),
+ service_provider_request.Pass(),
+ shell_,
+ compositor_thread_);
}
Shell* shell_;
+ scoped_refptr<base::MessageLoopProxy> compositor_thread_;
DISALLOW_COPY_AND_ASSIGN(ContentHandlerImpl);
};
-class HTMLViewer : public ApplicationDelegate {
+class HTMLViewer : public ApplicationDelegate,
+ public InterfaceFactory<ContentHandler> {
public:
- HTMLViewer() {}
+ HTMLViewer() : compositor_thread_("compositor thread") {}
virtual ~HTMLViewer() { blink::shutdown(); }
private:
// Overridden from ApplicationDelegate:
virtual void Initialize(ApplicationImpl* app) OVERRIDE {
- content_handler_factory_.reset(
- new InterfaceFactoryImplWithContext<ContentHandlerImpl, Shell>(
- app->shell()));
+ shell_ = app->shell();
blink_platform_impl_.reset(new BlinkPlatformImpl(app));
blink::initialize(blink_platform_impl_.get());
+ compositor_thread_.Start();
}
virtual bool ConfigureIncomingConnection(ApplicationConnection* connection)
OVERRIDE {
- connection->AddService(content_handler_factory_.get());
+ connection->AddService(this);
return true;
}
+ // Overridden from InterfaceFactory<ContentHandler>
+ virtual void Create(ApplicationConnection* connection,
+ InterfaceRequest<ContentHandler> request) OVERRIDE {
+ BindToRequest(
+ new ContentHandlerImpl(shell_, compositor_thread_.message_loop_proxy()),
+ &request);
+ }
+
scoped_ptr<BlinkPlatformImpl> blink_platform_impl_;
- scoped_ptr<InterfaceFactoryImplWithContext<ContentHandlerImpl, Shell> >
- content_handler_factory_;
+ Shell* shell_;
+ base::Thread compositor_thread_;
DISALLOW_COPY_AND_ASSIGN(HTMLViewer);
};
« no previous file with comments | « mojo/services/html_viewer/html_document_view.cc ('k') | mojo/services/html_viewer/weblayertreeview_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698