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

Side by Side Diff: content/renderer/render_thread_impl.h

Issue 801973002: Introduce CompositorDependencies for RenderWidgetCompositor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: compdep: . 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 | « content/renderer/render_frame_impl.cc ('k') | content/renderer/render_thread_impl.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 CONTENT_RENDERER_RENDER_THREAD_IMPL_H_ 5 #ifndef CONTENT_RENDERER_RENDER_THREAD_IMPL_H_
6 #define CONTENT_RENDERER_RENDER_THREAD_IMPL_H_ 6 #define CONTENT_RENDERER_RENDER_THREAD_IMPL_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/cancelable_callback.h" 12 #include "base/cancelable_callback.h"
13 #include "base/memory/memory_pressure_listener.h" 13 #include "base/memory/memory_pressure_listener.h"
14 #include "base/metrics/user_metrics_action.h" 14 #include "base/metrics/user_metrics_action.h"
15 #include "base/observer_list.h" 15 #include "base/observer_list.h"
16 #include "base/strings/string16.h" 16 #include "base/strings/string16.h"
17 #include "base/threading/thread_checker.h" 17 #include "base/threading/thread_checker.h"
18 #include "base/timer/timer.h" 18 #include "base/timer/timer.h"
19 #include "build/build_config.h" 19 #include "build/build_config.h"
20 #include "content/child/child_thread.h" 20 #include "content/child/child_thread.h"
21 #include "content/common/content_export.h" 21 #include "content/common/content_export.h"
22 #include "content/common/frame_replication_state.h" 22 #include "content/common/frame_replication_state.h"
23 #include "content/common/gpu/client/gpu_channel_host.h" 23 #include "content/common/gpu/client/gpu_channel_host.h"
24 #include "content/common/gpu/gpu_result_codes.h" 24 #include "content/common/gpu/gpu_result_codes.h"
25 #include "content/public/renderer/render_thread.h" 25 #include "content/public/renderer/render_thread.h"
26 #include "content/renderer/gpu/compositor_dependencies.h"
26 #include "net/base/network_change_notifier.h" 27 #include "net/base/network_change_notifier.h"
27 #include "third_party/WebKit/public/platform/WebConnectionType.h" 28 #include "third_party/WebKit/public/platform/WebConnectionType.h"
28 #include "ui/gfx/native_widget_types.h" 29 #include "ui/gfx/native_widget_types.h"
29 30
30 #if defined(OS_MACOSX) 31 #if defined(OS_MACOSX)
31 #include "third_party/WebKit/public/web/mac/WebScrollbarTheme.h" 32 #include "third_party/WebKit/public/web/mac/WebScrollbarTheme.h"
32 #endif 33 #endif
33 34
34 class GrContext; 35 class GrContext;
35 class SkBitmap; 36 class SkBitmap;
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 108
108 // The RenderThreadImpl class represents a background thread where RenderView 109 // The RenderThreadImpl class represents a background thread where RenderView
109 // instances live. The RenderThread supports an API that is used by its 110 // instances live. The RenderThread supports an API that is used by its
110 // consumer to talk indirectly to the RenderViews and supporting objects. 111 // consumer to talk indirectly to the RenderViews and supporting objects.
111 // Likewise, it provides an API for the RenderViews to talk back to the main 112 // Likewise, it provides an API for the RenderViews to talk back to the main
112 // process (i.e., their corresponding WebContentsImpl). 113 // process (i.e., their corresponding WebContentsImpl).
113 // 114 //
114 // Most of the communication occurs in the form of IPC messages. They are 115 // Most of the communication occurs in the form of IPC messages. They are
115 // routed to the RenderThread according to the routing IDs of the messages. 116 // routed to the RenderThread according to the routing IDs of the messages.
116 // The routing IDs correspond to RenderView instances. 117 // The routing IDs correspond to RenderView instances.
117 class CONTENT_EXPORT RenderThreadImpl : public RenderThread, 118 class CONTENT_EXPORT RenderThreadImpl
118 public ChildThread, 119 : public RenderThread,
119 public GpuChannelHostFactory { 120 public ChildThread,
121 public GpuChannelHostFactory,
122 NON_EXPORTED_BASE(public CompositorDependencies) {
120 public: 123 public:
121 static RenderThreadImpl* current(); 124 static RenderThreadImpl* current();
122 125
123 RenderThreadImpl(); 126 RenderThreadImpl();
124 // Constructor that's used when running in single process mode. 127 // Constructor that's used when running in single process mode.
125 explicit RenderThreadImpl(const std::string& channel_name); 128 explicit RenderThreadImpl(const std::string& channel_name);
126 // Constructor that's used in RendererMain. 129 // Constructor that's used in RendererMain.
127 explicit RenderThreadImpl(scoped_ptr<base::MessageLoop> main_message_loop); 130 explicit RenderThreadImpl(scoped_ptr<base::MessageLoop> main_message_loop);
128 ~RenderThreadImpl() override; 131 ~RenderThreadImpl() override;
129 void Shutdown() override; 132 void Shutdown() override;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 void UpdateHistograms(int sequence_number) override; 170 void UpdateHistograms(int sequence_number) override;
168 int PostTaskToAllWebWorkers(const base::Closure& closure) override; 171 int PostTaskToAllWebWorkers(const base::Closure& closure) override;
169 bool ResolveProxy(const GURL& url, std::string* proxy_list) override; 172 bool ResolveProxy(const GURL& url, std::string* proxy_list) override;
170 base::WaitableEvent* GetShutdownEvent() override; 173 base::WaitableEvent* GetShutdownEvent() override;
171 #if defined(OS_WIN) 174 #if defined(OS_WIN)
172 virtual void PreCacheFont(const LOGFONT& log_font) override; 175 virtual void PreCacheFont(const LOGFONT& log_font) override;
173 virtual void ReleaseCachedFonts() override; 176 virtual void ReleaseCachedFonts() override;
174 #endif 177 #endif
175 ServiceRegistry* GetServiceRegistry() override; 178 ServiceRegistry* GetServiceRegistry() override;
176 179
180 // CompositorDependencies implementation.
181 bool IsImplSidePaintingEnabled() override;
182 bool IsGpuRasterizationForced() override;
183 bool IsGpuRasterizationEnabled() override;
184 bool IsLcdTextEnabled() override;
185 bool IsDistanceFieldTextEnabled() override;
186 bool IsZeroCopyEnabled() override;
187 bool IsOneCopyEnabled() override;
188 uint32 GetImageTextureTarget() override;
189 scoped_refptr<base::SingleThreadTaskRunner>
190 GetCompositorMainThreadTaskRunner() override;
191 scoped_refptr<base::SingleThreadTaskRunner>
192 GetCompositorImplThreadTaskRunner() override;
193 gpu::GpuMemoryBufferManager* GetGpuMemoryBufferManager() override;
194 RendererScheduler* GetRendererScheduler() override;
195 cc::ContextProvider* GetSharedMainThreadContextProvider() override;
196 scoped_ptr<cc::BeginFrameSource> CreateExternalBeginFrameSource(
197 int routing_id) override;
198
177 // Synchronously establish a channel to the GPU plugin if not previously 199 // Synchronously establish a channel to the GPU plugin if not previously
178 // established or if it has been lost (for example if the GPU plugin crashed). 200 // established or if it has been lost (for example if the GPU plugin crashed).
179 // If there is a pending asynchronous request, it will be completed by the 201 // If there is a pending asynchronous request, it will be completed by the
180 // time this routine returns. 202 // time this routine returns.
181 GpuChannelHost* EstablishGpuChannelSync(CauseForGpuLaunch); 203 GpuChannelHost* EstablishGpuChannelSync(CauseForGpuLaunch);
182 204
183 205
184 // These methods modify how the next message is sent. Normally, when sending 206 // These methods modify how the next message is sent. Normally, when sending
185 // a synchronous message that runs a nested message loop, we need to suspend 207 // a synchronous message that runs a nested message loop, we need to suspend
186 // callbacks into WebKit. This involves disabling timers and deferring 208 // callbacks into WebKit. This involves disabling timers and deferring
187 // resource loads. However, there are exceptions when we need to customize 209 // resource loads. However, there are exceptions when we need to customize
188 // the behavior. 210 // the behavior.
189 void DoNotSuspendWebKitSharedTimer(); 211 void DoNotSuspendWebKitSharedTimer();
190 void DoNotNotifyWebKitOfModalLoop(); 212 void DoNotNotifyWebKitOfModalLoop();
191 213
192 // True if we are running layout tests. This currently disables forwarding 214 // True if we are running layout tests. This currently disables forwarding
193 // various status messages to the console, skips network error pages, and 215 // various status messages to the console, skips network error pages, and
194 // short circuits size update and focus events. 216 // short circuits size update and focus events.
195 bool layout_test_mode() const { 217 bool layout_test_mode() const {
196 return layout_test_mode_; 218 return layout_test_mode_;
197 } 219 }
198 void set_layout_test_mode(bool layout_test_mode) { 220 void set_layout_test_mode(bool layout_test_mode) {
199 layout_test_mode_ = layout_test_mode; 221 layout_test_mode_ = layout_test_mode;
200 } 222 }
201 223
202 RendererScheduler* renderer_scheduler() const {
203 DCHECK(renderer_scheduler_);
204 return renderer_scheduler_.get();
205 }
206
207 RendererBlinkPlatformImpl* blink_platform_impl() const { 224 RendererBlinkPlatformImpl* blink_platform_impl() const {
208 DCHECK(blink_platform_impl_); 225 DCHECK(blink_platform_impl_);
209 return blink_platform_impl_.get(); 226 return blink_platform_impl_.get();
210 } 227 }
211 228
212 scoped_refptr<base::SingleThreadTaskRunner>
213 main_thread_compositor_task_runner() const {
214 return main_thread_compositor_task_runner_;
215 }
216
217 CompositorForwardingMessageFilter* compositor_message_filter() const { 229 CompositorForwardingMessageFilter* compositor_message_filter() const {
218 return compositor_message_filter_.get(); 230 return compositor_message_filter_.get();
219 } 231 }
220 232
221 InputHandlerManager* input_handler_manager() const { 233 InputHandlerManager* input_handler_manager() const {
222 return input_handler_manager_.get(); 234 return input_handler_manager_.get();
223 } 235 }
224 236
225 // Will be NULL if threaded compositing has not been enabled. 237 // Will be null if threaded compositing has not been enabled.
226 scoped_refptr<base::MessageLoopProxy> compositor_message_loop_proxy() const { 238 scoped_refptr<base::MessageLoopProxy> compositor_message_loop_proxy() const {
227 return compositor_message_loop_proxy_; 239 return compositor_message_loop_proxy_;
228 } 240 }
229 241
230 bool is_gpu_rasterization_enabled() const {
231 return is_gpu_rasterization_enabled_;
232 }
233
234 bool is_gpu_rasterization_forced() const {
235 return is_gpu_rasterization_forced_;
236 }
237
238 bool is_impl_side_painting_enabled() const {
239 return is_impl_side_painting_enabled_;
240 }
241
242 bool is_lcd_text_enabled() const { return is_lcd_text_enabled_; }
243
244 bool is_distance_field_text_enabled() const {
245 return is_distance_field_text_enabled_;
246 }
247
248 bool is_zero_copy_enabled() const { return is_zero_copy_enabled_; }
249
250 bool is_one_copy_enabled() const { return is_one_copy_enabled_; }
251
252 unsigned use_image_texture_target() const {
253 return use_image_texture_target_;
254 }
255
256 AppCacheDispatcher* appcache_dispatcher() const { 242 AppCacheDispatcher* appcache_dispatcher() const {
257 return appcache_dispatcher_.get(); 243 return appcache_dispatcher_.get();
258 } 244 }
259 245
260 DomStorageDispatcher* dom_storage_dispatcher() const { 246 DomStorageDispatcher* dom_storage_dispatcher() const {
261 return dom_storage_dispatcher_.get(); 247 return dom_storage_dispatcher_.get();
262 } 248 }
263 249
264 EmbeddedWorkerDispatcher* embedded_worker_dispatcher() const { 250 EmbeddedWorkerDispatcher* embedded_worker_dispatcher() const {
265 return embedded_worker_dispatcher_.get(); 251 return embedded_worker_dispatcher_.get();
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 561
576 #if defined(ENABLE_WEBRTC) 562 #if defined(ENABLE_WEBRTC)
577 scoped_ptr<WebRTCIdentityService> webrtc_identity_service_; 563 scoped_ptr<WebRTCIdentityService> webrtc_identity_service_;
578 #endif 564 #endif
579 565
580 scoped_ptr<MemoryObserver> memory_observer_; 566 scoped_ptr<MemoryObserver> memory_observer_;
581 567
582 scoped_refptr<base::SingleThreadTaskRunner> 568 scoped_refptr<base::SingleThreadTaskRunner>
583 main_thread_compositor_task_runner_; 569 main_thread_compositor_task_runner_;
584 570
585 // Compositor settings 571 // Compositor settings.
586 bool is_gpu_rasterization_enabled_; 572 bool is_gpu_rasterization_enabled_;
587 bool is_gpu_rasterization_forced_; 573 bool is_gpu_rasterization_forced_;
588 bool is_impl_side_painting_enabled_; 574 bool is_impl_side_painting_enabled_;
589 bool is_lcd_text_enabled_; 575 bool is_lcd_text_enabled_;
590 bool is_distance_field_text_enabled_; 576 bool is_distance_field_text_enabled_;
591 bool is_zero_copy_enabled_; 577 bool is_zero_copy_enabled_;
592 bool is_one_copy_enabled_; 578 bool is_one_copy_enabled_;
593 unsigned use_image_texture_target_; 579 unsigned use_image_texture_target_;
594 580
595 std::map<int, mojo::MessagePipeHandle> pending_render_frame_connects_; 581 std::map<int, mojo::MessagePipeHandle> pending_render_frame_connects_;
596 582
597 DISALLOW_COPY_AND_ASSIGN(RenderThreadImpl); 583 DISALLOW_COPY_AND_ASSIGN(RenderThreadImpl);
598 }; 584 };
599 585
600 } // namespace content 586 } // namespace content
601 587
602 #endif // CONTENT_RENDERER_RENDER_THREAD_IMPL_H_ 588 #endif // CONTENT_RENDERER_RENDER_THREAD_IMPL_H_
OLDNEW
« no previous file with comments | « content/renderer/render_frame_impl.cc ('k') | content/renderer/render_thread_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698