OLD | NEW |
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_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <queue> | 9 #include <queue> |
10 | 10 |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/i18n/rtl.h" | 13 #include "base/i18n/rtl.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
16 #include "base/process/process.h" | 16 #include "base/process/process.h" |
17 #include "cc/layers/delegated_frame_resource_collection.h" | 17 #include "cc/layers/delegated_frame_resource_collection.h" |
18 #include "cc/layers/texture_layer_client.h" | |
19 #include "cc/output/begin_frame_args.h" | 18 #include "cc/output/begin_frame_args.h" |
20 #include "content/browser/accessibility/browser_accessibility_manager.h" | 19 #include "content/browser/accessibility/browser_accessibility_manager.h" |
21 #include "content/browser/renderer_host/delegated_frame_evictor.h" | 20 #include "content/browser/renderer_host/delegated_frame_evictor.h" |
22 #include "content/browser/renderer_host/image_transport_factory_android.h" | 21 #include "content/browser/renderer_host/image_transport_factory_android.h" |
23 #include "content/browser/renderer_host/ime_adapter_android.h" | 22 #include "content/browser/renderer_host/ime_adapter_android.h" |
24 #include "content/browser/renderer_host/render_widget_host_view_base.h" | 23 #include "content/browser/renderer_host/render_widget_host_view_base.h" |
25 #include "gpu/command_buffer/common/mailbox.h" | 24 #include "gpu/command_buffer/common/mailbox.h" |
26 #include "third_party/skia/include/core/SkColor.h" | 25 #include "third_party/skia/include/core/SkColor.h" |
27 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" | 26 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" |
28 #include "ui/base/android/window_android_observer.h" | 27 #include "ui/base/android/window_android_observer.h" |
29 #include "ui/gfx/size.h" | 28 #include "ui/gfx/size.h" |
30 #include "ui/gfx/vector2d_f.h" | 29 #include "ui/gfx/vector2d_f.h" |
31 | 30 |
32 struct ViewHostMsg_TextInputState_Params; | 31 struct ViewHostMsg_TextInputState_Params; |
33 | 32 |
34 struct GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params; | 33 struct GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params; |
35 struct GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params; | 34 struct GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params; |
36 | 35 |
37 namespace cc { | 36 namespace cc { |
38 class CopyOutputResult; | 37 class CopyOutputResult; |
39 class DelegatedFrameProvider; | 38 class DelegatedFrameProvider; |
40 class DelegatedRendererLayer; | 39 class DelegatedRendererLayer; |
41 class Layer; | 40 class Layer; |
42 class SingleReleaseCallback; | |
43 class TextureLayer; | |
44 } | 41 } |
45 | 42 |
46 namespace blink { | 43 namespace blink { |
47 class WebExternalTextureLayer; | 44 class WebExternalTextureLayer; |
48 class WebTouchEvent; | 45 class WebTouchEvent; |
49 class WebMouseEvent; | 46 class WebMouseEvent; |
50 } | 47 } |
51 | 48 |
52 namespace content { | 49 namespace content { |
53 class ContentViewCoreImpl; | 50 class ContentViewCoreImpl; |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 // Returns true when animation ticks are still needed. This avoids a separate | 236 // Returns true when animation ticks are still needed. This avoids a separate |
240 // round-trip for requesting follow-up animation. | 237 // round-trip for requesting follow-up animation. |
241 bool Animate(base::TimeTicks frame_time); | 238 bool Animate(base::TimeTicks frame_time); |
242 | 239 |
243 void SynchronousFrameMetadata( | 240 void SynchronousFrameMetadata( |
244 const cc::CompositorFrameMetadata& frame_metadata); | 241 const cc::CompositorFrameMetadata& frame_metadata); |
245 | 242 |
246 void SetOverlayVideoMode(bool enabled); | 243 void SetOverlayVideoMode(bool enabled); |
247 | 244 |
248 private: | 245 private: |
249 void BuffersSwapped(const gpu::Mailbox& mailbox, | |
250 uint32_t output_surface_id, | |
251 const base::Closure& ack_callback); | |
252 | |
253 void RunAckCallbacks(); | 246 void RunAckCallbacks(); |
254 | 247 |
255 void DestroyDelegatedContent(); | 248 void DestroyDelegatedContent(); |
256 void SwapDelegatedFrame(uint32 output_surface_id, | 249 void SwapDelegatedFrame(uint32 output_surface_id, |
257 scoped_ptr<cc::DelegatedFrameData> frame_data); | 250 scoped_ptr<cc::DelegatedFrameData> frame_data); |
258 void SendDelegatedFrameAck(uint32 output_surface_id); | 251 void SendDelegatedFrameAck(uint32 output_surface_id); |
259 void SendReturnedDelegatedResources(uint32 output_surface_id); | 252 void SendReturnedDelegatedResources(uint32 output_surface_id); |
260 | 253 |
261 void UpdateContentViewCoreFrameMetadata( | 254 void UpdateContentViewCoreFrameMetadata( |
262 const cc::CompositorFrameMetadata& frame_metadata); | 255 const cc::CompositorFrameMetadata& frame_metadata); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 bool is_showing_; | 309 bool is_showing_; |
317 | 310 |
318 // ContentViewCoreImpl is our interface to the view system. | 311 // ContentViewCoreImpl is our interface to the view system. |
319 ContentViewCoreImpl* content_view_core_; | 312 ContentViewCoreImpl* content_view_core_; |
320 | 313 |
321 ImeAdapterAndroid ime_adapter_android_; | 314 ImeAdapterAndroid ime_adapter_android_; |
322 | 315 |
323 // Body background color of the underlying document. | 316 // Body background color of the underlying document. |
324 SkColor cached_background_color_; | 317 SkColor cached_background_color_; |
325 | 318 |
326 // The texture layer for this view when using browser-side compositing. | |
327 scoped_refptr<cc::TextureLayer> texture_layer_; | |
328 | |
329 scoped_refptr<cc::DelegatedFrameResourceCollection> resource_collection_; | 319 scoped_refptr<cc::DelegatedFrameResourceCollection> resource_collection_; |
330 scoped_refptr<cc::DelegatedFrameProvider> frame_provider_; | 320 scoped_refptr<cc::DelegatedFrameProvider> frame_provider_; |
331 scoped_refptr<cc::DelegatedRendererLayer> delegated_renderer_layer_; | 321 scoped_refptr<cc::DelegatedRendererLayer> layer_; |
332 | |
333 // The layer used for rendering the contents of this view. | |
334 // It is either owned by texture_layer_ or surface_texture_transport_ | |
335 // depending on the mode. | |
336 scoped_refptr<cc::Layer> layer_; | |
337 | |
338 // The most recent texture id that was pushed to the texture layer. | |
339 unsigned int texture_id_in_layer_; | |
340 | 322 |
341 // The most recent texture size that was pushed to the texture layer. | 323 // The most recent texture size that was pushed to the texture layer. |
342 gfx::Size texture_size_in_layer_; | 324 gfx::Size texture_size_in_layer_; |
343 | 325 |
344 // The most recent content size that was pushed to the texture layer. | 326 // The most recent content size that was pushed to the texture layer. |
345 gfx::Size content_size_in_layer_; | 327 gfx::Size content_size_in_layer_; |
346 | 328 |
347 // The mailbox of the previously received frame. | |
348 gpu::Mailbox current_mailbox_; | |
349 | |
350 // The output surface id of the last received frame. | 329 // The output surface id of the last received frame. |
351 uint32_t last_output_surface_id_; | 330 uint32_t last_output_surface_id_; |
352 | 331 |
353 base::WeakPtrFactory<RenderWidgetHostViewAndroid> weak_ptr_factory_; | 332 base::WeakPtrFactory<RenderWidgetHostViewAndroid> weak_ptr_factory_; |
354 | 333 |
355 std::queue<base::Closure> ack_callbacks_; | 334 std::queue<base::Closure> ack_callbacks_; |
356 | 335 |
357 const bool overscroll_effect_enabled_; | 336 const bool overscroll_effect_enabled_; |
358 // Used to render overscroll overlays. | 337 // Used to render overscroll overlays. |
359 // Note: |overscroll_effect_| will never be NULL, even if it's never enabled. | 338 // Note: |overscroll_effect_| will never be NULL, even if it's never enabled. |
360 scoped_ptr<OverscrollGlow> overscroll_effect_; | 339 scoped_ptr<OverscrollGlow> overscroll_effect_; |
361 | 340 |
362 bool flush_input_requested_; | 341 bool flush_input_requested_; |
363 | 342 |
364 int accelerated_surface_route_id_; | 343 int accelerated_surface_route_id_; |
365 | 344 |
366 // Size to use if we have no backing ContentViewCore | 345 // Size to use if we have no backing ContentViewCore |
367 gfx::Size default_size_; | 346 gfx::Size default_size_; |
368 | 347 |
369 const bool using_synchronous_compositor_; | 348 const bool using_synchronous_compositor_; |
370 | 349 |
371 scoped_ptr<DelegatedFrameEvictor> frame_evictor_; | 350 scoped_ptr<DelegatedFrameEvictor> frame_evictor_; |
372 | 351 |
373 bool using_delegated_renderer_; | |
374 | |
375 size_t locks_on_frame_count_; | 352 size_t locks_on_frame_count_; |
376 bool root_window_destroyed_; | 353 bool root_window_destroyed_; |
377 | 354 |
378 struct LastFrameInfo { | 355 struct LastFrameInfo { |
379 LastFrameInfo(uint32 output_id, | 356 LastFrameInfo(uint32 output_id, |
380 scoped_ptr<cc::CompositorFrame> output_frame); | 357 scoped_ptr<cc::CompositorFrame> output_frame); |
381 ~LastFrameInfo(); | 358 ~LastFrameInfo(); |
382 uint32 output_surface_id; | 359 uint32 output_surface_id; |
383 scoped_ptr<cc::CompositorFrame> frame; | 360 scoped_ptr<cc::CompositorFrame> frame; |
384 }; | 361 }; |
385 | 362 |
386 scoped_ptr<LastFrameInfo> last_frame_info_; | 363 scoped_ptr<LastFrameInfo> last_frame_info_; |
387 | 364 |
388 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAndroid); | 365 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAndroid); |
389 }; | 366 }; |
390 | 367 |
391 } // namespace content | 368 } // namespace content |
392 | 369 |
393 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_ | 370 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_ |
OLD | NEW |