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

Side by Side Diff: sky/viewer/document_view.h

Issue 739413004: Wire up Sky directly to Ganesh (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: rebaes Created 6 years 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 unified diff | Download patch
« no previous file with comments | « sky/viewer/BUILD.gn ('k') | sky/viewer/document_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef SKY_VIEWER_DOCUMENT_VIEW_H_ 5 #ifndef SKY_VIEWER_DOCUMENT_VIEW_H_
6 #define SKY_VIEWER_DOCUMENT_VIEW_H_ 6 #define SKY_VIEWER_DOCUMENT_VIEW_H_
7 7
8 #include "base/compiler_specific.h"
9 #include "base/memory/weak_ptr.h" 8 #include "base/memory/weak_ptr.h"
10 #include "mojo/public/cpp/application/lazy_interface_ptr.h" 9 #include "mojo/public/cpp/application/lazy_interface_ptr.h"
11 #include "mojo/public/cpp/application/service_provider_impl.h" 10 #include "mojo/public/cpp/application/service_provider_impl.h"
12 #include "mojo/public/cpp/bindings/interface_impl.h" 11 #include "mojo/public/cpp/bindings/interface_impl.h"
13 #include "mojo/public/interfaces/application/application.mojom.h" 12 #include "mojo/public/interfaces/application/application.mojom.h"
14 #include "mojo/services/public/cpp/view_manager/view_manager_client_factory.h" 13 #include "mojo/services/public/cpp/view_manager/view_manager_client_factory.h"
15 #include "mojo/services/public/cpp/view_manager/view_manager_delegate.h" 14 #include "mojo/services/public/cpp/view_manager/view_manager_delegate.h"
16 #include "mojo/services/public/cpp/view_manager/view_observer.h" 15 #include "mojo/services/public/cpp/view_manager/view_observer.h"
17 #include "mojo/services/public/interfaces/content_handler/content_handler.mojom. h" 16 #include "mojo/services/public/interfaces/content_handler/content_handler.mojom. h"
18 #include "mojo/services/public/interfaces/navigation/navigation.mojom.h" 17 #include "mojo/services/public/interfaces/navigation/navigation.mojom.h"
19 #include "mojo/services/public/interfaces/network/url_loader.mojom.h" 18 #include "mojo/services/public/interfaces/network/url_loader.mojom.h"
19 #include "sky/compositor/layer_client.h"
20 #include "sky/compositor/layer_host_client.h"
20 #include "sky/engine/public/platform/ServiceProvider.h" 21 #include "sky/engine/public/platform/ServiceProvider.h"
21 #include "sky/engine/public/web/WebFrameClient.h" 22 #include "sky/engine/public/web/WebFrameClient.h"
22 #include "sky/engine/public/web/WebViewClient.h" 23 #include "sky/engine/public/web/WebViewClient.h"
23 #include "sky/viewer/services/inspector_impl.h" 24 #include "sky/viewer/services/inspector_impl.h"
24 25
26 // You can try enabling the Sky compositor, but it's a bit buggy.
27 #define ENABLE_SKY_COMPOSITOR 0
28
25 namespace base { 29 namespace base {
26 class MessageLoopProxy; 30 class MessageLoopProxy;
27 } 31 }
28 32
29 namespace mojo { 33 namespace mojo {
30 class ViewManager; 34 class ViewManager;
31 class View; 35 class View;
32 } 36 }
33 37
34 namespace inspector { 38 namespace inspector {
35 class InspectorBackendMojo; 39 class InspectorBackendMojo;
36 } 40 }
37 41
38 namespace sky { 42 namespace sky {
39 class InspectorHostImpl; 43 class InspectorHostImpl;
40 class ScriptRunner; 44 class ScriptRunner;
45 class Layer;
46 class LayerHost;
41 class WebLayerTreeViewImpl; 47 class WebLayerTreeViewImpl;
42 48
43 class DocumentView : public mojo::InterfaceImpl<mojo::Application>, 49 class DocumentView : public mojo::InterfaceImpl<mojo::Application>,
44 public blink::ServiceProvider, 50 public blink::ServiceProvider,
45 public blink::WebViewClient, 51 public blink::WebViewClient,
46 public blink::WebFrameClient, 52 public blink::WebFrameClient,
53 #if ENABLE_SKY_COMPOSITOR
54 public sky::LayerClient,
55 public sky::LayerHostClient,
56 #endif
47 public mojo::ViewManagerDelegate, 57 public mojo::ViewManagerDelegate,
48 public mojo::ViewObserver { 58 public mojo::ViewObserver {
49 public: 59 public:
50 // Load a new HTMLDocument with |response|.
51 //
52 // |shell| is the Shell connection for this mojo::Application.
53 DocumentView(mojo::URLResponsePtr response, 60 DocumentView(mojo::URLResponsePtr response,
54 mojo::ShellPtr shell, 61 mojo::ShellPtr shell,
55 scoped_refptr<base::MessageLoopProxy> compositor_thread); 62 scoped_refptr<base::MessageLoopProxy> compositor_thread);
56 virtual ~DocumentView(); 63 virtual ~DocumentView();
57 64
58 base::WeakPtr<DocumentView> GetWeakPtr(); 65 base::WeakPtr<DocumentView> GetWeakPtr();
59 66
60 blink::WebView* web_view() const { return web_view_; } 67 blink::WebView* web_view() const { return web_view_; }
61 mojo::ServiceProvider* imported_services() const { 68 mojo::ServiceProvider* imported_services() const {
62 return imported_services_.get(); 69 return imported_services_.get();
63 } 70 }
64 71
65 mojo::Shell* shell() const { return shell_.get(); } 72 mojo::Shell* shell() const { return shell_.get(); }
66 73
74 #if ENABLE_SKY_COMPOSITOR
75 // sky::LayerHostClient
76 mojo::Shell* GetShell() override;
77 void BeginFrame(base::TimeTicks frame_time) override;
78 void OnSurfaceIdAvailable(mojo::SurfaceIdPtr surface_id) override;
79 // sky::LayerClient
80 void PaintContents(SkCanvas* canvas, const gfx::Rect& clip) override;
81 #endif // ENABLE_SKY_COMPOSITOR
82
67 void StartDebuggerInspectorBackend(); 83 void StartDebuggerInspectorBackend();
68 84
69 private: 85 private:
70 // Application methods: 86 // Application methods:
71 void AcceptConnection(const mojo::String& requestor_url, 87 void AcceptConnection(const mojo::String& requestor_url,
72 mojo::ServiceProviderPtr provider) override; 88 mojo::ServiceProviderPtr provider) override;
73 void Initialize(mojo::Array<mojo::String> args) override; 89 void Initialize(mojo::Array<mojo::String> args) override;
74 90
75 // WebWidgetClient methods: 91 // WebWidgetClient methods:
76 blink::WebLayerTreeView* initializeLayerTreeView() override; 92 blink::WebLayerTreeView* initializeLayerTreeView() override;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 136
121 mojo::URLResponsePtr response_; 137 mojo::URLResponsePtr response_;
122 mojo::ServiceProviderImpl exported_services_; 138 mojo::ServiceProviderImpl exported_services_;
123 scoped_ptr<mojo::ServiceProvider> imported_services_; 139 scoped_ptr<mojo::ServiceProvider> imported_services_;
124 mojo::ShellPtr shell_; 140 mojo::ShellPtr shell_;
125 mojo::LazyInterfacePtr<mojo::NavigatorHost> navigator_host_; 141 mojo::LazyInterfacePtr<mojo::NavigatorHost> navigator_host_;
126 blink::WebView* web_view_; 142 blink::WebView* web_view_;
127 mojo::View* root_; 143 mojo::View* root_;
128 mojo::ViewManagerClientFactory view_manager_client_factory_; 144 mojo::ViewManagerClientFactory view_manager_client_factory_;
129 InspectorServiceFactory inspector_service_factory_; 145 InspectorServiceFactory inspector_service_factory_;
146 #if ENABLE_SKY_COMPOSITOR
147 scoped_ptr<LayerHost> layer_host_;
148 scoped_refptr<Layer> root_layer_;
149 #else
130 scoped_ptr<WebLayerTreeViewImpl> web_layer_tree_view_impl_; 150 scoped_ptr<WebLayerTreeViewImpl> web_layer_tree_view_impl_;
151 #endif
131 scoped_refptr<base::MessageLoopProxy> compositor_thread_; 152 scoped_refptr<base::MessageLoopProxy> compositor_thread_;
132 scoped_ptr<ScriptRunner> script_runner_; 153 scoped_ptr<ScriptRunner> script_runner_;
133 scoped_ptr<InspectorHostImpl> inspector_host_; 154 scoped_ptr<InspectorHostImpl> inspector_host_;
134 scoped_ptr<inspector::InspectorBackendMojo> inspector_backend_; 155 scoped_ptr<inspector::InspectorBackendMojo> inspector_backend_;
135 int debugger_id_; 156 int debugger_id_;
136 157
137 base::WeakPtrFactory<DocumentView> weak_factory_; 158 base::WeakPtrFactory<DocumentView> weak_factory_;
138 DISALLOW_COPY_AND_ASSIGN(DocumentView); 159 DISALLOW_COPY_AND_ASSIGN(DocumentView);
139 }; 160 };
140 161
141 } // namespace sky 162 } // namespace sky
142 163
143 #endif // SKY_VIEWER_DOCUMENT_VIEW_H_ 164 #endif // SKY_VIEWER_DOCUMENT_VIEW_H_
OLDNEW
« no previous file with comments | « sky/viewer/BUILD.gn ('k') | sky/viewer/document_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698