summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorenne@chromium.org <enne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-12 22:43:41 +0000
committerenne@chromium.org <enne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-12 22:43:41 +0000
commitcd57cc5a246367c2558fefa04ae9eca8f4d545d2 (patch)
treea2235045e9c5e4ff028d641b76f5d01aa5461b26
parent3fe7ba055be580443445895c0ee01ada3b628487 (diff)
downloadchromium_src-cd57cc5a246367c2558fefa04ae9eca8f4d545d2.zip
chromium_src-cd57cc5a246367c2558fefa04ae9eca8f4d545d2.tar.gz
chromium_src-cd57cc5a246367c2558fefa04ae9eca8f4d545d2.tar.bz2
[cc] Rename all cc/ filenames to Chromium style
BUG=155413 Review URL: https://codereview.chromium.org/11122003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@161671 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--cc/BitmapCanvasLayerTextureUpdater.h57
-rw-r--r--cc/BitmapSkPictureCanvasLayerTextureUpdater.h45
-rw-r--r--cc/CCActiveAnimation.h159
-rw-r--r--cc/CCAnimationCurve.h54
-rw-r--r--cc/CCAnimationEvents.h35
-rw-r--r--cc/CCAppendQuadsData.h34
-rw-r--r--cc/CCCheckerboardDrawQuad.h31
-rw-r--r--cc/CCCompletionEvent.h62
-rw-r--r--cc/CCDamageTracker.h63
-rw-r--r--cc/CCDebugBorderDrawQuad.h33
-rw-r--r--cc/CCDebugRectHistory.h85
-rw-r--r--cc/CCDelayBasedTimeSource.h79
-rw-r--r--cc/CCDelegatedRendererLayerImpl.h48
-rw-r--r--cc/CCDirectRenderer.h103
-rw-r--r--cc/CCDrawQuad.h94
-rw-r--r--cc/CCFontAtlas.h68
-rw-r--r--cc/CCFrameRateController.h82
-rw-r--r--cc/CCFrameRateCounter.h70
-rw-r--r--cc/CCGraphicsContext.h16
-rw-r--r--cc/CCHeadsUpDisplayLayerImpl.h55
-rw-r--r--cc/CCIOSurfaceDrawQuad.h40
-rw-r--r--cc/CCIOSurfaceLayerImpl.h41
-rw-r--r--cc/CCInputHandler.h83
-rw-r--r--cc/CCKeyframedAnimationCurve.h107
-rw-r--r--cc/CCLayerAnimationController.h110
-rw-r--r--cc/CCLayerImpl.h399
-rw-r--r--cc/CCLayerIterator.h206
-rw-r--r--cc/CCLayerQuad.h106
-rw-r--r--cc/CCLayerSorter.h92
-rw-r--r--cc/CCLayerTilingData.h101
-rw-r--r--cc/CCLayerTreeHost.h297
-rw-r--r--cc/CCLayerTreeHostClient.h41
-rw-r--r--cc/CCLayerTreeHostCommon.h96
-rw-r--r--cc/CCLayerTreeHostImpl.h356
-rw-r--r--cc/CCMathUtil.h105
-rw-r--r--cc/CCOcclusionTracker.h103
-rw-r--r--cc/CCOverdrawMetrics.h95
-rw-r--r--cc/CCPageScaleAnimation.h74
-rw-r--r--cc/CCPrioritizedTexture.h140
-rw-r--r--cc/CCPrioritizedTextureManager.h157
-rw-r--r--cc/CCPriorityCalculator.h32
-rw-r--r--cc/CCProxy.h129
-rw-r--r--cc/CCQuadCuller.h35
-rw-r--r--cc/CCQuadSink.h28
-rw-r--r--cc/CCRenderPass.h140
-rw-r--r--cc/CCRenderPassDrawQuad.h51
-rw-r--r--cc/CCRenderPassSink.h18
-rw-r--r--cc/CCRenderSurface.h132
-rw-r--r--cc/CCRenderSurfaceFilters.h32
-rw-r--r--cc/CCRenderer.h82
-rw-r--r--cc/CCRendererGL.h240
-rw-r--r--cc/CCRendererSoftware.h74
-rw-r--r--cc/CCRenderingStats.h36
-rw-r--r--cc/CCResourceProvider.h273
-rw-r--r--cc/CCScheduler.h109
-rw-r--r--cc/CCSchedulerStateMachine.h161
-rw-r--r--cc/CCScopedTexture.h44
-rw-r--r--cc/CCScopedThreadProxy.h74
-rw-r--r--cc/CCScrollbarAnimationController.h62
-rw-r--r--cc/CCScrollbarAnimationControllerLinearFade.h37
-rw-r--r--cc/CCScrollbarGeometryFixedThumb.h37
-rw-r--r--cc/CCScrollbarGeometryStub.h50
-rw-r--r--cc/CCScrollbarLayerImpl.h110
-rw-r--r--cc/CCSettings.h38
-rw-r--r--cc/CCSharedQuadState.h31
-rw-r--r--cc/CCSingleThreadProxy.h134
-rw-r--r--cc/CCSolidColorDrawQuad.h31
-rw-r--r--cc/CCSolidColorLayerImpl.h32
-rw-r--r--cc/CCStreamVideoDrawQuad.h33
-rw-r--r--cc/CCTexture.h40
-rw-r--r--cc/CCTextureDrawQuad.h39
-rw-r--r--cc/CCTextureLayerImpl.h46
-rw-r--r--cc/CCTextureUpdateController.h75
-rw-r--r--cc/CCTextureUpdateQueue.h45
-rw-r--r--cc/CCThread.h43
-rw-r--r--cc/CCThreadProxy.h185
-rw-r--r--cc/CCThreadTask.h305
-rw-r--r--cc/CCTileDrawQuad.h52
-rw-r--r--cc/CCTiledLayerImpl.h62
-rw-r--r--cc/CCTimeSource.h40
-rw-r--r--cc/CCTimer.h41
-rw-r--r--cc/CCTimingFunction.h60
-rw-r--r--cc/CCVideoLayerImpl.h87
-rw-r--r--cc/CCYUVVideoDrawQuad.h34
-rw-r--r--cc/CanvasLayerTextureUpdater.h39
-rw-r--r--cc/ContentLayerChromium.h67
-rw-r--r--cc/ContentLayerChromiumClient.h22
-rw-r--r--cc/DelegatedRendererLayerChromium.h24
-rw-r--r--cc/FrameBufferSkPictureCanvasLayerTextureUpdater.h52
-rw-r--r--cc/GeometryBinding.h48
-rw-r--r--cc/HeadsUpDisplayLayerChromium.h36
-rw-r--r--cc/IOSurfaceLayerChromium.h36
-rw-r--r--cc/ImageLayerChromium.h48
-rw-r--r--cc/LayerChromium.h390
-rw-r--r--cc/LayerPainterChromium.h26
-rw-r--r--cc/LayerTextureSubImage.h46
-rw-r--r--cc/LayerTextureUpdater.h69
-rw-r--r--cc/PlatformColor.h58
-rw-r--r--cc/ProgramBinding.h84
-rw-r--r--cc/RateLimiter.h53
-rw-r--r--cc/RenderSurfaceChromium.h107
-rw-r--r--cc/ScrollbarLayerChromium.h68
-rw-r--r--cc/ShaderChromium.h353
-rw-r--r--cc/SkPictureCanvasLayerTextureUpdater.h48
-rw-r--r--cc/SolidColorLayerChromium.h31
-rw-r--r--cc/TextureCopier.h68
-rw-r--r--cc/TextureLayerChromium.h77
-rw-r--r--cc/TextureLayerChromiumClient.h29
-rw-r--r--cc/TextureUploader.h30
-rw-r--r--cc/ThrottledTextureUploader.h74
-rw-r--r--cc/TiledLayerChromium.h105
-rw-r--r--cc/TreeSynchronizer.h41
-rw-r--r--cc/UnthrottledTextureUploader.h34
-rw-r--r--cc/VideoLayerChromium.h39
-rw-r--r--cc/active_animation.cc (renamed from cc/CCActiveAnimation.cpp)0
-rw-r--r--cc/active_animation.h158
-rw-r--r--cc/animation_curve.cc (renamed from cc/CCAnimationCurve.cpp)0
-rw-r--r--cc/animation_curve.h53
-rw-r--r--cc/animation_events.h34
-rw-r--r--cc/append_quads_data.h33
-rw-r--r--cc/bitmap_canvas_layer_texture_updater.cc (renamed from cc/BitmapCanvasLayerTextureUpdater.cpp)0
-rw-r--r--cc/bitmap_canvas_layer_texture_updater.h56
-rw-r--r--cc/bitmap_skpicture_canvas_layer_texture_updater.cc (renamed from cc/BitmapSkPictureCanvasLayerTextureUpdater.cpp)0
-rw-r--r--cc/bitmap_skpicture_canvas_layer_texture_updater.h44
-rw-r--r--cc/canvas_layer_texture_updater.cc (renamed from cc/CanvasLayerTextureUpdater.cpp)0
-rw-r--r--cc/canvas_layer_texture_updater.h38
-rw-r--r--cc/cc.gyp194
-rw-r--r--cc/checkerboard_draw_quad.cc (renamed from cc/CCCheckerboardDrawQuad.cpp)0
-rw-r--r--cc/checkerboard_draw_quad.h30
-rw-r--r--cc/completion_event.h61
-rw-r--r--cc/content_layer.cc (renamed from cc/ContentLayerChromium.cpp)0
-rw-r--r--cc/content_layer.h66
-rw-r--r--cc/content_layer_client.h21
-rw-r--r--cc/damage_tracker.cc (renamed from cc/CCDamageTracker.cpp)0
-rw-r--r--cc/damage_tracker.h62
-rw-r--r--cc/debug_border_draw_quad.cc (renamed from cc/CCDebugBorderDrawQuad.cpp)0
-rw-r--r--cc/debug_border_draw_quad.h32
-rw-r--r--cc/debug_rect_history.cc (renamed from cc/CCDebugRectHistory.cpp)0
-rw-r--r--cc/debug_rect_history.h84
-rw-r--r--cc/delay_based_time_source.cc (renamed from cc/CCDelayBasedTimeSource.cpp)0
-rw-r--r--cc/delay_based_time_source.h78
-rw-r--r--cc/delegated_renderer_layer.cc (renamed from cc/DelegatedRendererLayerChromium.cpp)0
-rw-r--r--cc/delegated_renderer_layer.h23
-rw-r--r--cc/delegated_renderer_layer_impl.cc (renamed from cc/CCDelegatedRendererLayerImpl.cpp)0
-rw-r--r--cc/delegated_renderer_layer_impl.h47
-rw-r--r--cc/direct_renderer.cc (renamed from cc/CCDirectRenderer.cpp)0
-rw-r--r--cc/direct_renderer.h102
-rw-r--r--cc/draw_quad.cc (renamed from cc/CCDrawQuad.cpp)0
-rw-r--r--cc/draw_quad.h93
-rw-r--r--cc/font_atlas.cc (renamed from cc/CCFontAtlas.cpp)0
-rw-r--r--cc/font_atlas.h67
-rw-r--r--cc/frame_buffer_skpicture_canvas_layer_texture_updater.cc (renamed from cc/FrameBufferSkPictureCanvasLayerTextureUpdater.cpp)0
-rw-r--r--cc/frame_buffer_skpicture_canvas_layer_texture_updater.h51
-rw-r--r--cc/frame_rate_controller.cc (renamed from cc/CCFrameRateController.cpp)0
-rw-r--r--cc/frame_rate_controller.h81
-rw-r--r--cc/frame_rate_counter.cc (renamed from cc/CCFrameRateCounter.cpp)0
-rw-r--r--cc/frame_rate_counter.h69
-rw-r--r--cc/geometry_binding.cc (renamed from cc/GeometryBinding.cpp)0
-rw-r--r--cc/geometry_binding.h47
-rw-r--r--cc/gl_renderer.cc (renamed from cc/CCRendererGL.cpp)0
-rw-r--r--cc/gl_renderer.h239
-rw-r--r--cc/graphics_context.h15
-rw-r--r--cc/heads_up_display_layer.cc (renamed from cc/HeadsUpDisplayLayerChromium.cpp)0
-rw-r--r--cc/heads_up_display_layer.h35
-rw-r--r--cc/heads_up_display_layer_impl.cc (renamed from cc/CCHeadsUpDisplayLayerImpl.cpp)0
-rw-r--r--cc/heads_up_display_layer_impl.h54
-rw-r--r--cc/image_layer.cc (renamed from cc/ImageLayerChromium.cpp)0
-rw-r--r--cc/image_layer.h47
-rw-r--r--cc/input_handler.h82
-rw-r--r--cc/io_surface_draw_quad.cc (renamed from cc/CCIOSurfaceDrawQuad.cpp)0
-rw-r--r--cc/io_surface_draw_quad.h39
-rw-r--r--cc/io_surface_layer.cc (renamed from cc/IOSurfaceLayerChromium.cpp)0
-rw-r--r--cc/io_surface_layer.h35
-rw-r--r--cc/io_surface_layer_impl.cc (renamed from cc/CCIOSurfaceLayerImpl.cpp)0
-rw-r--r--cc/io_surface_layer_impl.h40
-rw-r--r--cc/keyframed_animation_curve.cc (renamed from cc/CCKeyframedAnimationCurve.cpp)0
-rw-r--r--cc/keyframed_animation_curve.h106
-rw-r--r--cc/layer.cc (renamed from cc/LayerChromium.cpp)0
-rw-r--r--cc/layer.h389
-rw-r--r--cc/layer_animation_controller.cc (renamed from cc/CCLayerAnimationController.cpp)0
-rw-r--r--cc/layer_animation_controller.h109
-rw-r--r--cc/layer_impl.cc (renamed from cc/CCLayerImpl.cpp)0
-rw-r--r--cc/layer_impl.h398
-rw-r--r--cc/layer_iterator.cc (renamed from cc/CCLayerIterator.cpp)0
-rw-r--r--cc/layer_iterator.h205
-rw-r--r--cc/layer_painter.h25
-rw-r--r--cc/layer_quad.cc (renamed from cc/CCLayerQuad.cpp)0
-rw-r--r--cc/layer_quad.h105
-rw-r--r--cc/layer_sorter.cc (renamed from cc/CCLayerSorter.cpp)0
-rw-r--r--cc/layer_sorter.h91
-rw-r--r--cc/layer_texture_sub_image.cc (renamed from cc/LayerTextureSubImage.cpp)0
-rw-r--r--cc/layer_texture_sub_image.h45
-rw-r--r--cc/layer_texture_updater.cc (renamed from cc/LayerTextureUpdater.cpp)0
-rw-r--r--cc/layer_texture_updater.h68
-rw-r--r--cc/layer_tiling_data.cc (renamed from cc/CCLayerTilingData.cpp)0
-rw-r--r--cc/layer_tiling_data.h100
-rw-r--r--cc/layer_tree_host.cc (renamed from cc/CCLayerTreeHost.cpp)0
-rw-r--r--cc/layer_tree_host.h296
-rw-r--r--cc/layer_tree_host_client.h40
-rw-r--r--cc/layer_tree_host_common.cc (renamed from cc/CCLayerTreeHostCommon.cpp)0
-rw-r--r--cc/layer_tree_host_common.h95
-rw-r--r--cc/layer_tree_host_impl.cc (renamed from cc/CCLayerTreeHostImpl.cpp)0
-rw-r--r--cc/layer_tree_host_impl.h355
-rw-r--r--cc/math_util.cc (renamed from cc/CCMathUtil.cpp)0
-rw-r--r--cc/math_util.h104
-rw-r--r--cc/occlusion_tracker.cc (renamed from cc/CCOcclusionTracker.cpp)0
-rw-r--r--cc/occlusion_tracker.h102
-rw-r--r--cc/overdraw_metrics.cc (renamed from cc/CCOverdrawMetrics.cpp)0
-rw-r--r--cc/overdraw_metrics.h94
-rw-r--r--cc/page_scale_animation.cc (renamed from cc/CCPageScaleAnimation.cpp)0
-rw-r--r--cc/page_scale_animation.h73
-rw-r--r--cc/platform_color.h57
-rw-r--r--cc/prioritized_texture.cc (renamed from cc/CCPrioritizedTexture.cpp)0
-rw-r--r--cc/prioritized_texture.h139
-rw-r--r--cc/prioritized_texture_manager.cc (renamed from cc/CCPrioritizedTextureManager.cpp)0
-rw-r--r--cc/prioritized_texture_manager.h156
-rw-r--r--cc/priority_calculator.cc (renamed from cc/CCPriorityCalculator.cpp)0
-rw-r--r--cc/priority_calculator.h31
-rw-r--r--cc/program_binding.cc (renamed from cc/ProgramBinding.cpp)0
-rw-r--r--cc/program_binding.h83
-rw-r--r--cc/proxy.cc (renamed from cc/CCProxy.cpp)0
-rw-r--r--cc/proxy.h128
-rw-r--r--cc/quad_culler.cc (renamed from cc/CCQuadCuller.cpp)0
-rw-r--r--cc/quad_culler.h34
-rw-r--r--cc/quad_sink.h27
-rw-r--r--cc/rate_limiter.cc (renamed from cc/RateLimiter.cpp)0
-rw-r--r--cc/rate_limiter.h52
-rw-r--r--cc/render_pass.cc (renamed from cc/CCRenderPass.cpp)0
-rw-r--r--cc/render_pass.h139
-rw-r--r--cc/render_pass_draw_quad.cc (renamed from cc/CCRenderPassDrawQuad.cpp)0
-rw-r--r--cc/render_pass_draw_quad.h50
-rw-r--r--cc/render_pass_sink.h17
-rw-r--r--cc/render_surface.cc (renamed from cc/RenderSurfaceChromium.cpp)0
-rw-r--r--cc/render_surface.h106
-rw-r--r--cc/render_surface_filters.cc (renamed from cc/CCRenderSurfaceFilters.cpp)0
-rw-r--r--cc/render_surface_filters.h31
-rw-r--r--cc/render_surface_impl.cc (renamed from cc/CCRenderSurface.cpp)0
-rw-r--r--cc/render_surface_impl.h131
-rw-r--r--cc/renderer.cc (renamed from cc/CCRenderer.cpp)0
-rw-r--r--cc/renderer.h81
-rw-r--r--cc/rendering_stats.h35
-rw-r--r--cc/resource_provider.cc (renamed from cc/CCResourceProvider.cpp)0
-rw-r--r--cc/resource_provider.h272
-rw-r--r--cc/scheduler.cc (renamed from cc/CCScheduler.cpp)0
-rw-r--r--cc/scheduler.h108
-rw-r--r--cc/scheduler_state_machine.cc (renamed from cc/CCSchedulerStateMachine.cpp)0
-rw-r--r--cc/scheduler_state_machine.h160
-rw-r--r--cc/scoped_texture.cc (renamed from cc/CCScopedTexture.cpp)0
-rw-r--r--cc/scoped_texture.h43
-rw-r--r--cc/scoped_thread_proxy.cc (renamed from cc/CCScopedThreadProxy.cpp)0
-rw-r--r--cc/scoped_thread_proxy.h73
-rw-r--r--cc/scrollbar_animation_controller.cc (renamed from cc/CCScrollbarAnimationController.cpp)0
-rw-r--r--cc/scrollbar_animation_controller.h61
-rw-r--r--cc/scrollbar_animation_controller_linear_fade.cc (renamed from cc/CCScrollbarAnimationControllerLinearFade.cpp)0
-rw-r--r--cc/scrollbar_animation_controller_linear_fade.h36
-rw-r--r--cc/scrollbar_geometry_fixed_thumb.cc (renamed from cc/CCScrollbarGeometryFixedThumb.cpp)0
-rw-r--r--cc/scrollbar_geometry_fixed_thumb.h36
-rw-r--r--cc/scrollbar_geometry_stub.cc (renamed from cc/CCScrollbarGeometryStub.cpp)0
-rw-r--r--cc/scrollbar_geometry_stub.h49
-rw-r--r--cc/scrollbar_layer.cc (renamed from cc/ScrollbarLayerChromium.cpp)0
-rw-r--r--cc/scrollbar_layer.h67
-rw-r--r--cc/scrollbar_layer_impl.cc (renamed from cc/CCScrollbarLayerImpl.cpp)0
-rw-r--r--cc/scrollbar_layer_impl.h109
-rw-r--r--cc/settings.cc (renamed from cc/CCSettings.cpp)0
-rw-r--r--cc/settings.h37
-rw-r--r--cc/shader.cc (renamed from cc/ShaderChromium.cpp)0
-rw-r--r--cc/shader.h352
-rw-r--r--cc/shared_quad_state.cc (renamed from cc/CCSharedQuadState.cpp)0
-rw-r--r--cc/shared_quad_state.h30
-rw-r--r--cc/single_thread_proxy.cc (renamed from cc/CCSingleThreadProxy.cpp)0
-rw-r--r--cc/single_thread_proxy.h133
-rw-r--r--cc/skpicture_canvas_layer_texture_updater.cc (renamed from cc/SkPictureCanvasLayerTextureUpdater.cpp)0
-rw-r--r--cc/skpicture_canvas_layer_texture_updater.h47
-rw-r--r--cc/software_renderer.cc (renamed from cc/CCRendererSoftware.cpp)0
-rw-r--r--cc/software_renderer.h73
-rw-r--r--cc/solid_color_draw_quad.cc (renamed from cc/CCSolidColorDrawQuad.cpp)0
-rw-r--r--cc/solid_color_draw_quad.h30
-rw-r--r--cc/solid_color_layer.cc (renamed from cc/SolidColorLayerChromium.cpp)0
-rw-r--r--cc/solid_color_layer.h30
-rw-r--r--cc/solid_color_layer_impl.cc (renamed from cc/CCSolidColorLayerImpl.cpp)0
-rw-r--r--cc/solid_color_layer_impl.h31
-rw-r--r--cc/stream_video_draw_quad.cc (renamed from cc/CCStreamVideoDrawQuad.cpp)0
-rw-r--r--cc/stream_video_draw_quad.h32
-rw-r--r--cc/stubs/Extensions3D.h25
-rw-r--r--cc/stubs/Extensions3DChromium.h54
-rw-r--r--cc/stubs/FloatPoint.h51
-rw-r--r--cc/stubs/FloatPoint3D.h50
-rw-r--r--cc/stubs/FloatQuad.h56
-rw-r--r--cc/stubs/FloatRect.h56
-rw-r--r--cc/stubs/FloatSize.h43
-rw-r--r--cc/stubs/GraphicsContext3D.h74
-rw-r--r--cc/stubs/GraphicsTypes3D.h18
-rw-r--r--cc/stubs/IntPoint.h40
-rw-r--r--cc/stubs/IntRect.h41
-rw-r--r--cc/stubs/IntSize.h34
-rw-r--r--cc/stubs/NotImplemented.h10
-rw-r--r--cc/stubs/SkiaUtils.h17
-rw-r--r--cc/stubs/TilingData.h18
-rw-r--r--cc/stubs/TraceEvent.h10
-rw-r--r--cc/stubs/UnitBezier.h14
-rw-r--r--cc/stubs/extensions_3d.h24
-rw-r--r--cc/stubs/extensions_3d_chromium.h53
-rw-r--r--cc/stubs/float_point.h50
-rw-r--r--cc/stubs/float_point_3d.h49
-rw-r--r--cc/stubs/float_quad.h55
-rw-r--r--cc/stubs/float_rect.h55
-rw-r--r--cc/stubs/float_size.h42
-rw-r--r--cc/stubs/graphics_context_3d.h73
-rw-r--r--cc/stubs/graphics_types_3d.h17
-rw-r--r--cc/stubs/int_point.h39
-rw-r--r--cc/stubs/int_rect.h40
-rw-r--r--cc/stubs/int_size.h33
-rw-r--r--cc/stubs/not_implemented.h9
-rw-r--r--cc/stubs/skia_utils.h16
-rw-r--r--cc/stubs/tiling_data.h17
-rw-r--r--cc/stubs/trace_event.h9
-rw-r--r--cc/stubs/unit_bezier.h13
-rw-r--r--cc/texture.cc (renamed from cc/CCTexture.cpp)0
-rw-r--r--cc/texture.h39
-rw-r--r--cc/texture_copier.cc (renamed from cc/TextureCopier.cpp)0
-rw-r--r--cc/texture_copier.h67
-rw-r--r--cc/texture_draw_quad.cc (renamed from cc/CCTextureDrawQuad.cpp)0
-rw-r--r--cc/texture_draw_quad.h38
-rw-r--r--cc/texture_layer.cc (renamed from cc/TextureLayerChromium.cpp)0
-rw-r--r--cc/texture_layer.h76
-rw-r--r--cc/texture_layer_client.h28
-rw-r--r--cc/texture_layer_impl.cc (renamed from cc/CCTextureLayerImpl.cpp)0
-rw-r--r--cc/texture_layer_impl.h45
-rw-r--r--cc/texture_update_controller.cc (renamed from cc/CCTextureUpdateController.cpp)0
-rw-r--r--cc/texture_update_controller.h74
-rw-r--r--cc/texture_update_queue.cc (renamed from cc/CCTextureUpdateQueue.cpp)0
-rw-r--r--cc/texture_update_queue.h44
-rw-r--r--cc/texture_uploader.h29
-rw-r--r--cc/thread.h42
-rw-r--r--cc/thread_proxy.cc (renamed from cc/CCThreadProxy.cpp)0
-rw-r--r--cc/thread_proxy.h184
-rw-r--r--cc/thread_task.h304
-rw-r--r--cc/throttled_texture_uploader.cc (renamed from cc/ThrottledTextureUploader.cpp)0
-rw-r--r--cc/throttled_texture_uploader.h73
-rw-r--r--cc/tile_draw_quad.cc (renamed from cc/CCTileDrawQuad.cpp)0
-rw-r--r--cc/tile_draw_quad.h51
-rw-r--r--cc/tiled_layer.cc (renamed from cc/TiledLayerChromium.cpp)0
-rw-r--r--cc/tiled_layer.h104
-rw-r--r--cc/tiled_layer_impl.cc (renamed from cc/CCTiledLayerImpl.cpp)0
-rw-r--r--cc/tiled_layer_impl.h61
-rw-r--r--cc/time_source.h39
-rw-r--r--cc/timer.cc (renamed from cc/CCTimer.cpp)0
-rw-r--r--cc/timer.h40
-rw-r--r--cc/timing_function.cc (renamed from cc/CCTimingFunction.cpp)0
-rw-r--r--cc/timing_function.h59
-rw-r--r--cc/tree_synchronizer.cc (renamed from cc/TreeSynchronizer.cpp)0
-rw-r--r--cc/tree_synchronizer.h40
-rw-r--r--cc/unthrottled_texture_uploader.cc (renamed from cc/UnthrottledTextureUploader.cpp)0
-rw-r--r--cc/unthrottled_texture_uploader.h33
-rw-r--r--cc/video_layer.cc (renamed from cc/VideoLayerChromium.cpp)0
-rw-r--r--cc/video_layer.h38
-rw-r--r--cc/video_layer_impl.cc (renamed from cc/CCVideoLayerImpl.cpp)0
-rw-r--r--cc/video_layer_impl.h86
-rw-r--r--cc/yuv_video_draw_quad.cc (renamed from cc/CCYUVVideoDrawQuad.cpp)0
-rw-r--r--cc/yuv_video_draw_quad.h33
360 files changed, 10502 insertions, 10109 deletions
diff --git a/cc/BitmapCanvasLayerTextureUpdater.h b/cc/BitmapCanvasLayerTextureUpdater.h
index 8cf4e25..bf8f6fe 100644
--- a/cc/BitmapCanvasLayerTextureUpdater.h
+++ b/cc/BitmapCanvasLayerTextureUpdater.h
@@ -1,57 +1,6 @@
-// Copyright 2011 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-
-#ifndef BitmapCanvasLayerTextureUpdater_h
-#define BitmapCanvasLayerTextureUpdater_h
-
-#if USE(ACCELERATED_COMPOSITING)
-
-#include "CanvasLayerTextureUpdater.h"
-
-class SkCanvas;
-
-namespace cc {
-
-class LayerPainterChromium;
-
-// This class rasterizes the contentRect into a skia bitmap canvas. It then updates
-// textures by copying from the canvas into the texture, using MapSubImage if
-// possible.
-class BitmapCanvasLayerTextureUpdater : public CanvasLayerTextureUpdater {
-public:
- class Texture : public LayerTextureUpdater::Texture {
- public:
- Texture(BitmapCanvasLayerTextureUpdater*, scoped_ptr<CCPrioritizedTexture>);
- virtual ~Texture();
-
- virtual void updateRect(CCResourceProvider*, const IntRect& sourceRect, const IntSize& destOffset) OVERRIDE;
-
- private:
- BitmapCanvasLayerTextureUpdater* textureUpdater() { return m_textureUpdater; }
-
- BitmapCanvasLayerTextureUpdater* m_textureUpdater;
- };
-
- static PassRefPtr<BitmapCanvasLayerTextureUpdater> create(PassOwnPtr<LayerPainterChromium>);
- virtual ~BitmapCanvasLayerTextureUpdater();
-
- virtual PassOwnPtr<LayerTextureUpdater::Texture> createTexture(CCPrioritizedTextureManager*) OVERRIDE;
- virtual SampledTexelFormat sampledTexelFormat(GC3Denum textureFormat) OVERRIDE;
- virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpaqueRect, CCRenderingStats&) OVERRIDE;
- void updateTextureRect(CCResourceProvider*, CCPrioritizedTexture*, const IntRect& sourceRect, const IntSize& destOffset);
-
- virtual void setOpaque(bool) OVERRIDE;
-
-protected:
- explicit BitmapCanvasLayerTextureUpdater(PassOwnPtr<LayerPainterChromium>);
-
- OwnPtr<SkCanvas> m_canvas;
- IntSize m_canvasSize;
- bool m_opaque;
-};
-
-} // namespace cc
-#endif // USE(ACCELERATED_COMPOSITING)
-#endif // BitmapCanvasLayerTextureUpdater_h
+// Temporary forwarding header
+#include "cc/bitmap_canvas_layer_texture_updater.h"
diff --git a/cc/BitmapSkPictureCanvasLayerTextureUpdater.h b/cc/BitmapSkPictureCanvasLayerTextureUpdater.h
index 140f9be..2e6dc44 100644
--- a/cc/BitmapSkPictureCanvasLayerTextureUpdater.h
+++ b/cc/BitmapSkPictureCanvasLayerTextureUpdater.h
@@ -1,45 +1,6 @@
-// Copyright 2011 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-
-#ifndef BitmapSkPictureCanvasLayerTextureUpdater_h
-#define BitmapSkPictureCanvasLayerTextureUpdater_h
-
-#if USE(ACCELERATED_COMPOSITING)
-#include "SkBitmap.h"
-#include "SkPictureCanvasLayerTextureUpdater.h"
-
-namespace cc {
-
-// This class records the contentRect into an SkPicture, then software rasterizes
-// the SkPicture into bitmaps for each tile. This implements CCSettings::perTilePainting.
-class BitmapSkPictureCanvasLayerTextureUpdater : public SkPictureCanvasLayerTextureUpdater {
-public:
- class Texture : public CanvasLayerTextureUpdater::Texture {
- public:
- Texture(BitmapSkPictureCanvasLayerTextureUpdater*, scoped_ptr<CCPrioritizedTexture>);
-
- virtual void prepareRect(const IntRect& sourceRect, CCRenderingStats&) OVERRIDE;
- virtual void updateRect(CCResourceProvider*, const IntRect& sourceRect, const IntSize& destOffset) OVERRIDE;
-
- private:
- BitmapSkPictureCanvasLayerTextureUpdater* textureUpdater() { return m_textureUpdater; }
-
- SkBitmap m_bitmap;
- BitmapSkPictureCanvasLayerTextureUpdater* m_textureUpdater;
- };
-
- static PassRefPtr<BitmapSkPictureCanvasLayerTextureUpdater> create(PassOwnPtr<LayerPainterChromium>);
- virtual ~BitmapSkPictureCanvasLayerTextureUpdater();
-
- virtual PassOwnPtr<LayerTextureUpdater::Texture> createTexture(CCPrioritizedTextureManager*) OVERRIDE;
- virtual SampledTexelFormat sampledTexelFormat(GC3Denum textureFormat) OVERRIDE;
- void paintContentsRect(SkCanvas*, const IntRect& sourceRect, CCRenderingStats&);
-
-private:
- explicit BitmapSkPictureCanvasLayerTextureUpdater(PassOwnPtr<LayerPainterChromium>);
-};
-} // namespace cc
-#endif // USE(ACCELERATED_COMPOSITING)
-#endif // BitmapSkPictureCanvasLayerTextureUpdater_h
+// Temporary forwarding header
+#include "cc/bitmap_skpicture_canvas_layer_texture_updater.h"
diff --git a/cc/CCActiveAnimation.h b/cc/CCActiveAnimation.h
index b8d3607..e5737a8 100644
--- a/cc/CCActiveAnimation.h
+++ b/cc/CCActiveAnimation.h
@@ -2,160 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCActiveAnimation_h
-#define CCActiveAnimation_h
-
-#include "base/basictypes.h"
-#include "base/memory/scoped_ptr.h"
-
-namespace cc {
-
-class CCAnimationCurve;
-
-// A CCActiveAnimation, contains all the state required to play a CCAnimationCurve.
-// Specifically, the affected property, the run state (paused, finished, etc.),
-// loop count, last pause time, and the total time spent paused.
-class CCActiveAnimation {
-public:
- // Animations begin in one of the 'waiting' states. Animations waiting for the next tick
- // will start the next time the controller animates. Animations waiting for target
- // availibility will run as soon as their target property is free (and all the animations
- // animating with it are also able to run). Animations waiting for their start time to
- // come have be scheduled to run at a particular point in time. When this time arrives,
- // the controller will move the animations into the Running state. Running animations
- // may toggle between Running and Paused, and may be stopped by moving into either the
- // Aborted or Finished states. A Finished animation was allowed to run to completion, but
- // an Aborted animation was not.
- enum RunState {
- WaitingForNextTick = 0,
- WaitingForTargetAvailability,
- WaitingForStartTime,
- WaitingForDeletion,
- Running,
- Paused,
- Finished,
- Aborted,
- // This sentinel must be last.
- RunStateEnumSize
- };
-
- enum TargetProperty {
- Transform = 0,
- Opacity,
- // This sentinel must be last.
- TargetPropertyEnumSize
- };
-
- static scoped_ptr<CCActiveAnimation> create(scoped_ptr<CCAnimationCurve>, int animationId, int groupId, TargetProperty);
-
- virtual ~CCActiveAnimation();
-
- int id() const { return m_id; }
- int group() const { return m_group; }
- TargetProperty targetProperty() const { return m_targetProperty; }
-
- RunState runState() const { return m_runState; }
- void setRunState(RunState, double monotonicTime);
-
- // This is the number of times that the animation will play. If this
- // value is zero the animation will not play. If it is negative, then
- // the animation will loop indefinitely.
- int iterations() const { return m_iterations; }
- void setIterations(int n) { m_iterations = n; }
-
- double startTime() const { return m_startTime; }
- void setStartTime(double monotonicTime) { m_startTime = monotonicTime; }
- bool hasSetStartTime() const { return m_startTime; }
-
- double timeOffset() const { return m_timeOffset; }
- void setTimeOffset(double monotonicTime) { m_timeOffset = monotonicTime; }
-
- void suspend(double monotonicTime);
- void resume(double monotonicTime);
-
- // If alternatesDirection is true, on odd numbered iterations we reverse the curve.
- bool alternatesDirection() const { return m_alternatesDirection; }
- void setAlternatesDirection(bool alternates) { m_alternatesDirection = alternates; }
-
- bool isFinishedAt(double monotonicTime) const;
- bool isFinished() const { return m_runState == Finished
- || m_runState == Aborted
- || m_runState == WaitingForDeletion; }
-
- CCAnimationCurve* curve() { return m_curve.get(); }
- const CCAnimationCurve* curve() const { return m_curve.get(); }
-
- // If this is true, even if the animation is running, it will not be tickable until
- // it is given a start time. This is true for animations running on the main thread.
- bool needsSynchronizedStartTime() const { return m_needsSynchronizedStartTime; }
- void setNeedsSynchronizedStartTime(bool needsSynchronizedStartTime) { m_needsSynchronizedStartTime = needsSynchronizedStartTime; }
-
- // Takes the given absolute time, and using the start time and the number
- // of iterations, returns the relative time in the current iteration.
- double trimTimeToCurrentIteration(double monotonicTime) const;
-
- enum InstanceType {
- ControllingInstance = 0,
- NonControllingInstance
- };
-
- scoped_ptr<CCActiveAnimation> clone(InstanceType) const;
- scoped_ptr<CCActiveAnimation> cloneAndInitialize(InstanceType, RunState initialRunState, double startTime) const;
- bool isControllingInstance() const { return m_isControllingInstance; }
-
- void pushPropertiesTo(CCActiveAnimation*) const;
-
-private:
- CCActiveAnimation(scoped_ptr<CCAnimationCurve>, int animationId, int groupId, TargetProperty);
-
- scoped_ptr<CCAnimationCurve> m_curve;
-
- // IDs are not necessarily unique.
- int m_id;
-
- // Animations that must be run together are called 'grouped' and have the same group id
- // Grouped animations are guaranteed to start at the same time and no other animations
- // may animate any of the group's target properties until all animations in the
- // group have finished animating. Note: an active animation's group id and target
- // property uniquely identify that animation.
- int m_group;
-
- TargetProperty m_targetProperty;
- RunState m_runState;
- int m_iterations;
- double m_startTime;
- bool m_alternatesDirection;
-
- // The time offset effectively pushes the start of the animation back in time. This is
- // used for resuming paused animations -- an animation is added with a non-zero time
- // offset, causing the animation to skip ahead to the desired point in time.
- double m_timeOffset;
-
- bool m_needsSynchronizedStartTime;
-
- // When an animation is suspended, it behaves as if it is paused and it also ignores
- // all run state changes until it is resumed. This is used for testing purposes.
- bool m_suspended;
-
- // These are used in trimTimeToCurrentIteration to account for time
- // spent while paused. This is not included in AnimationState since it
- // there is absolutely no need for clients of this controller to know
- // about these values.
- double m_pauseTime;
- double m_totalPausedTime;
-
- // Animations lead dual lives. An active animation will be conceptually owned by
- // two controllers, one on the impl thread and one on the main. In reality, there
- // will be two separate CCActiveAnimation instances for the same animation. They
- // will have the same group id and the same target property (these two values
- // uniquely identify an animation). The instance on the impl thread is the instance
- // that ultimately controls the values of the animating layer and so we will refer
- // to it as the 'controlling instance'.
- bool m_isControllingInstance;
-
- DISALLOW_COPY_AND_ASSIGN(CCActiveAnimation);
-};
-
-} // namespace cc
-
-#endif // CCActiveAnimation_h
+// Temporary forwarding header
+#include "cc/active_animation.h"
diff --git a/cc/CCAnimationCurve.h b/cc/CCAnimationCurve.h
index 7ed6e7a..71cd0fa 100644
--- a/cc/CCAnimationCurve.h
+++ b/cc/CCAnimationCurve.h
@@ -2,55 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCAnimationCurve_h
-#define CCAnimationCurve_h
-
-#include "base/memory/scoped_ptr.h"
-#include <public/WebTransformationMatrix.h>
-
-namespace cc {
-
-class CCFloatAnimationCurve;
-class CCTransformAnimationCurve;
-class IntSize;
-class TransformOperations;
-
-// An animation curve is a function that returns a value given a time.
-// There are currently only two types of curve, float and transform.
-class CCAnimationCurve {
-public:
- enum Type { Float, Transform };
-
- virtual ~CCAnimationCurve() { }
-
- virtual double duration() const = 0;
- virtual Type type() const = 0;
- virtual scoped_ptr<CCAnimationCurve> clone() const = 0;
-
- const CCFloatAnimationCurve* toFloatAnimationCurve() const;
- const CCTransformAnimationCurve* toTransformAnimationCurve() const;
-};
-
-class CCFloatAnimationCurve : public CCAnimationCurve {
-public:
- virtual ~CCFloatAnimationCurve() { }
-
- virtual float getValue(double t) const = 0;
-
- // Partial CCAnimation implementation.
- virtual Type type() const OVERRIDE;
-};
-
-class CCTransformAnimationCurve : public CCAnimationCurve {
-public:
- virtual ~CCTransformAnimationCurve() { }
-
- virtual WebKit::WebTransformationMatrix getValue(double t) const = 0;
-
- // Partial CCAnimation implementation.
- virtual Type type() const OVERRIDE;
-};
-
-} // namespace cc
-
-#endif // CCAnimation_h
+// Temporary forwarding header
+#include "cc/animation_curve.h"
diff --git a/cc/CCAnimationEvents.h b/cc/CCAnimationEvents.h
index 5e86ef7..988f56e 100644
--- a/cc/CCAnimationEvents.h
+++ b/cc/CCAnimationEvents.h
@@ -2,36 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCAnimationEvents_h
-#define CCAnimationEvents_h
-
-#include <vector>
-
-#include "CCActiveAnimation.h"
-
-namespace cc {
-
-struct CCAnimationEvent {
- enum Type { Started, Finished };
-
- CCAnimationEvent(Type type, int layerId, int groupId, CCActiveAnimation::TargetProperty targetProperty, double monotonicTime)
- : type(type)
- , layerId(layerId)
- , groupId(groupId)
- , targetProperty(targetProperty)
- , monotonicTime(monotonicTime)
- {
- }
-
- Type type;
- int layerId;
- int groupId;
- CCActiveAnimation::TargetProperty targetProperty;
- double monotonicTime;
-};
-
-typedef std::vector<CCAnimationEvent> CCAnimationEventsVector;
-
-} // namespace cc
-
-#endif // CCAnimationEvents_h
+// Temporary forwarding header
+#include "cc/animation_events.h"
diff --git a/cc/CCAppendQuadsData.h b/cc/CCAppendQuadsData.h
index b086de0..7a11591 100644
--- a/cc/CCAppendQuadsData.h
+++ b/cc/CCAppendQuadsData.h
@@ -2,35 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCAppendQuadsData_h
-#define CCAppendQuadsData_h
-
-#include "CCRenderPass.h"
-
-namespace cc {
-
-struct CCAppendQuadsData {
- CCAppendQuadsData()
- : hadOcclusionFromOutsideTargetSurface(false)
- , hadMissingTiles(false)
- , renderPassId(0, 0)
- {
- }
-
- explicit CCAppendQuadsData(CCRenderPass::Id renderPassId)
- : hadOcclusionFromOutsideTargetSurface(false)
- , hadMissingTiles(false)
- , renderPassId(renderPassId)
- {
- }
-
- // Set by the QuadCuller.
- bool hadOcclusionFromOutsideTargetSurface;
- // Set by the layer appending quads.
- bool hadMissingTiles;
- // Given to the layer appending quads.
- const CCRenderPass::Id renderPassId;
-};
-
-}
-#endif // CCCCAppendQuadsData_h
+// Temporary forwarding header
+#include "cc/append_quads_data.h"
diff --git a/cc/CCCheckerboardDrawQuad.h b/cc/CCCheckerboardDrawQuad.h
index 1ef147f..ceb42db 100644
--- a/cc/CCCheckerboardDrawQuad.h
+++ b/cc/CCCheckerboardDrawQuad.h
@@ -2,32 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCCheckerboardDrawQuad_h
-#define CCCheckerboardDrawQuad_h
-
-#include "CCDrawQuad.h"
-#include "base/memory/scoped_ptr.h"
-#include "SkColor.h"
-
-namespace cc {
-
-#pragma pack(push, 4)
-
-class CCCheckerboardDrawQuad : public CCDrawQuad {
-public:
- static scoped_ptr<CCCheckerboardDrawQuad> create(const CCSharedQuadState*, const IntRect&, SkColor);
-
- SkColor color() const { return m_color; };
-
- static const CCCheckerboardDrawQuad* materialCast(const CCDrawQuad*);
-private:
- CCCheckerboardDrawQuad(const CCSharedQuadState*, const IntRect&, SkColor);
-
- SkColor m_color;
-};
-
-#pragma pack(pop)
-
-}
-
-#endif
+// Temporary forwarding header
+#include "cc/checkerboard_draw_quad.h"
diff --git a/cc/CCCompletionEvent.h b/cc/CCCompletionEvent.h
index 462e4ba..f422075 100644
--- a/cc/CCCompletionEvent.h
+++ b/cc/CCCompletionEvent.h
@@ -1,62 +1,6 @@
-// Copyright 2011 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCCompletionEvent_h
-#define CCCompletionEvent_h
-
-#include "base/synchronization/waitable_event.h"
-
-namespace cc {
-
-// Used for making blocking calls from one thread to another. Use only when
-// absolutely certain that doing-so will not lead to a deadlock.
-//
-// It is safe to destroy this object as soon as wait() returns.
-class CCCompletionEvent {
-public:
- CCCompletionEvent()
- : m_event(false /* manual_reset */, false /* initially_signaled */)
- {
-#ifndef NDEBUG
- m_waited = false;
- m_signaled = false;
-#endif
- }
-
- ~CCCompletionEvent()
- {
- ASSERT(m_waited);
- ASSERT(m_signaled);
- }
-
- void wait()
- {
- ASSERT(!m_waited);
-#ifndef NDEBUG
- m_waited = true;
-#endif
- m_event.Wait();
- }
-
- void signal()
- {
- ASSERT(!m_signaled);
-#ifndef NDEBUG
- m_signaled = true;
-#endif
- m_event.Signal();
- }
-
-private:
- base::WaitableEvent m_event;
-#ifndef NDEBUG
- // Used to assert that wait() and signal() are each called exactly once.
- bool m_waited;
- bool m_signaled;
-#endif
-};
-
-}
-
-#endif
+// Temporary forwarding header
+#include "cc/completion_event.h"
diff --git a/cc/CCDamageTracker.h b/cc/CCDamageTracker.h
index c7550a2..5e48bc6 100644
--- a/cc/CCDamageTracker.h
+++ b/cc/CCDamageTracker.h
@@ -1,63 +1,6 @@
-// Copyright 2011 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCDamageTracker_h
-#define CCDamageTracker_h
-
-#include "base/memory/scoped_ptr.h"
-#include "FloatRect.h"
-#include <vector>
-#include <wtf/HashMap.h>
-#include <wtf/Vector.h>
-
-namespace WebKit {
-class WebFilterOperations;
-}
-
-namespace cc {
-
-class CCLayerImpl;
-class CCRenderSurface;
-
-// Computes the region where pixels have actually changed on a RenderSurface. This region is used
-// to scissor what is actually drawn to the screen to save GPU computation and bandwidth.
-class CCDamageTracker {
-public:
- static scoped_ptr<CCDamageTracker> create();
- ~CCDamageTracker();
-
- void didDrawDamagedArea() { m_currentDamageRect = FloatRect(); }
- void forceFullDamageNextUpdate() { m_forceFullDamageNextUpdate = true; }
- void updateDamageTrackingState(const std::vector<CCLayerImpl*>& layerList, int targetSurfaceLayerID, bool targetSurfacePropertyChangedOnlyFromDescendant, const IntRect& targetSurfaceContentRect, CCLayerImpl* targetSurfaceMaskLayer, const WebKit::WebFilterOperations&);
-
- const FloatRect& currentDamageRect() { return m_currentDamageRect; }
-
-private:
- CCDamageTracker();
-
- FloatRect trackDamageFromActiveLayers(const std::vector<CCLayerImpl*>& layerList, int targetSurfaceLayerID);
- FloatRect trackDamageFromSurfaceMask(CCLayerImpl* targetSurfaceMaskLayer);
- FloatRect trackDamageFromLeftoverRects();
-
- FloatRect removeRectFromCurrentFrame(int layerID, bool& layerIsNew);
- void saveRectForNextFrame(int layerID, const FloatRect& targetSpaceRect);
-
- // These helper functions are used only in trackDamageFromActiveLayers().
- void extendDamageForLayer(CCLayerImpl*, FloatRect& targetDamageRect);
- void extendDamageForRenderSurface(CCLayerImpl*, FloatRect& targetDamageRect);
-
- // To correctly track exposed regions, two hashtables of rects are maintained.
- // The "current" map is used to compute exposed regions of the current frame, while
- // the "next" map is used to collect layer rects that are used in the next frame.
- typedef HashMap<int, FloatRect> RectMap;
- scoped_ptr<RectMap> m_currentRectHistory;
- scoped_ptr<RectMap> m_nextRectHistory;
-
- FloatRect m_currentDamageRect;
- bool m_forceFullDamageNextUpdate;
-};
-
-} // namespace cc
-
-#endif // CCDamageTracker_h
+// Temporary forwarding header
+#include "cc/damage_tracker.h"
diff --git a/cc/CCDebugBorderDrawQuad.h b/cc/CCDebugBorderDrawQuad.h
index fbba1c6..3b275fa 100644
--- a/cc/CCDebugBorderDrawQuad.h
+++ b/cc/CCDebugBorderDrawQuad.h
@@ -2,34 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCDebugBorderDrawQuad_h
-#define CCDebugBorderDrawQuad_h
-
-#include "CCDrawQuad.h"
-#include "SkColor.h"
-#include "base/memory/scoped_ptr.h"
-
-namespace cc {
-
-#pragma pack(push, 4)
-
-class CCDebugBorderDrawQuad : public CCDrawQuad {
-public:
- static scoped_ptr<CCDebugBorderDrawQuad> create(const CCSharedQuadState*, const IntRect&, SkColor, int width);
-
- SkColor color() const { return m_color; };
- int width() const { return m_width; }
-
- static const CCDebugBorderDrawQuad* materialCast(const CCDrawQuad*);
-private:
- CCDebugBorderDrawQuad(const CCSharedQuadState*, const IntRect&, SkColor, int width);
-
- SkColor m_color;
- int m_width;
-};
-
-#pragma pack(pop)
-
-}
-
-#endif
+// Temporary forwarding header
+#include "cc/debug_border_draw_quad.h"
diff --git a/cc/CCDebugRectHistory.h b/cc/CCDebugRectHistory.h
index 1b03f34..690febe 100644
--- a/cc/CCDebugRectHistory.h
+++ b/cc/CCDebugRectHistory.h
@@ -2,86 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCDebugRectHistory_h
-#define CCDebugRectHistory_h
-
-#if USE(ACCELERATED_COMPOSITING)
-
-#include "base/basictypes.h"
-#include "FloatRect.h"
-#include "IntRect.h"
-#include <wtf/PassOwnPtr.h>
-#include <wtf/Vector.h>
-#include <vector>
-
-namespace cc {
-
-class CCLayerImpl;
-struct CCLayerTreeSettings;
-
-// There are currently six types of debug rects:
-//
-// - Paint rects (update rects): regions of a layer that needed to be re-uploaded to the
-// texture resource; in most cases implying that they had to be repainted, too.
-//
-// - Property-changed rects: enclosing bounds of layers that cause changes to the screen
-// even if the layer did not change internally. (For example, if the layer's opacity or
-// position changes.)
-//
-// - Surface damage rects: the aggregate damage on a target surface that is caused by all
-// layers and surfaces that contribute to it. This includes (1) paint rects, (2) property-
-// changed rects, and (3) newly exposed areas.
-//
-// - Screen space rects: this is the region the contents occupy in screen space.
-//
-// - Replica screen space rects: this is the region the replica's contents occupy in screen space.
-//
-// - Occluding rects: these are the regions that contribute to the occluded region.
-//
-enum DebugRectType { PaintRectType, PropertyChangedRectType, SurfaceDamageRectType, ScreenSpaceRectType, ReplicaScreenSpaceRectType, OccludingRectType };
-
-struct CCDebugRect {
- CCDebugRect(DebugRectType newType, FloatRect newRect)
- : type(newType)
- , rect(newRect) { }
-
- DebugRectType type;
- FloatRect rect;
-};
-
-// This class maintains a history of rects of various types that can be used
-// for debugging purposes. The overhead of collecting rects is performed only if
-// the appropriate CCLayerTreeSettings are enabled.
-class CCDebugRectHistory {
-public:
- static PassOwnPtr<CCDebugRectHistory> create()
- {
- return adoptPtr(new CCDebugRectHistory());
- }
-
- ~CCDebugRectHistory();
-
- // Note: Saving debug rects must happen before layers' change tracking is reset.
- void saveDebugRectsForCurrentFrame(CCLayerImpl* rootLayer, const std::vector<CCLayerImpl*>& renderSurfaceLayerList, const Vector<IntRect>& occludingScreenSpaceRects, const CCLayerTreeSettings&);
-
- const Vector<CCDebugRect>& debugRects() { return m_debugRects; }
-
-private:
- CCDebugRectHistory();
-
- void savePaintRects(CCLayerImpl*);
- void savePropertyChangedRects(const std::vector<CCLayerImpl*>& renderSurfaceLayerList);
- void saveSurfaceDamageRects(const std::vector<CCLayerImpl* >& renderSurfaceLayerList);
- void saveScreenSpaceRects(const std::vector<CCLayerImpl* >& renderSurfaceLayerList);
- void saveOccludingRects(const Vector<IntRect>& occludingScreenSpaceRects);
-
- Vector<CCDebugRect> m_debugRects;
-
- DISALLOW_COPY_AND_ASSIGN(CCDebugRectHistory);
-};
-
-} // namespace cc
-
-#endif // USE(ACCELERATED_COMPOSITING)
-
-#endif
+// Temporary forwarding header
+#include "cc/debug_rect_history.h"
diff --git a/cc/CCDelayBasedTimeSource.h b/cc/CCDelayBasedTimeSource.h
index bf183f7..249666c1 100644
--- a/cc/CCDelayBasedTimeSource.h
+++ b/cc/CCDelayBasedTimeSource.h
@@ -1,79 +1,6 @@
-// Copyright 2011 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCDelayBasedTimeSource_h
-#define CCDelayBasedTimeSource_h
-
-#include "CCTimeSource.h"
-#include "CCTimer.h"
-#include <wtf/PassRefPtr.h>
-
-namespace cc {
-
-class CCThread;
-
-// This timer implements a time source that achieves the specified interval
-// in face of millisecond-precision delayed callbacks and random queueing delays.
-class CCDelayBasedTimeSource : public CCTimeSource, CCTimerClient {
-public:
- static PassRefPtr<CCDelayBasedTimeSource> create(base::TimeDelta interval, CCThread*);
-
- virtual ~CCDelayBasedTimeSource();
-
- virtual void setClient(CCTimeSourceClient* client) OVERRIDE;
-
- // CCTimeSource implementation
- virtual void setTimebaseAndInterval(base::TimeTicks timebase, base::TimeDelta interval) OVERRIDE;
-
- virtual void setActive(bool) OVERRIDE;
- virtual bool active() const OVERRIDE;
-
- // Get the last and next tick times. nextTimeTime() returns null when
- // inactive.
- virtual base::TimeTicks lastTickTime() OVERRIDE;
- virtual base::TimeTicks nextTickTime() OVERRIDE;
-
- // CCTimerClient implementation.
- virtual void onTimerFired() OVERRIDE;
-
- // Virtual for testing.
- virtual base::TimeTicks now() const;
-
-protected:
- CCDelayBasedTimeSource(base::TimeDelta interval, CCThread*);
- base::TimeTicks nextTickTarget(base::TimeTicks now);
- void postNextTickTask(base::TimeTicks now);
-
- enum State {
- STATE_INACTIVE,
- STATE_STARTING,
- STATE_ACTIVE,
- };
-
- struct Parameters {
- Parameters(base::TimeDelta interval, base::TimeTicks tickTarget)
- : interval(interval), tickTarget(tickTarget)
- { }
- base::TimeDelta interval;
- base::TimeTicks tickTarget;
- };
-
- CCTimeSourceClient* m_client;
- bool m_hasTickTarget;
- base::TimeTicks m_lastTickTime;
-
- // m_currentParameters should only be written by postNextTickTask.
- // m_nextParameters will take effect on the next call to postNextTickTask.
- // Maintaining a pending set of parameters allows nextTickTime() to always
- // reflect the actual time we expect onTimerFired to be called.
- Parameters m_currentParameters;
- Parameters m_nextParameters;
-
- State m_state;
- CCThread* m_thread;
- CCTimer m_timer;
-};
-
-}
-#endif // CCDelayBasedTimeSource_h
+// Temporary forwarding header
+#include "cc/delay_based_time_source.h"
diff --git a/cc/CCDelegatedRendererLayerImpl.h b/cc/CCDelegatedRendererLayerImpl.h
index 4ed842e..08952e3 100644
--- a/cc/CCDelegatedRendererLayerImpl.h
+++ b/cc/CCDelegatedRendererLayerImpl.h
@@ -2,49 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCDelegatedRendererLayerImpl_h
-#define CCDelegatedRendererLayerImpl_h
-
-#include "CCLayerImpl.h"
-#include "cc/scoped_ptr_vector.h"
-
-namespace cc {
-
-class CCDelegatedRendererLayerImpl : public CCLayerImpl {
-public:
- static scoped_ptr<CCDelegatedRendererLayerImpl> create(int id) { return make_scoped_ptr(new CCDelegatedRendererLayerImpl(id)); }
- virtual ~CCDelegatedRendererLayerImpl();
-
- virtual bool descendantDrawsContent() OVERRIDE;
- virtual bool hasContributingDelegatedRenderPasses() const OVERRIDE;
-
- // This gives ownership of the RenderPasses to the layer.
- void setRenderPasses(ScopedPtrVector<CCRenderPass>&);
- void clearRenderPasses();
-
- virtual void didLoseContext() OVERRIDE;
-
- virtual CCRenderPass::Id firstContributingRenderPassId() const OVERRIDE;
- virtual CCRenderPass::Id nextContributingRenderPassId(CCRenderPass::Id) const OVERRIDE;
-
- void appendContributingRenderPasses(CCRenderPassSink&);
- virtual void appendQuads(CCQuadSink&, CCAppendQuadsData&) OVERRIDE;
-
-private:
- explicit CCDelegatedRendererLayerImpl(int);
-
- CCRenderPass::Id convertDelegatedRenderPassId(CCRenderPass::Id delegatedRenderPassId) const;
-
- void appendRenderPassQuads(CCQuadSink&, CCAppendQuadsData&, CCRenderPass* fromDelegatedRenderPass) const;
-
- PassOwnPtr<CCDrawQuad> createCopyOfQuad(const CCDrawQuad*);
-
- virtual const char* layerTypeAsString() const OVERRIDE;
-
- ScopedPtrVector<CCRenderPass> m_renderPassesInDrawOrder;
- base::hash_map<CCRenderPass::Id, int> m_renderPassesIndexById;
-};
-
-}
-
-#endif // CCDelegatedRendererLayerImpl_h
+// Temporary forwarding header
+#include "cc/delegated_renderer_layer_impl.h"
diff --git a/cc/CCDirectRenderer.h b/cc/CCDirectRenderer.h
index 73e6dc6..3e61292 100644
--- a/cc/CCDirectRenderer.h
+++ b/cc/CCDirectRenderer.h
@@ -2,104 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCDirectRenderer_h
-#define CCDirectRenderer_h
-
-#include "base/basictypes.h"
-#include "CCRenderer.h"
-#include "CCResourceProvider.h"
-#include "CCScopedTexture.h"
-
-namespace cc {
-
-class CCResourceProvider;
-
-// This is the base class for code shared between the GL and software
-// renderer implementations. "Direct" refers to the fact that it does not
-// delegate rendering to another compositor.
-class CCDirectRenderer : public CCRenderer {
-public:
- virtual ~CCDirectRenderer();
-
- CCResourceProvider* resourceProvider() const { return m_resourceProvider; }
-
- virtual void decideRenderPassAllocationsForFrame(const CCRenderPassList& renderPassesInDrawOrder) OVERRIDE;
- virtual bool haveCachedResourcesForRenderPassId(CCRenderPass::Id) const OVERRIDE;
- virtual void drawFrame(const CCRenderPassList& renderPassesInDrawOrder, const CCRenderPassIdHashMap& renderPassesById) OVERRIDE;
-
-protected:
- CCDirectRenderer(CCRendererClient* client, CCResourceProvider* resourceProvider);
-
- struct DrawingFrame {
- DrawingFrame();
- ~DrawingFrame();
-
- const CCRenderPassIdHashMap* renderPassesById;
- const CCRenderPass* rootRenderPass;
- const CCRenderPass* currentRenderPass;
- const CCScopedTexture* currentTexture;
-
- FloatRect rootDamageRect;
-
- WebKit::WebTransformationMatrix projectionMatrix;
- WebKit::WebTransformationMatrix windowMatrix;
- bool flippedY;
- FloatRect scissorRectInRenderPassSpace;
- };
-
- class CachedTexture : public CCScopedTexture {
- public:
- static scoped_ptr<CachedTexture> create(CCResourceProvider* resourceProvider) {
- return make_scoped_ptr(new CachedTexture(resourceProvider));
- }
- virtual ~CachedTexture() {}
-
- bool isComplete() const { return m_isComplete; }
- void setIsComplete(bool isComplete) { m_isComplete = isComplete; }
-
- protected:
- explicit CachedTexture(CCResourceProvider* resourceProvider)
- : CCScopedTexture(resourceProvider)
- , m_isComplete(false)
- {
- }
-
- private:
- bool m_isComplete;
-
- DISALLOW_COPY_AND_ASSIGN(CachedTexture);
- };
-
- static FloatRect quadVertexRect();
- static void quadRectTransform(WebKit::WebTransformationMatrix* quadRectTransform, const WebKit::WebTransformationMatrix& quadTransform, const FloatRect& quadRect);
- static void initializeMatrices(DrawingFrame&, const IntRect& drawRect, bool flipY);
- static IntRect moveScissorToWindowSpace(const DrawingFrame&, FloatRect scissorRect);
-
- bool haveCachedResources(CCRenderPass::Id) const;
- static IntSize renderPassTextureSize(const CCRenderPass*);
- static GC3Denum renderPassTextureFormat(const CCRenderPass*);
-
- void drawRenderPass(DrawingFrame&, const CCRenderPass*);
- bool useRenderPass(DrawingFrame&, const CCRenderPass*);
-
- virtual void bindFramebufferToOutputSurface(DrawingFrame&) = 0;
- virtual bool bindFramebufferToTexture(DrawingFrame&, const CCScopedTexture*, const IntRect& framebufferRect) = 0;
- virtual void setDrawViewportSize(const IntSize&) = 0;
- virtual void enableScissorTestRect(const IntRect& scissorRect) = 0;
- virtual void disableScissorTest() = 0;
- virtual void clearFramebuffer(DrawingFrame&) = 0;
- virtual void drawQuad(DrawingFrame&, const CCDrawQuad*) = 0;
- virtual void beginDrawingFrame(DrawingFrame&) = 0;
- virtual void finishDrawingFrame(DrawingFrame&) = 0;
- virtual bool flippedFramebuffer() const = 0;
-
- ScopedPtrHashMap<CCRenderPass::Id, CachedTexture> m_renderPassTextures;
- CCResourceProvider* m_resourceProvider;
-
-private:
- DISALLOW_COPY_AND_ASSIGN(CCDirectRenderer);
-};
-
-} // namespace cc
-
-#endif // CCDirectRenderer_h
+// Temporary forwarding header
+#include "cc/direct_renderer.h"
diff --git a/cc/CCDrawQuad.h b/cc/CCDrawQuad.h
index 05a6906..ca1a094 100644
--- a/cc/CCDrawQuad.h
+++ b/cc/CCDrawQuad.h
@@ -2,95 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCDrawQuad_h
-#define CCDrawQuad_h
-
-#include "CCSharedQuadState.h"
-
-namespace cc {
-
-// WARNING! All CCXYZDrawQuad classes must remain PODs (plain old data).
-// They are intended to be "serializable" by copying their raw bytes, so they
-// must not contain any non-bit-copyable member variables!
-//
-// Furthermore, the class members need to be packed so they are aligned
-// properly and don't have paddings/gaps, otherwise memory check tools
-// like Valgrind will complain about uninitialized memory usage when
-// transferring these classes over the wire.
-#pragma pack(push, 4)
-
-// CCDrawQuad is a bag of data used for drawing a quad. Because different
-// materials need different bits of per-quad data to render, classes that derive
-// from CCDrawQuad store additional data in their derived instance. The Material
-// enum is used to "safely" downcast to the derived class.
-class CCDrawQuad {
-public:
- enum Material {
- Invalid,
- Checkerboard,
- DebugBorder,
- IOSurfaceContent,
- RenderPass,
- TextureContent,
- SolidColor,
- TiledContent,
- YUVVideoContent,
- StreamVideoContent,
- };
-
- IntRect quadRect() const { return m_quadRect; }
- const WebKit::WebTransformationMatrix& quadTransform() const { return m_sharedQuadState->quadTransform; }
- IntRect visibleContentRect() const { return m_sharedQuadState->visibleContentRect; }
- IntRect clippedRectInTarget() const { return m_sharedQuadState->clippedRectInTarget; }
- float opacity() const { return m_sharedQuadState->opacity; }
- // For the purposes of blending, what part of the contents of this quad are opaque?
- IntRect opaqueRect() const;
- bool needsBlending() const { return m_needsBlending || !opaqueRect().contains(m_quadVisibleRect); }
-
- // Allows changing the rect that gets drawn to make it smaller. Parameter passed
- // in will be clipped to quadRect().
- void setQuadVisibleRect(const IntRect&);
- IntRect quadVisibleRect() const { return m_quadVisibleRect; }
- bool isDebugQuad() const { return m_material == DebugBorder; }
-
- Material material() const { return m_material; }
-
- // Returns transfer size of this object based on the derived class (by
- // looking at the material type).
- unsigned size() const;
-
- scoped_ptr<CCDrawQuad> copy(const CCSharedQuadState* copiedSharedQuadState) const;
-
- const CCSharedQuadState* sharedQuadState() const { return m_sharedQuadState; }
- int sharedQuadStateId() const { return m_sharedQuadStateId; }
- void setSharedQuadState(const CCSharedQuadState*);
-
-protected:
- CCDrawQuad(const CCSharedQuadState*, Material, const IntRect&);
-
- // Stores state common to a large bundle of quads; kept separate for memory
- // efficiency. There is special treatment to reconstruct these pointers
- // during serialization.
- const CCSharedQuadState* m_sharedQuadState;
- int m_sharedQuadStateId;
-
- Material m_material;
- IntRect m_quadRect;
- IntRect m_quadVisibleRect;
-
- // By default, the shared quad state determines whether or not this quad is
- // opaque or needs blending. Derived classes can override with these
- // variables.
- bool m_quadOpaque;
- bool m_needsBlending;
-
- // Be default, this rect is empty. It is used when the shared quad state and above
- // variables determine that the quad is not fully opaque but may be partially opaque.
- IntRect m_opaqueRect;
-};
-
-#pragma pack(pop)
-
-}
-
-#endif
+// Temporary forwarding header
+#include "cc/draw_quad.h"
diff --git a/cc/CCFontAtlas.h b/cc/CCFontAtlas.h
index 2881ee9..18463e4 100644
--- a/cc/CCFontAtlas.h
+++ b/cc/CCFontAtlas.h
@@ -2,69 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCFontAtlas_h
-#define CCFontAtlas_h
-
-#if USE(ACCELERATED_COMPOSITING)
-
-#include <string>
-
-#include "base/basictypes.h"
-#include "base/memory/scoped_ptr.h"
-#include "IntRect.h"
-#include "SkBitmap.h"
-
-class SkCanvas;
-
-namespace gfx {
-class Point;
-}
-
-namespace cc {
-
-class Color;
-class FontDescription;
-class GraphicsContext;
-class IntSize;
-
-// This class provides basic ability to draw text onto the heads-up display.
-class CCFontAtlas {
-public:
- static scoped_ptr<CCFontAtlas> create(SkBitmap bitmap, IntRect asciiToRectTable[128], int fontHeight)
- {
- return make_scoped_ptr(new CCFontAtlas(bitmap, asciiToRectTable, fontHeight));
- }
- ~CCFontAtlas();
-
- // Draws multiple lines of text where each line of text is separated by '\n'.
- // - Correct glyphs will be drawn for ASCII codes in the range 32-127; any characters
- // outside that range will be displayed as a default rectangle glyph.
- // - IntSize clip is used to avoid wasting time drawing things that are outside the
- // target canvas bounds.
- // - Should only be called only on the impl thread.
- void drawText(SkCanvas*, const SkPaint&, const std::string& text, const gfx::Point& destPosition, const IntSize& clip) const;
-
- // Draws the entire atlas at the specified position, just for debugging purposes.
- void drawDebugAtlas(SkCanvas*, const gfx::Point& destPosition) const;
-
-private:
- CCFontAtlas(SkBitmap, IntRect asciiToRectTable[128], int fontHeight);
-
- void drawOneLineOfTextInternal(SkCanvas*, const SkPaint&, const std::string&, const gfx::Point& destPosition) const;
-
- // The actual texture atlas containing all the pre-rendered glyphs.
- SkBitmap m_atlas;
-
- // The look-up tables mapping ascii characters to their IntRect locations on the atlas.
- IntRect m_asciiToRectTable[128];
-
- int m_fontHeight;
-
- DISALLOW_COPY_AND_ASSIGN(CCFontAtlas);
-};
-
-} // namespace cc
-
-#endif // USE(ACCELERATED_COMPOSITING)
-
-#endif
+// Temporary forwarding header
+#include "cc/font_atlas.h"
diff --git a/cc/CCFrameRateController.h b/cc/CCFrameRateController.h
index 2aeeae1..e8d28b53 100644
--- a/cc/CCFrameRateController.h
+++ b/cc/CCFrameRateController.h
@@ -1,82 +1,6 @@
-// Copyright 2011 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCFrameRateController_h
-#define CCFrameRateController_h
-
-#include "base/memory/scoped_ptr.h"
-#include "base/time.h"
-#include "CCTimer.h"
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefPtr.h>
-
-namespace cc {
-
-class CCThread;
-class CCTimeSource;
-
-class CCFrameRateControllerClient {
-public:
- // Throttled is true when we have a maximum number of frames pending.
- virtual void vsyncTick(bool throttled) = 0;
-
-protected:
- virtual ~CCFrameRateControllerClient() {}
-};
-
-class CCFrameRateControllerTimeSourceAdapter;
-
-class CCFrameRateController : public CCTimerClient {
-public:
- explicit CCFrameRateController(PassRefPtr<CCTimeSource>);
- // Alternate form of CCFrameRateController with unthrottled frame-rate.
- explicit CCFrameRateController(CCThread*);
- virtual ~CCFrameRateController();
-
- void setClient(CCFrameRateControllerClient* client) { m_client = client; }
-
- void setActive(bool);
-
- // Use the following methods to adjust target frame rate.
- //
- // Multiple frames can be in-progress, but for every didBeginFrame, a
- // didFinishFrame should be posted.
- //
- // If the rendering pipeline crashes, call didAbortAllPendingFrames.
- void didBeginFrame();
- void didFinishFrame();
- void didAbortAllPendingFrames();
- void setMaxFramesPending(int); // 0 for unlimited.
-
- // This returns null for unthrottled frame-rate.
- base::TimeTicks nextTickTime();
-
- void setTimebaseAndInterval(base::TimeTicks timebase, base::TimeDelta interval);
- void setSwapBuffersCompleteSupported(bool);
-
-protected:
- friend class CCFrameRateControllerTimeSourceAdapter;
- void onTimerTick();
-
- void postManualTick();
-
- // CCTimerClient implementation (used for unthrottled frame-rate).
- virtual void onTimerFired() OVERRIDE;
-
- CCFrameRateControllerClient* m_client;
- int m_numFramesPending;
- int m_maxFramesPending;
- RefPtr<CCTimeSource> m_timeSource;
- scoped_ptr<CCFrameRateControllerTimeSourceAdapter> m_timeSourceClientAdapter;
- bool m_active;
- bool m_swapBuffersCompleteSupported;
-
- // Members for unthrottled frame-rate.
- bool m_isTimeSourceThrottling;
- scoped_ptr<CCTimer> m_manualTicker;
-};
-
-} // namespace cc
-
-#endif // CCFrameRateController_h
+// Temporary forwarding header
+#include "cc/frame_rate_controller.h"
diff --git a/cc/CCFrameRateCounter.h b/cc/CCFrameRateCounter.h
index 76b4224..1a4708c 100644
--- a/cc/CCFrameRateCounter.h
+++ b/cc/CCFrameRateCounter.h
@@ -2,71 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCFrameRateCounter_h
-#define CCFrameRateCounter_h
-
-#if USE(ACCELERATED_COMPOSITING)
-
-#include "base/basictypes.h"
-#include <wtf/PassOwnPtr.h>
-
-namespace cc {
-
-// This class maintains a history of timestamps, and provides functionality to
-// intelligently compute average frames per second (and standard deviation).
-class CCFrameRateCounter {
-public:
- static PassOwnPtr<CCFrameRateCounter> create()
- {
- return adoptPtr(new CCFrameRateCounter());
- }
-
- void markBeginningOfFrame(double timestamp);
- void markEndOfFrame();
- int currentFrameNumber() const { return m_currentFrameNumber; }
- void getAverageFPSAndStandardDeviation(double& averageFPS, double& standardDeviation) const;
- int timeStampHistorySize() const { return kTimeStampHistorySize; }
-
- // n = 0 returns the oldest frame retained in the history,
- // while n = timeStampHistorySize() - 1 returns the timestamp most recent frame.
- double timeStampOfRecentFrame(int /* n */);
-
- // This is a heuristic that can be used to ignore frames in a reasonable way. Returns
- // true if the given frame interval is too fast or too slow, based on constant thresholds.
- bool isBadFrameInterval(double intervalBetweenConsecutiveFrames) const;
-
- int droppedFrameCount() const { return m_droppedFrameCount; }
-
-private:
- CCFrameRateCounter();
-
- double frameInterval(int frameNumber) const;
- int frameIndex(int frameNumber) const;
- bool isBadFrame(int frameNumber) const;
-
- // Two thresholds (measured in seconds) that describe what is considered to be a "no-op frame" that should not be counted.
- // - if the frame is too fast, then given our compositor implementation, the frame probably was a no-op and did not draw.
- // - if the frame is too slow, then there is probably not animating content, so we should not pollute the average.
- static const double kFrameTooFast;
- static const double kFrameTooSlow;
-
- // If a frame takes longer than this threshold (measured in seconds) then we
- // (naively) assume that it missed a screen refresh; that is, we dropped a frame.
- // FIXME: Determine this threshold based on monitor refresh rate, crbug.com/138642.
- static const double kDroppedFrameTime;
-
- static const int kTimeStampHistorySize = 120;
-
- int m_currentFrameNumber;
- double m_timeStampHistory[kTimeStampHistorySize];
-
- int m_droppedFrameCount;
-
- DISALLOW_COPY_AND_ASSIGN(CCFrameRateCounter);
-};
-
-} // namespace cc
-
-#endif // USE(ACCELERATED_COMPOSITING)
-
-#endif
+// Temporary forwarding header
+#include "cc/frame_rate_counter.h"
diff --git a/cc/CCGraphicsContext.h b/cc/CCGraphicsContext.h
index 6eb5b34..1193f1f 100644
--- a/cc/CCGraphicsContext.h
+++ b/cc/CCGraphicsContext.h
@@ -2,17 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCGraphicsContext_h
-#define CCGraphicsContext_h
-
-#include <public/WebCompositorOutputSurface.h>
-#include <public/WebGraphicsContext3D.h>
-
-namespace cc {
-
-// FIXME: rename fully to CCOutputSurface.
-typedef WebKit::WebCompositorOutputSurface CCGraphicsContext;
-
-} // namespace cc
-
-#endif // CCGraphicsContext_h
+// Temporary forwarding header
+#include "cc/graphics_context.h"
diff --git a/cc/CCHeadsUpDisplayLayerImpl.h b/cc/CCHeadsUpDisplayLayerImpl.h
index 47e7cfe..ec7b160 100644
--- a/cc/CCHeadsUpDisplayLayerImpl.h
+++ b/cc/CCHeadsUpDisplayLayerImpl.h
@@ -2,56 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCHeadsUpDisplayLayerImpl_h
-#define CCHeadsUpDisplayLayerImpl_h
-
-#include "base/memory/scoped_ptr.h"
-#include "CCFontAtlas.h"
-#include "CCLayerImpl.h"
-#include "CCScopedTexture.h"
-
-class SkCanvas;
-
-namespace cc {
-
-class CCDebugRectHistory;
-class CCFontAtlas;
-class CCFrameRateCounter;
-
-class CCHeadsUpDisplayLayerImpl : public CCLayerImpl {
-public:
- static scoped_ptr<CCHeadsUpDisplayLayerImpl> create(int id)
- {
- return make_scoped_ptr(new CCHeadsUpDisplayLayerImpl(id));
- }
- virtual ~CCHeadsUpDisplayLayerImpl();
-
- void setFontAtlas(scoped_ptr<CCFontAtlas>);
-
- virtual void willDraw(CCResourceProvider*) OVERRIDE;
- virtual void appendQuads(CCQuadSink&, CCAppendQuadsData&) OVERRIDE;
- void updateHudTexture(CCResourceProvider*);
- virtual void didDraw(CCResourceProvider*) OVERRIDE;
-
- virtual void didLoseContext() OVERRIDE;
-
- virtual bool layerIsAlwaysDamaged() const OVERRIDE;
-
-private:
- explicit CCHeadsUpDisplayLayerImpl(int);
-
- virtual const char* layerTypeAsString() const OVERRIDE;
-
- void drawHudContents(SkCanvas*);
- void drawFPSCounter(SkCanvas*, CCFrameRateCounter*, int top, int height);
- void drawFPSCounterText(SkCanvas*, CCFrameRateCounter*, int top, int width, int height);
- void drawDebugRects(SkCanvas*, CCDebugRectHistory*);
-
- scoped_ptr<CCFontAtlas> m_fontAtlas;
- OwnPtr<CCScopedTexture> m_hudTexture;
- OwnPtr<SkCanvas> m_hudCanvas;
-};
-
-} // namespace cc
-
-#endif // CCHeadsUpDisplayLayerImpl_h
+// Temporary forwarding header
+#include "cc/heads_up_display_layer_impl.h"
diff --git a/cc/CCIOSurfaceDrawQuad.h b/cc/CCIOSurfaceDrawQuad.h
index bb5b028..e0faa3e 100644
--- a/cc/CCIOSurfaceDrawQuad.h
+++ b/cc/CCIOSurfaceDrawQuad.h
@@ -2,41 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCIOSurfaceDrawQuad_h
-#define CCIOSurfaceDrawQuad_h
-
-#include "CCDrawQuad.h"
-#include "IntSize.h"
-#include "base/memory/scoped_ptr.h"
-
-namespace cc {
-
-#pragma pack(push, 4)
-
-class CCIOSurfaceDrawQuad : public CCDrawQuad {
-public:
- enum Orientation {
- Flipped,
- Unflipped
- };
-
- static scoped_ptr<CCIOSurfaceDrawQuad> create(const CCSharedQuadState*, const IntRect&, const IntSize& ioSurfaceSize, unsigned ioSurfaceTextureId, Orientation);
-
- IntSize ioSurfaceSize() const { return m_ioSurfaceSize; }
- unsigned ioSurfaceTextureId() const { return m_ioSurfaceTextureId; }
- Orientation orientation() const { return m_orientation; }
-
- static const CCIOSurfaceDrawQuad* materialCast(const CCDrawQuad*);
-private:
- CCIOSurfaceDrawQuad(const CCSharedQuadState*, const IntRect&, const IntSize& ioSurfaceSize, unsigned ioSurfaceTextureId, Orientation);
-
- IntSize m_ioSurfaceSize;
- unsigned m_ioSurfaceTextureId;
- Orientation m_orientation;
-};
-
-#pragma pack(pop)
-
-}
-
-#endif
+// Temporary forwarding header
+#include "cc/io_surface_draw_quad.h"
diff --git a/cc/CCIOSurfaceLayerImpl.h b/cc/CCIOSurfaceLayerImpl.h
index 238e27e..6cbf984 100644
--- a/cc/CCIOSurfaceLayerImpl.h
+++ b/cc/CCIOSurfaceLayerImpl.h
@@ -2,42 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCIOSurfaceLayerImpl_h
-#define CCIOSurfaceLayerImpl_h
-
-#include "CCLayerImpl.h"
-#include "IntSize.h"
-
-namespace cc {
-
-class CCIOSurfaceLayerImpl : public CCLayerImpl {
-public:
- static scoped_ptr<CCIOSurfaceLayerImpl> create(int id)
- {
- return make_scoped_ptr(new CCIOSurfaceLayerImpl(id));
- }
- virtual ~CCIOSurfaceLayerImpl();
-
- void setIOSurfaceProperties(unsigned ioSurfaceId, const IntSize&);
-
- virtual void appendQuads(CCQuadSink&, CCAppendQuadsData&) OVERRIDE;
-
- virtual void willDraw(CCResourceProvider*) OVERRIDE;
- virtual void didLoseContext() OVERRIDE;
-
- virtual void dumpLayerProperties(std::string*, int indent) const OVERRIDE;
-
-private:
- explicit CCIOSurfaceLayerImpl(int);
-
- virtual const char* layerTypeAsString() const OVERRIDE;
-
- unsigned m_ioSurfaceId;
- IntSize m_ioSurfaceSize;
- bool m_ioSurfaceChanged;
- unsigned m_ioSurfaceTextureId;
-};
-
-}
-
-#endif // CCIOSurfaceLayerImpl_h
+// Temporary forwarding header
+#include "cc/io_surface_layer_impl.h"
diff --git a/cc/CCInputHandler.h b/cc/CCInputHandler.h
index 7188cab..88f1b37 100644
--- a/cc/CCInputHandler.h
+++ b/cc/CCInputHandler.h
@@ -1,83 +1,6 @@
-// Copyright 2011 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCInputHandler_h
-#define CCInputHandler_h
-
-#include "base/basictypes.h"
-#include <wtf/PassOwnPtr.h>
-
-namespace cc {
-
-class IntPoint;
-class IntSize;
-
-// The CCInputHandler is a way for the embedders to interact with
-// the impl thread side of the compositor implementation.
-//
-// There is one CCInputHandler for every CCLayerTreeHost. It is
-// created on the main thread and used only on the impl thread.
-//
-// The CCInputHandler is constructed with a CCInputHandlerClient, which is the
-// interface by which the handler can manipulate the LayerTree.
-class CCInputHandlerClient {
-public:
- enum ScrollStatus { ScrollOnMainThread, ScrollStarted, ScrollIgnored };
- enum ScrollInputType { Gesture, Wheel };
-
- // Selects a layer to be scrolled at a given point in window coordinates.
- // Returns ScrollStarted if the layer at the coordinates can be scrolled,
- // ScrollOnMainThread if the scroll event should instead be delegated to the
- // main thread, or ScrollIgnored if there is nothing to be scrolled at the
- // given coordinates.
- virtual ScrollStatus scrollBegin(const IntPoint&, ScrollInputType) = 0;
-
- // Scroll the selected layer starting at the given window coordinate. If
- // there is no room to move the layer in the requested direction, its first
- // ancestor layer that can be scrolled will be moved instead. Should only be
- // called if scrollBegin() returned ScrollStarted.
- virtual void scrollBy(const IntPoint&, const IntSize&) = 0;
-
- // Stop scrolling the selected layer. Should only be called if scrollBegin()
- // returned ScrollStarted.
- virtual void scrollEnd() = 0;
-
- virtual void pinchGestureBegin() = 0;
- virtual void pinchGestureUpdate(float magnifyDelta, const IntPoint& anchor) = 0;
- virtual void pinchGestureEnd() = 0;
-
- virtual void startPageScaleAnimation(const IntSize& targetPosition,
- bool anchorPoint,
- float pageScale,
- double startTime,
- double duration) = 0;
-
- // Request another callback to CCInputHandler::animate().
- virtual void scheduleAnimation() = 0;
-
-protected:
- CCInputHandlerClient() { }
- virtual ~CCInputHandlerClient() { }
-
-private:
- DISALLOW_COPY_AND_ASSIGN(CCInputHandlerClient);
-};
-
-class CCInputHandler {
-public:
- virtual ~CCInputHandler() { }
-
- virtual void bindToClient(CCInputHandlerClient*) = 0;
- virtual void animate(double monotonicTime) = 0;
-
-protected:
- CCInputHandler() { }
-
-private:
- DISALLOW_COPY_AND_ASSIGN(CCInputHandler);
-};
-
-}
-
-#endif
+// Temporary forwarding header
+#include "cc/input_handler.h"
diff --git a/cc/CCKeyframedAnimationCurve.h b/cc/CCKeyframedAnimationCurve.h
index 066e5c6..3cd919d5 100644
--- a/cc/CCKeyframedAnimationCurve.h
+++ b/cc/CCKeyframedAnimationCurve.h
@@ -2,108 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCKeyframedAnimationCurve_h
-#define CCKeyframedAnimationCurve_h
-
-#include "CCAnimationCurve.h"
-#include "CCTimingFunction.h"
-#include "scoped_ptr_vector.h"
-#include <public/WebTransformOperations.h>
-
-namespace cc {
-
-class CCKeyframe {
-public:
- double time() const;
- const CCTimingFunction* timingFunction() const;
-
-protected:
- CCKeyframe(double time, scoped_ptr<CCTimingFunction>);
- virtual ~CCKeyframe();
-
-private:
- double m_time;
- scoped_ptr<CCTimingFunction> m_timingFunction;
-};
-
-class CCFloatKeyframe : public CCKeyframe {
-public:
- static scoped_ptr<CCFloatKeyframe> create(double time, float value, scoped_ptr<CCTimingFunction>);
- virtual ~CCFloatKeyframe();
-
- float value() const;
-
- scoped_ptr<CCFloatKeyframe> clone() const;
-
-private:
- CCFloatKeyframe(double time, float value, scoped_ptr<CCTimingFunction>);
-
- float m_value;
-};
-
-class CCTransformKeyframe : public CCKeyframe {
-public:
- static scoped_ptr<CCTransformKeyframe> create(double time, const WebKit::WebTransformOperations& value, scoped_ptr<CCTimingFunction>);
- virtual ~CCTransformKeyframe();
-
- const WebKit::WebTransformOperations& value() const;
-
- scoped_ptr<CCTransformKeyframe> clone() const;
-
-private:
- CCTransformKeyframe(double time, const WebKit::WebTransformOperations& value, scoped_ptr<CCTimingFunction>);
-
- WebKit::WebTransformOperations m_value;
-};
-
-class CCKeyframedFloatAnimationCurve : public CCFloatAnimationCurve {
-public:
- // It is required that the keyframes be sorted by time.
- static scoped_ptr<CCKeyframedFloatAnimationCurve> create();
-
- virtual ~CCKeyframedFloatAnimationCurve();
-
- void addKeyframe(scoped_ptr<CCFloatKeyframe>);
-
- // CCAnimationCurve implementation
- virtual double duration() const OVERRIDE;
- virtual scoped_ptr<CCAnimationCurve> clone() const OVERRIDE;
-
- // CCFloatAnimationCurve implementation
- virtual float getValue(double t) const OVERRIDE;
-
-private:
- CCKeyframedFloatAnimationCurve();
-
- // Always sorted in order of increasing time. No two keyframes have the
- // same time.
- ScopedPtrVector<CCFloatKeyframe> m_keyframes;
-};
-
-class CCKeyframedTransformAnimationCurve : public CCTransformAnimationCurve {
-public:
- // It is required that the keyframes be sorted by time.
- static scoped_ptr<CCKeyframedTransformAnimationCurve> create();
-
- virtual ~CCKeyframedTransformAnimationCurve();
-
- void addKeyframe(scoped_ptr<CCTransformKeyframe>);
-
- // CCAnimationCurve implementation
- virtual double duration() const OVERRIDE;
- virtual scoped_ptr<CCAnimationCurve> clone() const OVERRIDE;
-
- // CCTransformAnimationCurve implementation
- virtual WebKit::WebTransformationMatrix getValue(double t) const OVERRIDE;
-
-private:
- CCKeyframedTransformAnimationCurve();
-
- // Always sorted in order of increasing time. No two keyframes have the
- // same time.
- ScopedPtrVector<CCTransformKeyframe> m_keyframes;
-};
-
-} // namespace cc
-
-#endif // CCKeyframedAnimationCurve_h
+// Temporary forwarding header
+#include "cc/keyframed_animation_curve.h"
diff --git a/cc/CCLayerAnimationController.h b/cc/CCLayerAnimationController.h
index 2fdb91c..9f44af2 100644
--- a/cc/CCLayerAnimationController.h
+++ b/cc/CCLayerAnimationController.h
@@ -2,111 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCLayerAnimationController_h
-#define CCLayerAnimationController_h
-
-#include "CCAnimationEvents.h"
-
-#include "base/basictypes.h"
-#include "base/hash_tables.h"
-#include "base/memory/scoped_ptr.h"
-#include "cc/scoped_ptr_vector.h"
-
-namespace WebKit {
-class WebTransformationMatrix;
-}
-
-namespace cc {
-
-class Animation;
-class IntSize;
-class KeyframeValueList;
-
-class CCLayerAnimationControllerClient {
-public:
- virtual ~CCLayerAnimationControllerClient() { }
-
- virtual int id() const = 0;
- virtual void setOpacityFromAnimation(float) = 0;
- virtual float opacity() const = 0;
- virtual void setTransformFromAnimation(const WebKit::WebTransformationMatrix&) = 0;
- virtual const WebKit::WebTransformationMatrix& transform() const = 0;
-};
-
-class CCLayerAnimationController {
-public:
- static scoped_ptr<CCLayerAnimationController> create(CCLayerAnimationControllerClient*);
-
- virtual ~CCLayerAnimationController();
-
- // These methods are virtual for testing.
- virtual void addAnimation(scoped_ptr<CCActiveAnimation>);
- virtual void pauseAnimation(int animationId, double timeOffset);
- virtual void removeAnimation(int animationId);
- virtual void removeAnimation(int animationId, CCActiveAnimation::TargetProperty);
- virtual void suspendAnimations(double monotonicTime);
- virtual void resumeAnimations(double monotonicTime);
-
- // Ensures that the list of active animations on the main thread and the impl thread
- // are kept in sync. This function does not take ownership of the impl thread controller.
- virtual void pushAnimationUpdatesTo(CCLayerAnimationController*);
-
- void animate(double monotonicTime, CCAnimationEventsVector*);
-
- // Returns the active animation in the given group, animating the given property, if such an
- // animation exists.
- CCActiveAnimation* getActiveAnimation(int groupId, CCActiveAnimation::TargetProperty) const;
-
- // Returns the active animation animating the given property that is either running, or is
- // next to run, if such an animation exists.
- CCActiveAnimation* getActiveAnimation(CCActiveAnimation::TargetProperty) const;
-
- // Returns true if there are any animations that have neither finished nor aborted.
- bool hasActiveAnimation() const;
-
- // Returns true if there is an animation currently animating the given property, or
- // if there is an animation scheduled to animate this property in the future.
- bool isAnimatingProperty(CCActiveAnimation::TargetProperty) const;
-
- // This is called in response to an animation being started on the impl thread. This
- // function updates the corresponding main thread animation's start time.
- void notifyAnimationStarted(const CCAnimationEvent&);
-
- // If a sync is forced, then the next time animation updates are pushed to the impl
- // thread, all animations will be transferred.
- void setForceSync() { m_forceSync = true; }
-
- void setClient(CCLayerAnimationControllerClient*);
-
-protected:
- explicit CCLayerAnimationController(CCLayerAnimationControllerClient*);
-
-private:
- typedef base::hash_set<int> TargetProperties;
-
- void pushNewAnimationsToImplThread(CCLayerAnimationController*) const;
- void removeAnimationsCompletedOnMainThread(CCLayerAnimationController*) const;
- void pushPropertiesToImplThread(CCLayerAnimationController*) const;
- void replaceImplThreadAnimations(CCLayerAnimationController*) const;
-
- void startAnimationsWaitingForNextTick(double monotonicTime, CCAnimationEventsVector*);
- void startAnimationsWaitingForStartTime(double monotonicTime, CCAnimationEventsVector*);
- void startAnimationsWaitingForTargetAvailability(double monotonicTime, CCAnimationEventsVector*);
- void resolveConflicts(double monotonicTime);
- void markAnimationsForDeletion(double monotonicTime, CCAnimationEventsVector*);
- void purgeAnimationsMarkedForDeletion();
-
- void tickAnimations(double monotonicTime);
-
- // If this is true, we force a sync to the impl thread.
- bool m_forceSync;
-
- CCLayerAnimationControllerClient* m_client;
- ScopedPtrVector<CCActiveAnimation> m_activeAnimations;
-
- DISALLOW_COPY_AND_ASSIGN(CCLayerAnimationController);
-};
-
-} // namespace cc
-
-#endif // CCLayerAnimationController_h
+// Temporary forwarding header
+#include "cc/layer_animation_controller.h"
diff --git a/cc/CCLayerImpl.h b/cc/CCLayerImpl.h
index e34ccc8..2f36527 100644
--- a/cc/CCLayerImpl.h
+++ b/cc/CCLayerImpl.h
@@ -1,399 +1,6 @@
-// Copyright 2011 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCLayerImpl_h
-#define CCLayerImpl_h
-
-#include "base/memory/scoped_ptr.h"
-#include "cc/scoped_ptr_vector.h"
-#include "CCInputHandler.h"
-#include "CCLayerAnimationController.h"
-#include "CCRenderPass.h"
-#include "CCRenderSurface.h"
-#include "CCResourceProvider.h"
-#include "CCSharedQuadState.h"
-#include "FloatRect.h"
-#include "IntRect.h"
-#include "Region.h"
-#include "SkColor.h"
-#include <public/WebFilterOperations.h>
-#include <public/WebTransformationMatrix.h>
-#include <string>
-#include <wtf/OwnPtr.h>
-
-namespace cc {
-
-class CCLayerSorter;
-class CCLayerTreeHostImpl;
-class CCQuadSink;
-class CCRenderer;
-class CCScrollbarAnimationController;
-class CCScrollbarLayerImpl;
-class LayerChromium;
-
-struct CCAppendQuadsData;
-
-class CCLayerImpl : public CCLayerAnimationControllerClient {
-public:
- static scoped_ptr<CCLayerImpl> create(int id)
- {
- return make_scoped_ptr(new CCLayerImpl(id));
- }
-
- virtual ~CCLayerImpl();
-
- // CCLayerAnimationControllerClient implementation.
- virtual int id() const OVERRIDE;
- virtual void setOpacityFromAnimation(float) OVERRIDE;
- virtual float opacity() const OVERRIDE;
- virtual void setTransformFromAnimation(const WebKit::WebTransformationMatrix&) OVERRIDE;
- virtual const WebKit::WebTransformationMatrix& transform() const OVERRIDE;
-
- // Tree structure.
- CCLayerImpl* parent() const { return m_parent; }
- const ScopedPtrVector<CCLayerImpl>& children() const { return m_children; }
- void addChild(scoped_ptr<CCLayerImpl>);
- void removeFromParent();
- void removeAllChildren();
-
- void setMaskLayer(scoped_ptr<CCLayerImpl>);
- CCLayerImpl* maskLayer() const { return m_maskLayer.get(); }
-
- void setReplicaLayer(scoped_ptr<CCLayerImpl>);
- CCLayerImpl* replicaLayer() const { return m_replicaLayer.get(); }
-
- bool hasMask() const { return m_maskLayer; }
- bool hasReplica() const { return m_replicaLayer; }
- bool replicaHasMask() const { return m_replicaLayer && (m_maskLayer || m_replicaLayer->m_maskLayer); }
-
- CCLayerTreeHostImpl* layerTreeHostImpl() const { return m_layerTreeHostImpl; }
- void setLayerTreeHostImpl(CCLayerTreeHostImpl* hostImpl) { m_layerTreeHostImpl = hostImpl; }
-
- scoped_ptr<CCSharedQuadState> createSharedQuadState() const;
- // willDraw must be called before appendQuads. If willDraw is called,
- // didDraw is guaranteed to be called before another willDraw or before
- // the layer is destroyed. To enforce this, any class that overrides
- // willDraw/didDraw must call the base class version.
- virtual void willDraw(CCResourceProvider*);
- virtual void appendQuads(CCQuadSink&, CCAppendQuadsData&) { }
- virtual void didDraw(CCResourceProvider*);
-
- virtual CCResourceProvider::ResourceId contentsResourceId() const;
-
- virtual bool hasContributingDelegatedRenderPasses() const;
- virtual CCRenderPass::Id firstContributingRenderPassId() const;
- virtual CCRenderPass::Id nextContributingRenderPassId(CCRenderPass::Id) const;
-
- // Returns true if this layer has content to draw.
- void setDrawsContent(bool);
- bool drawsContent() const { return m_drawsContent; }
-
- bool forceRenderSurface() const { return m_forceRenderSurface; }
- void setForceRenderSurface(bool force) { m_forceRenderSurface = force; }
-
- // Returns true if any of the layer's descendants has content to draw.
- virtual bool descendantDrawsContent();
-
- void setAnchorPoint(const FloatPoint&);
- const FloatPoint& anchorPoint() const { return m_anchorPoint; }
-
- void setAnchorPointZ(float);
- float anchorPointZ() const { return m_anchorPointZ; }
-
- void setBackgroundColor(SkColor);
- SkColor backgroundColor() const { return m_backgroundColor; }
-
- void setFilters(const WebKit::WebFilterOperations&);
- const WebKit::WebFilterOperations& filters() const { return m_filters; }
-
- void setBackgroundFilters(const WebKit::WebFilterOperations&);
- const WebKit::WebFilterOperations& backgroundFilters() const { return m_backgroundFilters; }
-
- void setMasksToBounds(bool);
- bool masksToBounds() const { return m_masksToBounds; }
-
- void setContentsOpaque(bool);
- bool contentsOpaque() const { return m_contentsOpaque; }
-
- void setOpacity(float);
- bool opacityIsAnimating() const;
-
- void setPosition(const FloatPoint&);
- const FloatPoint& position() const { return m_position; }
-
- void setIsContainerForFixedPositionLayers(bool isContainerForFixedPositionLayers) { m_isContainerForFixedPositionLayers = isContainerForFixedPositionLayers; }
- bool isContainerForFixedPositionLayers() const { return m_isContainerForFixedPositionLayers; }
-
- void setFixedToContainerLayer(bool fixedToContainerLayer = true) { m_fixedToContainerLayer = fixedToContainerLayer;}
- bool fixedToContainerLayer() const { return m_fixedToContainerLayer; }
-
- void setPreserves3D(bool);
- bool preserves3D() const { return m_preserves3D; }
-
- void setUseParentBackfaceVisibility(bool useParentBackfaceVisibility) { m_useParentBackfaceVisibility = useParentBackfaceVisibility; }
- bool useParentBackfaceVisibility() const { return m_useParentBackfaceVisibility; }
-
- void setUseLCDText(bool useLCDText) { m_useLCDText = useLCDText; }
- bool useLCDText() const { return m_useLCDText; }
-
- void setSublayerTransform(const WebKit::WebTransformationMatrix&);
- const WebKit::WebTransformationMatrix& sublayerTransform() const { return m_sublayerTransform; }
-
- // Debug layer border - visual effect only, do not change geometry/clipping/etc.
- void setDebugBorderColor(SkColor);
- SkColor debugBorderColor() const { return m_debugBorderColor; }
- void setDebugBorderWidth(float);
- float debugBorderWidth() const { return m_debugBorderWidth; }
- bool hasDebugBorders() const;
-
- // Debug layer name.
- void setDebugName(const std::string& debugName) { m_debugName = debugName; }
- std::string debugName() const { return m_debugName; }
-
- CCRenderSurface* renderSurface() const { return m_renderSurface.get(); }
- void createRenderSurface();
- void clearRenderSurface() { m_renderSurface.clear(); }
-
- float drawOpacity() const { return m_drawOpacity; }
- void setDrawOpacity(float opacity) { m_drawOpacity = opacity; }
-
- bool drawOpacityIsAnimating() const { return m_drawOpacityIsAnimating; }
- void setDrawOpacityIsAnimating(bool drawOpacityIsAnimating) { m_drawOpacityIsAnimating = drawOpacityIsAnimating; }
-
- CCLayerImpl* renderTarget() const { ASSERT(!m_renderTarget || m_renderTarget->renderSurface()); return m_renderTarget; }
- void setRenderTarget(CCLayerImpl* target) { m_renderTarget = target; }
-
- void setBounds(const IntSize&);
- const IntSize& bounds() const { return m_bounds; }
-
- const IntSize& contentBounds() const { return m_contentBounds; }
- void setContentBounds(const IntSize&);
-
- const IntPoint& scrollPosition() const { return m_scrollPosition; }
- void setScrollPosition(const IntPoint&);
-
- const IntSize& maxScrollPosition() const {return m_maxScrollPosition; }
- void setMaxScrollPosition(const IntSize&);
-
- const FloatSize& scrollDelta() const { return m_scrollDelta; }
- void setScrollDelta(const FloatSize&);
-
- const WebKit::WebTransformationMatrix& implTransform() const { return m_implTransform; }
- void setImplTransform(const WebKit::WebTransformationMatrix& transform);
-
- const IntSize& sentScrollDelta() const { return m_sentScrollDelta; }
- void setSentScrollDelta(const IntSize& sentScrollDelta) { m_sentScrollDelta = sentScrollDelta; }
-
- // Returns the delta of the scroll that was outside of the bounds of the initial scroll
- FloatSize scrollBy(const FloatSize& scroll);
-
- bool scrollable() const { return m_scrollable; }
- void setScrollable(bool scrollable) { m_scrollable = scrollable; }
-
- bool shouldScrollOnMainThread() const { return m_shouldScrollOnMainThread; }
- void setShouldScrollOnMainThread(bool shouldScrollOnMainThread) { m_shouldScrollOnMainThread = shouldScrollOnMainThread; }
-
- bool haveWheelEventHandlers() const { return m_haveWheelEventHandlers; }
- void setHaveWheelEventHandlers(bool haveWheelEventHandlers) { m_haveWheelEventHandlers = haveWheelEventHandlers; }
-
- const Region& nonFastScrollableRegion() const { return m_nonFastScrollableRegion; }
- void setNonFastScrollableRegion(const Region& region) { m_nonFastScrollableRegion = region; }
-
- void setDrawCheckerboardForMissingTiles(bool checkerboard) { m_drawCheckerboardForMissingTiles = checkerboard; }
- bool drawCheckerboardForMissingTiles() const;
-
- CCInputHandlerClient::ScrollStatus tryScroll(const IntPoint& viewportPoint, CCInputHandlerClient::ScrollInputType) const;
-
- const IntRect& visibleContentRect() const { return m_visibleContentRect; }
- void setVisibleContentRect(const IntRect& visibleContentRect) { m_visibleContentRect = visibleContentRect; }
-
- bool doubleSided() const { return m_doubleSided; }
- void setDoubleSided(bool);
-
- void setTransform(const WebKit::WebTransformationMatrix&);
- bool transformIsAnimating() const;
-
- const WebKit::WebTransformationMatrix& drawTransform() const { return m_drawTransform; }
- void setDrawTransform(const WebKit::WebTransformationMatrix& matrix) { m_drawTransform = matrix; }
- const WebKit::WebTransformationMatrix& screenSpaceTransform() const { return m_screenSpaceTransform; }
- void setScreenSpaceTransform(const WebKit::WebTransformationMatrix& matrix) { m_screenSpaceTransform = matrix; }
-
- bool drawTransformIsAnimating() const { return m_drawTransformIsAnimating; }
- void setDrawTransformIsAnimating(bool animating) { m_drawTransformIsAnimating = animating; }
- bool screenSpaceTransformIsAnimating() const { return m_screenSpaceTransformIsAnimating; }
- void setScreenSpaceTransformIsAnimating(bool animating) { m_screenSpaceTransformIsAnimating = animating; }
-
- const IntRect& drawableContentRect() const { return m_drawableContentRect; }
- void setDrawableContentRect(const IntRect& rect) { m_drawableContentRect = rect; }
- const FloatRect& updateRect() const { return m_updateRect; }
- void setUpdateRect(const FloatRect& updateRect) { m_updateRect = updateRect; }
-
- std::string layerTreeAsText() const;
-
- void setStackingOrderChanged(bool);
-
- bool layerPropertyChanged() const { return m_layerPropertyChanged || layerIsAlwaysDamaged(); }
- bool layerSurfacePropertyChanged() const;
-
- void resetAllChangeTrackingForSubtree();
-
- virtual bool layerIsAlwaysDamaged() const;
-
- CCLayerAnimationController* layerAnimationController() { return m_layerAnimationController.get(); }
-
- virtual Region visibleContentOpaqueRegion() const;
-
- // Indicates that the context previously used to render this layer
- // was lost and that a new one has been created. Won't be called
- // until the new context has been created successfully.
- virtual void didLoseContext();
-
- CCScrollbarAnimationController* scrollbarAnimationController() const { return m_scrollbarAnimationController.get(); }
-
- CCScrollbarLayerImpl* horizontalScrollbarLayer() const;
- void setHorizontalScrollbarLayer(CCScrollbarLayerImpl*);
-
- CCScrollbarLayerImpl* verticalScrollbarLayer() const;
- void setVerticalScrollbarLayer(CCScrollbarLayerImpl*);
-
-protected:
- explicit CCLayerImpl(int);
-
- void appendDebugBorderQuad(CCQuadSink&, const CCSharedQuadState*, CCAppendQuadsData&) const;
-
- IntRect layerRectToContentRect(const WebKit::WebRect& layerRect);
-
- virtual void dumpLayerProperties(std::string*, int indent) const;
- static std::string indentString(int indent);
-
-private:
- void setParent(CCLayerImpl* parent) { m_parent = parent; }
- friend class TreeSynchronizer;
- void clearChildList(); // Warning: This does not preserve tree structure invariants and so is only exposed to the tree synchronizer.
-
- void noteLayerPropertyChangedForSubtree();
-
- // Note carefully this does not affect the current layer.
- void noteLayerPropertyChangedForDescendants();
-
- virtual const char* layerTypeAsString() const;
-
- void dumpLayer(std::string*, int indent) const;
-
- // Properties internal to CCLayerImpl
- CCLayerImpl* m_parent;
- ScopedPtrVector<CCLayerImpl> m_children;
- // m_maskLayer can be temporarily stolen during tree sync, we need this ID to confirm newly assigned layer is still the previous one
- int m_maskLayerId;
- scoped_ptr<CCLayerImpl> m_maskLayer;
- int m_replicaLayerId; // ditto
- scoped_ptr<CCLayerImpl> m_replicaLayer;
- int m_layerId;
- CCLayerTreeHostImpl* m_layerTreeHostImpl;
-
- // Properties synchronized from the associated LayerChromium.
- FloatPoint m_anchorPoint;
- float m_anchorPointZ;
- IntSize m_bounds;
- IntSize m_contentBounds;
- IntPoint m_scrollPosition;
- bool m_scrollable;
- bool m_shouldScrollOnMainThread;
- bool m_haveWheelEventHandlers;
- Region m_nonFastScrollableRegion;
- SkColor m_backgroundColor;
-
- // Whether the "back" of this layer should draw.
- bool m_doubleSided;
-
- // Tracks if drawing-related properties have changed since last redraw.
- bool m_layerPropertyChanged;
-
- // Indicates that a property has changed on this layer that would not
- // affect the pixels on its target surface, but would require redrawing
- // but would require redrawing the targetSurface onto its ancestor targetSurface.
- // For layers that do not own a surface this flag acts as m_layerPropertyChanged.
- bool m_layerSurfacePropertyChanged;
-
- // Uses layer's content space.
- IntRect m_visibleContentRect;
- bool m_masksToBounds;
- bool m_contentsOpaque;
- float m_opacity;
- FloatPoint m_position;
- bool m_preserves3D;
- bool m_useParentBackfaceVisibility;
- bool m_drawCheckerboardForMissingTiles;
- WebKit::WebTransformationMatrix m_sublayerTransform;
- WebKit::WebTransformationMatrix m_transform;
- bool m_useLCDText;
-
- bool m_drawsContent;
- bool m_forceRenderSurface;
-
- // Set for the layer that other layers are fixed to.
- bool m_isContainerForFixedPositionLayers;
- // This is true if the layer should be fixed to the closest ancestor container.
- bool m_fixedToContainerLayer;
-
- FloatSize m_scrollDelta;
- IntSize m_sentScrollDelta;
- IntSize m_maxScrollPosition;
- WebKit::WebTransformationMatrix m_implTransform;
-
- // The layer whose coordinate space this layer draws into. This can be
- // either the same layer (m_renderTarget == this) or an ancestor of this
- // layer.
- CCLayerImpl* m_renderTarget;
-
- // The global depth value of the center of the layer. This value is used
- // to sort layers from back to front.
- float m_drawDepth;
- float m_drawOpacity;
- bool m_drawOpacityIsAnimating;
-
- // Debug borders.
- SkColor m_debugBorderColor;
- float m_debugBorderWidth;
-
- // Debug layer name.
- std::string m_debugName;
-
- WebKit::WebFilterOperations m_filters;
- WebKit::WebFilterOperations m_backgroundFilters;
-
- WebKit::WebTransformationMatrix m_drawTransform;
- WebKit::WebTransformationMatrix m_screenSpaceTransform;
- bool m_drawTransformIsAnimating;
- bool m_screenSpaceTransformIsAnimating;
-
-#ifndef NDEBUG
- bool m_betweenWillDrawAndDidDraw;
-#endif
-
- // Render surface associated with this layer. The layer and its descendants
- // will render to this surface.
- OwnPtr<CCRenderSurface> m_renderSurface;
-
- // Hierarchical bounding rect containing the layer and its descendants.
- // Uses target surface's space.
- IntRect m_drawableContentRect;
-
- // Rect indicating what was repainted/updated during update.
- // Note that plugin layers bypass this and leave it empty.
- // Uses layer's content space.
- FloatRect m_updateRect;
-
- // Manages animations for this layer.
- scoped_ptr<CCLayerAnimationController> m_layerAnimationController;
-
- // Manages scrollbars for this layer
- OwnPtr<CCScrollbarAnimationController> m_scrollbarAnimationController;
-};
-
-void sortLayers(std::vector<CCLayerImpl*>::iterator first, std::vector<CCLayerImpl*>::iterator end, CCLayerSorter*);
-
-}
-
-#endif // CCLayerImpl_h
+// Temporary forwarding header
+#include "cc/layer_impl.h"
diff --git a/cc/CCLayerIterator.h b/cc/CCLayerIterator.h
index 4d36080..1b0f9d4 100644
--- a/cc/CCLayerIterator.h
+++ b/cc/CCLayerIterator.h
@@ -2,207 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCLayerIterator_h
-#define CCLayerIterator_h
-
-#include "CCLayerTreeHostCommon.h"
-
-#include "base/memory/ref_counted.h"
-
-namespace cc {
-
-// These classes provide means to iterate over the RenderSurface-Layer tree.
-
-// Example code follows, for a tree of LayerChromium/RenderSurfaceChromium objects. See below for details.
-//
-// void doStuffOnLayers(const std::vector<scoped_refptr<LayerChromium> >& renderSurfaceLayerList)
-// {
-// typedef CCLayerIterator<LayerChromium, RenderSurfaceChromium, CCLayerIteratorActions::FrontToBack> CCLayerIteratorType;
-//
-// CCLayerIteratorType end = CCLayerIteratorType::end(&renderSurfaceLayerList);
-// for (CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); it != end; ++it) {
-// // Only one of these will be true
-// if (it.representsTargetRenderSurface())
-// foo(*it); // *it is a layer representing a target RenderSurface
-// if (it.representsContributingRenderSurface())
-// bar(*it); // *it is a layer representing a RenderSurface that contributes to the layer's target RenderSurface
-// if (it.representsItself())
-// baz(*it); // *it is a layer representing itself, as it contributes to its own target RenderSurface
-// }
-// }
-
-// A RenderSurface R may be referred to in one of two different contexts. One RenderSurface is "current" at any time, for
-// whatever operation is being performed. This current surface is referred to as a target surface. For example, when R is
-// being painted it would be the target surface. Once R has been painted, its contents may be included into another
-// surface S. While S is considered the target surface when it is being painted, R is called a contributing surface
-// in this context as it contributes to the content of the target surface S.
-//
-// The iterator's current position in the tree always points to some layer. The state of the iterator indicates the role of the
-// layer, and will be one of the following three states. A single layer L will appear in the iteration process in at least one,
-// and possibly all, of these states.
-// 1. Representing the target surface: The iterator in this state, pointing at layer L, indicates that the target RenderSurface
-// is now the surface owned by L. This will occur exactly once for each RenderSurface in the tree.
-// 2. Representing a contributing surface: The iterator in this state, pointing at layer L, refers to the RenderSurface owned
-// by L as a contributing surface, without changing the current target RenderSurface.
-// 3. Representing itself: The iterator in this state, pointing at layer L, refers to the layer itself, as a child of the
-// current target RenderSurface.
-//
-// The BackToFront iterator will return a layer representing the target surface before returning layers representing themselves
-// as children of the current target surface. Whereas the FrontToBack ordering will iterate over children layers of a surface
-// before the layer representing the surface as a target surface.
-//
-// To use the iterators:
-//
-// Create a stepping iterator and end iterator by calling CCLayerIterator::begin() and CCLayerIterator::end() and passing in the
-// list of layers owning target RenderSurfaces. Step through the tree by incrementing the stepping iterator while it is != to
-// the end iterator. At each step the iterator knows what the layer is representing, and you can query the iterator to decide
-// what actions to perform with the layer given what it represents.
-
-//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-// Non-templated constants
-struct CCLayerIteratorValue {
- static const int InvalidTargetRenderSurfaceLayerIndex = -1;
- // This must be -1 since the iterator action code assumes that this value can be
- // reached by subtracting one from the position of the first layer in the current
- // target surface's child layer list, which is 0.
- static const int LayerIndexRepresentingTargetRenderSurface = -1;
-};
-
-// The position of a layer iterator that is independent of its many template types.
-template <typename LayerType>
-struct CCLayerIteratorPosition {
- bool representsTargetRenderSurface;
- bool representsContributingRenderSurface;
- bool representsItself;
- LayerType* targetRenderSurfaceLayer;
- LayerType* currentLayer;
-};
-
-// An iterator class for walking over layers in the RenderSurface-Layer tree.
-template <typename LayerType, typename LayerList, typename RenderSurfaceType, typename IteratorActionType>
-class CCLayerIterator {
- typedef CCLayerIterator<LayerType, LayerList, RenderSurfaceType, IteratorActionType> CCLayerIteratorType;
-
-public:
- CCLayerIterator() : m_renderSurfaceLayerList(0) { }
-
- static CCLayerIteratorType begin(const LayerList* renderSurfaceLayerList) { return CCLayerIteratorType(renderSurfaceLayerList, true); }
- static CCLayerIteratorType end(const LayerList* renderSurfaceLayerList) { return CCLayerIteratorType(renderSurfaceLayerList, false); }
-
- CCLayerIteratorType& operator++() { m_actions.next(*this); return *this; }
- bool operator==(const CCLayerIterator& other) const
- {
- return m_targetRenderSurfaceLayerIndex == other.m_targetRenderSurfaceLayerIndex
- && m_currentLayerIndex == other.m_currentLayerIndex;
- }
- bool operator!=(const CCLayerIteratorType& other) const { return !(*this == other); }
-
- LayerType* operator->() const { return currentLayer(); }
- LayerType* operator*() const { return currentLayer(); }
-
- bool representsTargetRenderSurface() const { return currentLayerRepresentsTargetRenderSurface(); }
- bool representsContributingRenderSurface() const { return !representsTargetRenderSurface() && currentLayerRepresentsContributingRenderSurface(); }
- bool representsItself() const { return !representsTargetRenderSurface() && !representsContributingRenderSurface(); }
-
- LayerType* targetRenderSurfaceLayer() const { return getRawPtr((*m_renderSurfaceLayerList)[m_targetRenderSurfaceLayerIndex]); }
-
- operator const CCLayerIteratorPosition<LayerType>() const
- {
- CCLayerIteratorPosition<LayerType> position;
- position.representsTargetRenderSurface = representsTargetRenderSurface();
- position.representsContributingRenderSurface = representsContributingRenderSurface();
- position.representsItself = representsItself();
- position.targetRenderSurfaceLayer = targetRenderSurfaceLayer();
- position.currentLayer = currentLayer();
- return position;
- }
-
-private:
- CCLayerIterator(const LayerList* renderSurfaceLayerList, bool start)
- : m_renderSurfaceLayerList(renderSurfaceLayerList)
- , m_targetRenderSurfaceLayerIndex(0)
- {
- for (size_t i = 0; i < renderSurfaceLayerList->size(); ++i) {
- if (!(*renderSurfaceLayerList)[i]->renderSurface()) {
- ASSERT_NOT_REACHED();
- m_actions.end(*this);
- return;
- }
- }
-
- if (start && !renderSurfaceLayerList->empty())
- m_actions.begin(*this);
- else
- m_actions.end(*this);
- }
-
- inline static LayerChromium* getRawPtr(const scoped_refptr<LayerChromium>& ptr) { return ptr.get(); }
- inline static CCLayerImpl* getRawPtr(CCLayerImpl* ptr) { return ptr; }
-
- inline LayerType* currentLayer() const { return currentLayerRepresentsTargetRenderSurface() ? targetRenderSurfaceLayer() : getRawPtr(targetRenderSurfaceChildren()[m_currentLayerIndex]); }
-
- inline bool currentLayerRepresentsContributingRenderSurface() const { return CCLayerTreeHostCommon::renderSurfaceContributesToTarget<LayerType>(currentLayer(), targetRenderSurfaceLayer()->id()); }
- inline bool currentLayerRepresentsTargetRenderSurface() const { return m_currentLayerIndex == CCLayerIteratorValue::LayerIndexRepresentingTargetRenderSurface; }
-
- inline RenderSurfaceType* targetRenderSurface() const { return targetRenderSurfaceLayer()->renderSurface(); }
- inline const LayerList& targetRenderSurfaceChildren() const { return targetRenderSurface()->layerList(); }
-
- IteratorActionType m_actions;
- const LayerList* m_renderSurfaceLayerList;
-
- // The iterator's current position.
-
- // A position in the renderSurfaceLayerList. This points to a layer which owns the current target surface.
- // This is a value from 0 to n-1 (n = size of renderSurfaceLayerList = number of surfaces). A value outside of
- // this range (for example, CCLayerIteratorValue::InvalidTargetRenderSurfaceLayerIndex) is used to
- // indicate a position outside the bounds of the tree.
- int m_targetRenderSurfaceLayerIndex;
- // A position in the list of layers that are children of the current target surface. When pointing to one of
- // these layers, this is a value from 0 to n-1 (n = number of children). Since the iterator must also stop at
- // the layers representing the target surface, this is done by setting the currentLayerIndex to a value of
- // CCLayerIteratorValue::LayerRepresentingTargetRenderSurface.
- int m_currentLayerIndex;
-
- friend struct CCLayerIteratorActions;
-};
-
-// Orderings for iterating over the RenderSurface-Layer tree.
-struct CCLayerIteratorActions {
- // Walks layers sorted by z-order from back to front.
- class BackToFront {
- public:
- template <typename LayerType, typename LayerList, typename RenderSurfaceType, typename ActionType>
- void begin(CCLayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>&);
-
- template <typename LayerType, typename LayerList, typename RenderSurfaceType, typename ActionType>
- void end(CCLayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>&);
-
- template <typename LayerType, typename LayerList, typename RenderSurfaceType, typename ActionType>
- void next(CCLayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>&);
-
- private:
- int m_highestTargetRenderSurfaceLayer;
- };
-
- // Walks layers sorted by z-order from front to back
- class FrontToBack {
- public:
- template <typename LayerType, typename LayerList, typename RenderSurfaceType, typename ActionType>
- void begin(CCLayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>&);
-
- template <typename LayerType, typename LayerList, typename RenderSurfaceType, typename ActionType>
- void end(CCLayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>&);
-
- template <typename LayerType, typename LayerList, typename RenderSurfaceType, typename ActionType>
- void next(CCLayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>&);
-
- private:
- template <typename LayerType, typename LayerList, typename RenderSurfaceType, typename ActionType>
- void goToHighestInSubtree(CCLayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>&);
- };
-};
-
-} // namespace cc
-
-#endif
+// Temporary forwarding header
+#include "cc/layer_iterator.h"
diff --git a/cc/CCLayerQuad.h b/cc/CCLayerQuad.h
index 8be296f..813ee03 100644
--- a/cc/CCLayerQuad.h
+++ b/cc/CCLayerQuad.h
@@ -1,106 +1,6 @@
-// Copyright 2011 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-
-#ifndef CCLayerQuad_h
-#define CCLayerQuad_h
-
-#if USE(ACCELERATED_COMPOSITING)
-
-#include "FloatPoint3D.h"
-#include "FloatQuad.h"
-
-static const float kAntiAliasingInflateDistance = 0.5f;
-
-namespace cc {
-
-class CCLayerQuad {
-public:
- class Edge {
- public:
- Edge()
- : m_x(0)
- , m_y(0)
- , m_z(0)
- {
- }
- Edge(const FloatPoint&, const FloatPoint&);
-
- float x() const { return m_x; }
- float y() const { return m_y; }
- float z() const { return m_z; }
-
- void setX(float x) { m_x = x; }
- void setY(float y) { m_y = y; }
- void setZ(float z) { m_z = z; }
- void set(float x, float y, float z)
- {
- m_x = x;
- m_y = y;
- m_z = z;
- }
-
- void moveX(float dx) { m_x += dx; }
- void moveY(float dy) { m_y += dy; }
- void moveZ(float dz) { m_z += dz; }
- void move(float dx, float dy, float dz)
- {
- m_x += dx;
- m_y += dy;
- m_z += dz;
- }
-
- void scaleX(float sx) { m_x *= sx; }
- void scaleY(float sy) { m_y *= sy; }
- void scaleZ(float sz) { m_z *= sz; }
- void scale(float sx, float sy, float sz)
- {
- m_x *= sx;
- m_y *= sy;
- m_z *= sz;
- }
- void scale(float s) { scale(s, s, s); }
-
- FloatPoint intersect(const Edge& e) const
- {
- return FloatPoint(
- (y() * e.z() - e.y() * z()) / (x() * e.y() - e.x() * y()),
- (x() * e.z() - e.x() * z()) / (e.x() * y() - x() * e.y()));
- }
-
- private:
- float m_x;
- float m_y;
- float m_z;
- };
-
- CCLayerQuad(const Edge& left, const Edge& top, const Edge& right, const Edge& bottom);
- CCLayerQuad(const FloatQuad&);
-
- Edge left() const { return m_left; }
- Edge top() const { return m_top; }
- Edge right() const { return m_right; }
- Edge bottom() const { return m_bottom; }
-
- void inflateX(float dx) { m_left.moveZ(dx); m_right.moveZ(dx); }
- void inflateY(float dy) { m_top.moveZ(dy); m_bottom.moveZ(dy); }
- void inflate(float d) { inflateX(d); inflateY(d); }
- void inflateAntiAliasingDistance() { inflate(kAntiAliasingInflateDistance); }
-
- FloatQuad floatQuad() const;
-
- void toFloatArray(float[12]) const;
-
-private:
- Edge m_left;
- Edge m_top;
- Edge m_right;
- Edge m_bottom;
-};
-
-}
-
-#endif // USE(ACCELERATED_COMPOSITING)
-
-#endif
+// Temporary forwarding header
+#include "cc/layer_quad.h"
diff --git a/cc/CCLayerSorter.h b/cc/CCLayerSorter.h
index d4ca664..a2fd49c 100644
--- a/cc/CCLayerSorter.h
+++ b/cc/CCLayerSorter.h
@@ -1,92 +1,6 @@
-// Copyright 2011 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCLayerSorter_h
-#define CCLayerSorter_h
-
-#include "base/basictypes.h"
-#include "CCLayerImpl.h"
-#include "FloatPoint3D.h"
-#include "FloatQuad.h"
-#include "FloatRect.h"
-#include <vector>
-#include <wtf/HashMap.h>
-#include <wtf/Vector.h>
-
-namespace WebKit {
-class WebTransformationMatrix;
-}
-
-namespace cc {
-
-class CCLayerSorter {
-public:
- CCLayerSorter();
- ~CCLayerSorter();
-
- typedef std::vector<CCLayerImpl*> LayerList;
-
- void sort(LayerList::iterator first, LayerList::iterator last);
-
- // Holds various useful properties derived from a layer's 3D outline.
- struct LayerShape {
- LayerShape();
- LayerShape(float width, float height, const WebKit::WebTransformationMatrix& drawTransform);
-
- float layerZFromProjectedPoint(const FloatPoint&) const;
-
- FloatPoint3D layerNormal;
- FloatPoint3D transformOrigin;
- FloatQuad projectedQuad;
- FloatRect projectedBounds;
- };
-
- enum ABCompareResult {
- ABeforeB,
- BBeforeA,
- None
- };
-
- static ABCompareResult checkOverlap(LayerShape*, LayerShape*, float zThreshold, float& weight);
-
-private:
- struct GraphEdge;
-
- struct GraphNode {
- explicit GraphNode(CCLayerImpl* cclayer);
- ~GraphNode();
-
- CCLayerImpl* layer;
- LayerShape shape;
- Vector<GraphEdge*> incoming;
- Vector<GraphEdge*> outgoing;
- float incomingEdgeWeight;
- };
-
- struct GraphEdge {
- GraphEdge(GraphNode* fromNode, GraphNode* toNode, float weight) : from(fromNode), to(toNode), weight(weight) { };
-
- GraphNode* from;
- GraphNode* to;
- float weight;
- };
-
- typedef Vector<GraphNode> NodeList;
- typedef Vector<GraphEdge> EdgeList;
- NodeList m_nodes;
- EdgeList m_edges;
- float m_zRange;
-
- typedef HashMap<GraphEdge*, GraphEdge*> EdgeMap;
- EdgeMap m_activeEdges;
-
- void createGraphNodes(LayerList::iterator first, LayerList::iterator last);
- void createGraphEdges();
- void removeEdgeFromList(GraphEdge*, Vector<GraphEdge*>&);
-
- DISALLOW_COPY_AND_ASSIGN(CCLayerSorter);
-};
-
-}
-#endif
+// Temporary forwarding header
+#include "cc/layer_sorter.h"
diff --git a/cc/CCLayerTilingData.h b/cc/CCLayerTilingData.h
index c73f057..2883037 100644
--- a/cc/CCLayerTilingData.h
+++ b/cc/CCLayerTilingData.h
@@ -1,101 +1,6 @@
-// Copyright 2011 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-
-#ifndef CCLayerTilingData_h
-#define CCLayerTilingData_h
-
-#if USE(ACCELERATED_COMPOSITING)
-
-#include "base/basictypes.h"
-#include "IntRect.h"
-#include "Region.h"
-#include "TilingData.h"
-#include <wtf/HashMap.h>
-#include <wtf/HashTraits.h>
-#include <wtf/PassOwnPtr.h>
-
-namespace cc {
-
-class CCLayerTilingData {
-public:
- enum BorderTexelOption { HasBorderTexels, NoBorderTexels };
-
- ~CCLayerTilingData();
-
- static PassOwnPtr<CCLayerTilingData> create(const IntSize& tileSize, BorderTexelOption);
-
- bool hasEmptyBounds() const { return m_tilingData.hasEmptyBounds(); }
- int numTilesX() const { return m_tilingData.numTilesX(); }
- int numTilesY() const { return m_tilingData.numTilesY(); }
- IntRect tileBounds(int i, int j) const { return m_tilingData.tileBounds(i, j); }
- IntPoint textureOffset(int xIndex, int yIndex) const { return m_tilingData.textureOffset(xIndex, yIndex); }
-
- // Change the tile size. This may invalidate all the existing tiles.
- void setTileSize(const IntSize&);
- IntSize tileSize() const;
- // Change the border texel setting. This may invalidate all existing tiles.
- void setBorderTexelOption(BorderTexelOption);
- bool hasBorderTexels() const { return m_tilingData.borderTexels(); }
-
- bool isEmpty() const { return hasEmptyBounds() || !tiles().size(); }
-
- const CCLayerTilingData& operator=(const CCLayerTilingData&);
-
- class Tile {
- public:
- Tile() : m_i(-1), m_j(-1) { }
- virtual ~Tile() { }
-
- int i() const { return m_i; }
- int j() const { return m_j; }
- void moveTo(int i, int j) { m_i = i; m_j = j; }
-
- const IntRect& opaqueRect() const { return m_opaqueRect; }
- void setOpaqueRect(const IntRect& opaqueRect) { m_opaqueRect = opaqueRect; }
- private:
- int m_i;
- int m_j;
- IntRect m_opaqueRect;
- DISALLOW_COPY_AND_ASSIGN(Tile);
- };
- // Default hash key traits for integers disallow 0 and -1 as a key, so
- // use a custom hash trait which disallows -1 and -2 instead.
- typedef std::pair<int, int> TileMapKey;
- struct TileMapKeyTraits : HashTraits<TileMapKey> {
- static const bool emptyValueIsZero = false;
- static const bool needsDestruction = false;
- static TileMapKey emptyValue() { return std::make_pair(-1, -1); }
- static void constructDeletedValue(TileMapKey& slot) { slot = std::make_pair(-2, -2); }
- static bool isDeletedValue(TileMapKey value) { return value.first == -2 && value.second == -2; }
- };
- typedef HashMap<TileMapKey, OwnPtr<Tile>, DefaultHash<TileMapKey>::Hash, TileMapKeyTraits> TileMap;
-
- void addTile(PassOwnPtr<Tile>, int, int);
- PassOwnPtr<Tile> takeTile(int, int);
- Tile* tileAt(int, int) const;
- const TileMap& tiles() const { return m_tiles; }
-
- void setBounds(const IntSize&);
- IntSize bounds() const;
-
- void contentRectToTileIndices(const IntRect&, int &left, int &top, int &right, int &bottom) const;
- IntRect tileRect(const Tile*) const;
-
- Region opaqueRegionInContentRect(const IntRect&) const;
-
- void reset();
-
-protected:
- CCLayerTilingData(const IntSize& tileSize, BorderTexelOption);
-
- TileMap m_tiles;
- TilingData m_tilingData;
-};
-
-}
-
-#endif // USE(ACCELERATED_COMPOSITING)
-
-#endif
+// Temporary forwarding header
+#include "cc/layer_tiling_data.h"
diff --git a/cc/CCLayerTreeHost.h b/cc/CCLayerTreeHost.h
index 277b1f0..e82fc46 100644
--- a/cc/CCLayerTreeHost.h
+++ b/cc/CCLayerTreeHost.h
@@ -1,297 +1,6 @@
-// Copyright 2011 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCLayerTreeHost_h
-#define CCLayerTreeHost_h
-
-#include "base/basictypes.h"
-#include "base/hash_tables.h"
-#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
-#include "CCAnimationEvents.h"
-#include "CCGraphicsContext.h"
-#include "CCLayerTreeHostClient.h"
-#include "CCLayerTreeHostCommon.h"
-#include "CCOcclusionTracker.h"
-#include "CCPrioritizedTextureManager.h"
-#include "CCProxy.h"
-#include "CCRenderingStats.h"
-#include "IntRect.h"
-#include "RateLimiter.h"
-#include "scoped_ptr_vector.h"
-#include "SkColor.h"
-#include <limits>
-
-#if defined(COMPILER_GCC)
-namespace BASE_HASH_NAMESPACE {
-template<>
-struct hash<WebKit::WebGraphicsContext3D*> {
- size_t operator()(WebKit::WebGraphicsContext3D* ptr) const {
- return hash<size_t>()(reinterpret_cast<size_t>(ptr));
- }
-};
-} // namespace BASE_HASH_NAMESPACE
-#endif // COMPILER
-
-namespace cc {
-
-class CCFontAtlas;
-class CCLayerChromium;
-class CCLayerTreeHostImpl;
-class CCLayerTreeHostImplClient;
-class CCPrioritizedTextureManager;
-class CCTextureUpdateQueue;
-class HeadsUpDisplayLayerChromium;
-class Region;
-struct CCScrollAndScaleSet;
-
-struct CCLayerTreeSettings {
- CCLayerTreeSettings();
- ~CCLayerTreeSettings();
-
- bool acceleratePainting;
- bool showFPSCounter;
- bool showPlatformLayerTree;
- bool showPaintRects;
- bool showPropertyChangedRects;
- bool showSurfaceDamageRects;
- bool showScreenSpaceRects;
- bool showReplicaScreenSpaceRects;
- bool showOccludingRects;
- bool renderVSyncEnabled;
- double refreshRate;
- size_t maxPartialTextureUpdates;
- IntSize defaultTileSize;
- IntSize maxUntiledLayerSize;
- IntSize minimumOcclusionTrackingSize;
-
- bool showDebugInfo() const { return showPlatformLayerTree || showFPSCounter || showDebugRects(); }
- bool showDebugRects() const { return showPaintRects || showPropertyChangedRects || showSurfaceDamageRects || showScreenSpaceRects || showReplicaScreenSpaceRects || showOccludingRects; }
-};
-
-// Provides information on an Impl's rendering capabilities back to the CCLayerTreeHost
-struct RendererCapabilities {
- RendererCapabilities();
- ~RendererCapabilities();
-
- GC3Denum bestTextureFormat;
- bool contextHasCachedFrontBuffer;
- bool usingPartialSwap;
- bool usingAcceleratedPainting;
- bool usingSetVisibility;
- bool usingSwapCompleteCallback;
- bool usingGpuMemoryManager;
- bool usingDiscardFramebuffer;
- bool usingEglImage;
- int maxTextureSize;
-};
-
-class CCLayerTreeHost : public RateLimiterClient {
-public:
- static scoped_ptr<CCLayerTreeHost> create(CCLayerTreeHostClient*, const CCLayerTreeSettings&);
- virtual ~CCLayerTreeHost();
-
- void setSurfaceReady();
-
- // Returns true if any CCLayerTreeHost is alive.
- static bool anyLayerTreeHostInstanceExists();
-
- static bool needsFilterContext() { return s_needsFilterContext; }
- static void setNeedsFilterContext(bool needsFilterContext) { s_needsFilterContext = needsFilterContext; }
- bool needsSharedContext() const { return needsFilterContext() || settings().acceleratePainting; }
-
- // CCLayerTreeHost interface to CCProxy.
- void willBeginFrame() { m_client->willBeginFrame(); }
- void didBeginFrame() { m_client->didBeginFrame(); }
- void updateAnimations(double monotonicFrameBeginTime);
- void layout();
- void beginCommitOnImplThread(CCLayerTreeHostImpl*);
- void finishCommitOnImplThread(CCLayerTreeHostImpl*);
- void willCommit();
- void commitComplete();
- scoped_ptr<CCGraphicsContext> createContext();
- scoped_ptr<CCInputHandler> createInputHandler();
- virtual scoped_ptr<CCLayerTreeHostImpl> createLayerTreeHostImpl(CCLayerTreeHostImplClient*);
- void didLoseContext();
- enum RecreateResult {
- RecreateSucceeded,
- RecreateFailedButTryAgain,
- RecreateFailedAndGaveUp,
- };
- RecreateResult recreateContext();
- void didCommitAndDrawFrame() { m_client->didCommitAndDrawFrame(); }
- void didCompleteSwapBuffers() { m_client->didCompleteSwapBuffers(); }
- void deleteContentsTexturesOnImplThread(CCResourceProvider*);
- virtual void acquireLayerTextures();
- // Returns false if we should abort this frame due to initialization failure.
- bool initializeRendererIfNeeded();
- void updateLayers(CCTextureUpdateQueue&, size_t contentsMemoryLimitBytes);
-
- CCLayerTreeHostClient* client() { return m_client; }
-
- // Only used when compositing on the main thread.
- void composite();
- void scheduleComposite();
-
- // Composites and attempts to read back the result into the provided
- // buffer. If it wasn't possible, e.g. due to context lost, will return
- // false.
- bool compositeAndReadback(void *pixels, const IntRect&);
-
- void finishAllRendering();
-
- int commitNumber() const { return m_commitNumber; }
-
- void renderingStats(CCRenderingStats*) const;
-
- const RendererCapabilities& rendererCapabilities() const;
-
- // Test only hook
- void loseContext(int numTimes);
-
- void setNeedsAnimate();
- // virtual for testing
- virtual void setNeedsCommit();
- void setNeedsRedraw();
- bool commitRequested() const;
-
- void setAnimationEvents(scoped_ptr<CCAnimationEventsVector>, double wallClockTime);
- virtual void didAddAnimation();
-
- LayerChromium* rootLayer() { return m_rootLayer.get(); }
- const LayerChromium* rootLayer() const { return m_rootLayer.get(); }
- void setRootLayer(scoped_refptr<LayerChromium>);
-
- const CCLayerTreeSettings& settings() const { return m_settings; }
-
- void setViewportSize(const IntSize& layoutViewportSize, const IntSize& deviceViewportSize);
-
- const IntSize& layoutViewportSize() const { return m_layoutViewportSize; }
- const IntSize& deviceViewportSize() const { return m_deviceViewportSize; }
-
- void setPageScaleFactorAndLimits(float pageScaleFactor, float minPageScaleFactor, float maxPageScaleFactor);
-
- void setBackgroundColor(SkColor color) { m_backgroundColor = color; }
-
- void setHasTransparentBackground(bool transparent) { m_hasTransparentBackground = transparent; }
-
- CCPrioritizedTextureManager* contentsTextureManager() const;
-
- // Delete contents textures' backing resources until they use only bytesLimit bytes. This may
- // be called on the impl thread while the main thread is running.
- void reduceContentsTexturesMemoryOnImplThread(size_t bytesLimit, CCResourceProvider*);
- // Returns true if there any evicted backing textures that have not been deleted.
- bool evictedContentsTexturesBackingsExist() const;
- // Retrieve the list of all contents textures' backings that have been evicted, to pass to the
- // main thread to unlink them from their owning textures.
- void getEvictedContentTexturesBackings(CCPrioritizedTextureManager::BackingVector&);
- // Unlink the list of contents textures' backings from their owning textures on the main thread
- // before updating layers.
- void unlinkEvictedContentTexturesBackings(const CCPrioritizedTextureManager::BackingVector&);
- // Deletes all evicted backings, unlinking them from their owning textures if needed.
- // Returns true if this function had to unlink any backings from their owning texture when
- // destroying them. If this was the case, the impl layer tree may contain invalid resources.
- bool deleteEvictedContentTexturesBackings();
-
- bool visible() const { return m_visible; }
- void setVisible(bool);
-
- void startPageScaleAnimation(const IntSize& targetPosition, bool useAnchor, float scale, double durationSec);
-
- void applyScrollAndScale(const CCScrollAndScaleSet&);
- void setImplTransform(const WebKit::WebTransformationMatrix&);
-
- void startRateLimiter(WebKit::WebGraphicsContext3D*);
- void stopRateLimiter(WebKit::WebGraphicsContext3D*);
-
- // RateLimitClient implementation
- virtual void rateLimit() OVERRIDE;
-
- bool bufferedUpdates();
- bool requestPartialTextureUpdate();
- void deleteTextureAfterCommit(scoped_ptr<CCPrioritizedTexture>);
-
- void setDeviceScaleFactor(float);
- float deviceScaleFactor() const { return m_deviceScaleFactor; }
-
- void setFontAtlas(scoped_ptr<CCFontAtlas>);
-
- HeadsUpDisplayLayerChromium* hudLayer() const { return m_hudLayer.get(); }
-
-protected:
- CCLayerTreeHost(CCLayerTreeHostClient*, const CCLayerTreeSettings&);
- bool initialize();
-
-private:
- typedef std::vector<scoped_refptr<LayerChromium> > LayerList;
-
- void initializeRenderer();
-
- void update(LayerChromium*, CCTextureUpdateQueue&, const CCOcclusionTracker*);
- bool paintLayerContents(const LayerList&, CCTextureUpdateQueue&);
- bool paintMasksForRenderSurface(LayerChromium*, CCTextureUpdateQueue&);
-
- void updateLayers(LayerChromium*, CCTextureUpdateQueue&);
-
- void prioritizeTextures(const LayerList&, CCOverdrawMetrics&);
- void setPrioritiesForSurfaces(size_t surfaceMemoryBytes);
- void setPrioritiesForLayers(const LayerList&);
- size_t calculateMemoryForRenderSurfaces(const LayerList& updateList);
-
- void animateLayers(double monotonicTime);
- bool animateLayersRecursive(LayerChromium* current, double monotonicTime);
- void setAnimationEventsRecursive(const CCAnimationEventsVector&, LayerChromium*, double wallClockTime);
-
- bool m_animating;
- bool m_needsAnimateLayers;
-
- CCLayerTreeHostClient* m_client;
-
- int m_commitNumber;
- CCRenderingStats m_renderingStats;
-
- scoped_ptr<CCProxy> m_proxy;
- bool m_rendererInitialized;
- bool m_contextLost;
- int m_numTimesRecreateShouldFail;
- int m_numFailedRecreateAttempts;
-
- scoped_refptr<LayerChromium> m_rootLayer;
- scoped_refptr<HeadsUpDisplayLayerChromium> m_hudLayer;
- scoped_ptr<CCFontAtlas> m_fontAtlas;
-
- scoped_ptr<CCPrioritizedTextureManager> m_contentsTextureManager;
- scoped_ptr<CCPrioritizedTexture> m_surfaceMemoryPlaceholder;
-
- CCLayerTreeSettings m_settings;
-
- IntSize m_layoutViewportSize;
- IntSize m_deviceViewportSize;
- float m_deviceScaleFactor;
-
- bool m_visible;
-
- typedef base::hash_map<WebKit::WebGraphicsContext3D*, scoped_refptr<RateLimiter> > RateLimiterMap;
- RateLimiterMap m_rateLimiters;
-
- float m_pageScaleFactor;
- float m_minPageScaleFactor, m_maxPageScaleFactor;
- WebKit::WebTransformationMatrix m_implTransform;
- bool m_triggerIdleUpdates;
-
- SkColor m_backgroundColor;
- bool m_hasTransparentBackground;
-
- typedef ScopedPtrVector<CCPrioritizedTexture> TextureList;
- TextureList m_deleteTextureAfterCommitList;
- size_t m_partialTextureUpdateRequests;
-
- static bool s_needsFilterContext;
-
- DISALLOW_COPY_AND_ASSIGN(CCLayerTreeHost);
-};
-
-} // namespace cc
-
-#endif
+// Temporary forwarding header
+#include "cc/layer_tree_host.h"
diff --git a/cc/CCLayerTreeHostClient.h b/cc/CCLayerTreeHostClient.h
index 1c88a75..4a4f608 100644
--- a/cc/CCLayerTreeHostClient.h
+++ b/cc/CCLayerTreeHostClient.h
@@ -2,42 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCLayerTreeHostClient_h
-#define CCLayerTreeHostClient_h
-
-#include "base/memory/scoped_ptr.h"
-
-namespace WebKit {
-class WebCompositorOutputSurface;
-}
-
-namespace cc {
-class CCInputHandler;
-class IntSize;
-
-class CCLayerTreeHostClient {
-public:
- virtual void willBeginFrame() = 0;
- // Marks finishing compositing-related tasks on the main thread. In threaded mode, this corresponds to didCommit().
- virtual void didBeginFrame() = 0;
- virtual void animate(double frameBeginTime) = 0;
- virtual void layout() = 0;
- virtual void applyScrollAndScale(const IntSize& scrollDelta, float pageScale) = 0;
- virtual scoped_ptr<WebKit::WebCompositorOutputSurface> createOutputSurface() = 0;
- virtual void didRecreateOutputSurface(bool success) = 0;
- virtual scoped_ptr<CCInputHandler> createInputHandler() = 0;
- virtual void willCommit() = 0;
- virtual void didCommit() = 0;
- virtual void didCommitAndDrawFrame() = 0;
- virtual void didCompleteSwapBuffers() = 0;
-
- // Used only in the single-threaded path.
- virtual void scheduleComposite() = 0;
-
-protected:
- virtual ~CCLayerTreeHostClient() { }
-};
-
-}
-
-#endif // CCLayerTreeHostClient_h
+// Temporary forwarding header
+#include "cc/layer_tree_host_client.h"
diff --git a/cc/CCLayerTreeHostCommon.h b/cc/CCLayerTreeHostCommon.h
index 01dc41e..4fcd6b0 100644
--- a/cc/CCLayerTreeHostCommon.h
+++ b/cc/CCLayerTreeHostCommon.h
@@ -1,96 +1,6 @@
-// Copyright 2011 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCLayerTreeHostCommon_h
-#define CCLayerTreeHostCommon_h
-
-#include "base/memory/ref_counted.h"
-#include "cc/scoped_ptr_vector.h"
-#include "IntRect.h"
-#include "IntSize.h"
-#include <public/WebTransformationMatrix.h>
-#include <wtf/Vector.h>
-
-namespace cc {
-
-class CCLayerImpl;
-class CCLayerSorter;
-class LayerChromium;
-
-class CCLayerTreeHostCommon {
-public:
- static IntRect calculateVisibleRect(const IntRect& targetSurfaceRect, const IntRect& layerBoundRect, const WebKit::WebTransformationMatrix&);
-
- static void calculateDrawTransforms(LayerChromium* rootLayer, const IntSize& deviceViewportSize, float deviceScaleFactor, int maxTextureSize, std::vector<scoped_refptr<LayerChromium> >& renderSurfaceLayerList);
- static void calculateDrawTransforms(CCLayerImpl* rootLayer, const IntSize& deviceViewportSize, float deviceScaleFactor, CCLayerSorter*, int maxTextureSize, std::vector<CCLayerImpl*>& renderSurfaceLayerList);
-
- // Performs hit testing for a given renderSurfaceLayerList.
- static CCLayerImpl* findLayerThatIsHitByPoint(const IntPoint& viewportPoint, std::vector<CCLayerImpl*>& renderSurfaceLayerList);
-
- template<typename LayerType> static bool renderSurfaceContributesToTarget(LayerType*, int targetSurfaceLayerID);
-
- // Returns a layer with the given id if one exists in the subtree starting
- // from the given root layer (including mask and replica layers).
- template<typename LayerType> static LayerType* findLayerInSubtree(LayerType* rootLayer, int layerId);
-
- static LayerChromium* getChildAsRawPtr(const std::vector<scoped_refptr<LayerChromium> >& children, size_t index)
- {
- return children[index].get();
- }
-
- static CCLayerImpl* getChildAsRawPtr(const ScopedPtrVector<CCLayerImpl>& children, size_t index)
- {
- return children[index];
- }
-
- struct ScrollUpdateInfo {
- int layerId;
- IntSize scrollDelta;
- };
-};
-
-struct CCScrollAndScaleSet {
- CCScrollAndScaleSet();
- ~CCScrollAndScaleSet();
-
- Vector<CCLayerTreeHostCommon::ScrollUpdateInfo> scrolls;
- float pageScaleDelta;
-};
-
-template<typename LayerType>
-bool CCLayerTreeHostCommon::renderSurfaceContributesToTarget(LayerType* layer, int targetSurfaceLayerID)
-{
- // A layer will either contribute its own content, or its render surface's content, to
- // the target surface. The layer contributes its surface's content when both the
- // following are true:
- // (1) The layer actually has a renderSurface, and
- // (2) The layer's renderSurface is not the same as the targetSurface.
- //
- // Otherwise, the layer just contributes itself to the target surface.
-
- return layer->renderSurface() && layer->id() != targetSurfaceLayerID;
-}
-
-template<typename LayerType>
-LayerType* CCLayerTreeHostCommon::findLayerInSubtree(LayerType* rootLayer, int layerId)
-{
- if (rootLayer->id() == layerId)
- return rootLayer;
-
- if (rootLayer->maskLayer() && rootLayer->maskLayer()->id() == layerId)
- return rootLayer->maskLayer();
-
- if (rootLayer->replicaLayer() && rootLayer->replicaLayer()->id() == layerId)
- return rootLayer->replicaLayer();
-
- for (size_t i = 0; i < rootLayer->children().size(); ++i) {
- if (LayerType* found = findLayerInSubtree(getChildAsRawPtr(rootLayer->children(), i), layerId))
- return found;
- }
- return 0;
-}
-
-} // namespace cc
-
-#endif
+// Temporary forwarding header
+#include "cc/layer_tree_host_common.h"
diff --git a/cc/CCLayerTreeHostImpl.h b/cc/CCLayerTreeHostImpl.h
index 297f619..714a528 100644
--- a/cc/CCLayerTreeHostImpl.h
+++ b/cc/CCLayerTreeHostImpl.h
@@ -1,356 +1,6 @@
-// Copyright 2011 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCLayerTreeHostImpl_h
-#define CCLayerTreeHostImpl_h
-
-#include "base/basictypes.h"
-#include "base/time.h"
-#include "CCAnimationEvents.h"
-#include "CCInputHandler.h"
-#include "CCLayerSorter.h"
-#include "CCRenderPass.h"
-#include "CCRenderPassSink.h"
-#include "CCRenderer.h"
-#include "SkColor.h"
-#include <public/WebCompositorOutputSurfaceClient.h>
-#include <wtf/PassOwnPtr.h>
-#include <wtf/RefPtr.h>
-
-namespace cc {
-
-class CCCompletionEvent;
-class CCDebugRectHistory;
-class CCFrameRateCounter;
-class CCHeadsUpDisplayLayerImpl;
-class CCLayerImpl;
-class CCLayerTreeHostImplTimeSourceAdapter;
-class CCPageScaleAnimation;
-class CCRenderPassDrawQuad;
-class CCResourceProvider;
-struct RendererCapabilities;
-struct CCRenderingStats;
-
-// CCLayerTreeHost->CCProxy callback interface.
-class CCLayerTreeHostImplClient {
-public:
- virtual void didLoseContextOnImplThread() = 0;
- virtual void onSwapBuffersCompleteOnImplThread() = 0;
- virtual void onVSyncParametersChanged(double monotonicTimebase, double intervalInSeconds) = 0;
- virtual void onCanDrawStateChanged(bool canDraw) = 0;
- virtual void setNeedsRedrawOnImplThread() = 0;
- virtual void setNeedsCommitOnImplThread() = 0;
- virtual void postAnimationEventsToMainThreadOnImplThread(scoped_ptr<CCAnimationEventsVector>, double wallClockTime) = 0;
- virtual void releaseContentsTexturesOnImplThread() = 0;
-};
-
-// CCPinchZoomViewport models the bounds and offset of the viewport that is used during a pinch-zoom operation.
-// It tracks the layout-space dimensions of the viewport before any applied scale, and then tracks the layout-space
-// coordinates of the viewport respecting the pinch settings.
-class CCPinchZoomViewport {
-public:
- CCPinchZoomViewport();
-
- float totalPageScaleFactor() const;
-
- void setPageScaleFactor(float factor) { m_pageScaleFactor = factor; }
- float pageScaleFactor() const { return m_pageScaleFactor; }
-
- void setPageScaleDelta(float delta);
- float pageScaleDelta() const { return m_pageScaleDelta; }
-
- float minPageScaleFactor() const { return m_minPageScaleFactor; }
- float maxPageScaleFactor() const { return m_maxPageScaleFactor; }
-
- void setSentPageScaleDelta(float delta) { m_sentPageScaleDelta = delta; }
- float sentPageScaleDelta() const { return m_sentPageScaleDelta; }
-
- // Returns true if the passed parameters were different from those previously
- // cached.
- bool setPageScaleFactorAndLimits(float pageScaleFactor,
- float minPageScaleFactor,
- float maxPageScaleFactor);
-
- // Returns the bounds and offset of the scaled and translated viewport to use for pinch-zoom.
- FloatRect bounds() const;
- const FloatPoint& scrollDelta() const { return m_pinchViewportScrollDelta; }
-
- void setLayoutViewportSize(const FloatSize& size) { m_layoutViewportSize = size; }
-
- // Apply the scroll offset in layout space to the offset of the pinch-zoom viewport. The viewport cannot be
- // scrolled outside of the layout viewport bounds. Returns the component of the scroll that is un-applied due to
- // this constraint.
- FloatSize applyScroll(FloatSize&);
-
- WebKit::WebTransformationMatrix implTransform() const;
-
-private:
- float m_pageScaleFactor;
- float m_pageScaleDelta;
- float m_sentPageScaleDelta;
- float m_maxPageScaleFactor;
- float m_minPageScaleFactor;
-
- FloatPoint m_pinchViewportScrollDelta;
- FloatSize m_layoutViewportSize;
-};
-
-// CCLayerTreeHostImpl owns the CCLayerImpl tree as well as associated rendering state
-class CCLayerTreeHostImpl : public CCInputHandlerClient,
- public CCRendererClient,
- public WebKit::WebCompositorOutputSurfaceClient {
- typedef std::vector<CCLayerImpl*> CCLayerList;
-
-public:
- static scoped_ptr<CCLayerTreeHostImpl> create(const CCLayerTreeSettings&, CCLayerTreeHostImplClient*);
- virtual ~CCLayerTreeHostImpl();
-
- // CCInputHandlerClient implementation
- virtual CCInputHandlerClient::ScrollStatus scrollBegin(const IntPoint&, CCInputHandlerClient::ScrollInputType) OVERRIDE;
- virtual void scrollBy(const IntPoint&, const IntSize&) OVERRIDE;
- virtual void scrollEnd() OVERRIDE;
- virtual void pinchGestureBegin() OVERRIDE;
- virtual void pinchGestureUpdate(float, const IntPoint&) OVERRIDE;
- virtual void pinchGestureEnd() OVERRIDE;
- virtual void startPageScaleAnimation(const IntSize& targetPosition, bool anchorPoint, float pageScale, double startTime, double duration) OVERRIDE;
- virtual void scheduleAnimation() OVERRIDE;
-
- struct FrameData : public CCRenderPassSink {
- FrameData();
- ~FrameData();
-
- Vector<IntRect> occludingScreenSpaceRects;
- CCRenderPassList renderPasses;
- CCRenderPassIdHashMap renderPassesById;
- CCLayerList* renderSurfaceLayerList;
- CCLayerList willDrawLayers;
-
- // CCRenderPassSink implementation.
- virtual void appendRenderPass(scoped_ptr<CCRenderPass>) OVERRIDE;
- };
-
- // Virtual for testing.
- virtual void beginCommit();
- virtual void commitComplete();
- virtual void animate(double monotonicTime, double wallClockTime);
-
- // Returns false if problems occured preparing the frame, and we should try
- // to avoid displaying the frame. If prepareToDraw is called,
- // didDrawAllLayers must also be called, regardless of whether drawLayers is
- // called between the two.
- virtual bool prepareToDraw(FrameData&);
- virtual void drawLayers(const FrameData&);
- // Must be called if and only if prepareToDraw was called.
- void didDrawAllLayers(const FrameData&);
-
- // CCRendererClient implementation
- virtual const IntSize& deviceViewportSize() const OVERRIDE;
- virtual const CCLayerTreeSettings& settings() const OVERRIDE;
- virtual void didLoseContext() OVERRIDE;
- virtual void onSwapBuffersComplete() OVERRIDE;
- virtual void setFullRootLayerDamage() OVERRIDE;
- virtual void releaseContentsTextures() OVERRIDE;
- virtual void setMemoryAllocationLimitBytes(size_t) OVERRIDE;
-
- // WebCompositorOutputSurfaceClient implementation.
- virtual void onVSyncParametersChanged(double monotonicTimebase, double intervalInSeconds) OVERRIDE;
-
- // Implementation
- bool canDraw();
- CCGraphicsContext* context() const;
-
- std::string layerTreeAsText() const;
-
- void finishAllRendering();
- int sourceAnimationFrameNumber() const;
-
- bool initializeRenderer(scoped_ptr<CCGraphicsContext>);
- bool isContextLost();
- CCRenderer* renderer() { return m_renderer.get(); }
- const RendererCapabilities& rendererCapabilities() const;
-
- bool swapBuffers();
-
- void readback(void* pixels, const IntRect&);
-
- void setRootLayer(scoped_ptr<CCLayerImpl>);
- CCLayerImpl* rootLayer() { return m_rootLayerImpl.get(); }
-
- void setHudLayer(CCHeadsUpDisplayLayerImpl* layerImpl) { m_hudLayerImpl = layerImpl; }
- CCHeadsUpDisplayLayerImpl* hudLayer() { return m_hudLayerImpl; }
-
- // Release ownership of the current layer tree and replace it with an empty
- // tree. Returns the root layer of the detached tree.
- scoped_ptr<CCLayerImpl> detachLayerTree();
-
- CCLayerImpl* rootScrollLayer() const { return m_rootScrollLayerImpl; }
-
- bool visible() const { return m_visible; }
- void setVisible(bool);
-
- int sourceFrameNumber() const { return m_sourceFrameNumber; }
- void setSourceFrameNumber(int frameNumber) { m_sourceFrameNumber = frameNumber; }
-
- bool contentsTexturesPurged() const { return m_contentsTexturesPurged; }
- void setContentsTexturesPurged();
- void resetContentsTexturesPurged();
- size_t memoryAllocationLimitBytes() const { return m_memoryAllocationLimitBytes; }
-
- void setViewportSize(const IntSize& layoutViewportSize, const IntSize& deviceViewportSize);
- const IntSize& layoutViewportSize() const { return m_layoutViewportSize; }
-
- float deviceScaleFactor() const { return m_deviceScaleFactor; }
- void setDeviceScaleFactor(float);
-
- float pageScaleFactor() const;
- void setPageScaleFactorAndLimits(float pageScaleFactor, float minPageScaleFactor, float maxPageScaleFactor);
-
- scoped_ptr<CCScrollAndScaleSet> processScrollDeltas();
- WebKit::WebTransformationMatrix implTransform() const;
-
- void startPageScaleAnimation(const IntSize& tragetPosition, bool useAnchor, float scale, double durationSec);
-
- SkColor backgroundColor() const { return m_backgroundColor; }
- void setBackgroundColor(SkColor color) { m_backgroundColor = color; }
-
- bool hasTransparentBackground() const { return m_hasTransparentBackground; }
- void setHasTransparentBackground(bool transparent) { m_hasTransparentBackground = transparent; }
-
- bool needsAnimateLayers() const { return m_needsAnimateLayers; }
- void setNeedsAnimateLayers() { m_needsAnimateLayers = true; }
-
- void setNeedsRedraw();
-
- void renderingStats(CCRenderingStats*) const;
-
- void updateRootScrollLayerImplTransform();
-
- CCFrameRateCounter* fpsCounter() const { return m_fpsCounter.get(); }
- CCDebugRectHistory* debugRectHistory() const { return m_debugRectHistory.get(); }
- CCResourceProvider* resourceProvider() const { return m_resourceProvider.get(); }
-
- class CullRenderPassesWithCachedTextures {
- public:
- bool shouldRemoveRenderPass(const CCRenderPassDrawQuad&, const FrameData&) const;
-
- // Iterates from the root first, in order to remove the surfaces closest
- // to the root with cached textures, and all surfaces that draw into
- // them.
- size_t renderPassListBegin(const CCRenderPassList& list) const { return list.size() - 1; }
- size_t renderPassListEnd(const CCRenderPassList&) const { return 0 - 1; }
- size_t renderPassListNext(size_t it) const { return it - 1; }
-
- CullRenderPassesWithCachedTextures(CCRenderer& renderer) : m_renderer(renderer) { }
- private:
- CCRenderer& m_renderer;
- };
-
- class CullRenderPassesWithNoQuads {
- public:
- bool shouldRemoveRenderPass(const CCRenderPassDrawQuad&, const FrameData&) const;
-
- // Iterates in draw order, so that when a surface is removed, and its
- // target becomes empty, then its target can be removed also.
- size_t renderPassListBegin(const CCRenderPassList&) const { return 0; }
- size_t renderPassListEnd(const CCRenderPassList& list) const { return list.size(); }
- size_t renderPassListNext(size_t it) const { return it + 1; }
- };
-
- template<typename RenderPassCuller>
- static void removeRenderPasses(RenderPassCuller, FrameData&);
-
-protected:
- CCLayerTreeHostImpl(const CCLayerTreeSettings&, CCLayerTreeHostImplClient*);
-
- void animatePageScale(double monotonicTime);
- void animateScrollbars(double monotonicTime);
-
- // Exposed for testing.
- void calculateRenderSurfaceLayerList(CCLayerList&);
-
- // Virtual for testing.
- virtual void animateLayers(double monotonicTime, double wallClockTime);
-
- // Virtual for testing.
- virtual base::TimeDelta lowFrequencyAnimationInterval() const;
-
- CCLayerTreeHostImplClient* m_client;
- int m_sourceFrameNumber;
-
-private:
- void computeDoubleTapZoomDeltas(CCScrollAndScaleSet* scrollInfo);
- void computePinchZoomDeltas(CCScrollAndScaleSet* scrollInfo);
- void makeScrollAndScaleSet(CCScrollAndScaleSet* scrollInfo, const IntSize& scrollOffset, float pageScale);
-
- void setPageScaleDelta(float);
- void updateMaxScrollPosition();
- void trackDamageForAllSurfaces(CCLayerImpl* rootDrawLayer, const CCLayerList& renderSurfaceLayerList);
-
- // Returns false if the frame should not be displayed. This function should
- // only be called from prepareToDraw, as didDrawAllLayers must be called
- // if this helper function is called.
- bool calculateRenderPasses(FrameData&);
- void animateLayersRecursive(CCLayerImpl*, double monotonicTime, double wallClockTime, CCAnimationEventsVector*, bool& didAnimate, bool& needsAnimateLayers);
- void setBackgroundTickingEnabled(bool);
- IntSize contentSize() const;
-
- void sendDidLoseContextRecursive(CCLayerImpl*);
- void clearRenderSurfaces();
- bool ensureRenderSurfaceLayerList();
- void clearCurrentlyScrollingLayer();
-
- void animateScrollbarsRecursive(CCLayerImpl*, double monotonicTime);
-
- void dumpRenderSurfaces(std::string*, int indent, const CCLayerImpl*) const;
-
- scoped_ptr<CCGraphicsContext> m_context;
- OwnPtr<CCResourceProvider> m_resourceProvider;
- OwnPtr<CCRenderer> m_renderer;
- scoped_ptr<CCLayerImpl> m_rootLayerImpl;
- CCLayerImpl* m_rootScrollLayerImpl;
- CCLayerImpl* m_currentlyScrollingLayerImpl;
- CCHeadsUpDisplayLayerImpl* m_hudLayerImpl;
- int m_scrollingLayerIdFromPreviousTree;
- bool m_scrollDeltaIsInScreenSpace;
- CCLayerTreeSettings m_settings;
- IntSize m_layoutViewportSize;
- IntSize m_deviceViewportSize;
- float m_deviceScaleFactor;
- bool m_visible;
- bool m_contentsTexturesPurged;
- size_t m_memoryAllocationLimitBytes;
-
- SkColor m_backgroundColor;
- bool m_hasTransparentBackground;
-
- // If this is true, it is necessary to traverse the layer tree ticking the animators.
- bool m_needsAnimateLayers;
- bool m_pinchGestureActive;
- IntPoint m_previousPinchAnchor;
-
- OwnPtr<CCPageScaleAnimation> m_pageScaleAnimation;
-
- // This is used for ticking animations slowly when hidden.
- OwnPtr<CCLayerTreeHostImplTimeSourceAdapter> m_timeSourceClientAdapter;
-
- CCLayerSorter m_layerSorter;
-
- // List of visible layers for the most recently prepared frame. Used for
- // rendering and input event hit testing.
- CCLayerList m_renderSurfaceLayerList;
-
- CCPinchZoomViewport m_pinchZoomViewport;
-
- OwnPtr<CCFrameRateCounter> m_fpsCounter;
- OwnPtr<CCDebugRectHistory> m_debugRectHistory;
-
- size_t m_numImplThreadScrolls;
- size_t m_numMainThreadScrolls;
-
- DISALLOW_COPY_AND_ASSIGN(CCLayerTreeHostImpl);
-};
-
-};
-
-#endif
+// Temporary forwarding header
+#include "cc/layer_tree_host_impl.h"
diff --git a/cc/CCMathUtil.h b/cc/CCMathUtil.h
index ed3848e..945ffe8 100644
--- a/cc/CCMathUtil.h
+++ b/cc/CCMathUtil.h
@@ -2,106 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCMathUtil_h
-#define CCMathUtil_h
-
-#include "FloatPoint.h"
-#include "FloatPoint3D.h"
-
-namespace WebKit {
-class WebTransformationMatrix;
-}
-
-namespace cc {
-
-class IntRect;
-class FloatRect;
-class FloatQuad;
-
-struct HomogeneousCoordinate {
- HomogeneousCoordinate(double newX, double newY, double newZ, double newW)
- : x(newX)
- , y(newY)
- , z(newZ)
- , w(newW)
- {
- }
-
- bool shouldBeClipped() const
- {
- return w <= 0;
- }
-
- FloatPoint cartesianPoint2d() const
- {
- if (w == 1)
- return FloatPoint(x, y);
-
- // For now, because this code is used privately only by CCMathUtil, it should never be called when w == 0, and we do not yet need to handle that case.
- ASSERT(w);
- double invW = 1.0 / w;
- return FloatPoint(x * invW, y * invW);
- }
-
- FloatPoint3D cartesianPoint3d() const
- {
- if (w == 1)
- return FloatPoint3D(x, y, z);
-
- // For now, because this code is used privately only by CCMathUtil, it should never be called when w == 0, and we do not yet need to handle that case.
- ASSERT(w);
- double invW = 1.0 / w;
- return FloatPoint3D(x * invW, y * invW, z * invW);
- }
-
- double x;
- double y;
- double z;
- double w;
-};
-
-class CCMathUtil {
-public:
-
- // Background: WebTransformationMatrix code in WebCore does not do the right thing in
- // mapRect / mapQuad / projectQuad when there is a perspective projection that causes
- // one of the transformed vertices to go to w < 0. In those cases, it is necessary to
- // perform clipping in homogeneous coordinates, after applying the transform, before
- // dividing-by-w to convert to cartesian coordinates.
- //
- // These functions return the axis-aligned rect that encloses the correctly clipped,
- // transformed polygon.
- static IntRect mapClippedRect(const WebKit::WebTransformationMatrix&, const IntRect&);
- static FloatRect mapClippedRect(const WebKit::WebTransformationMatrix&, const FloatRect&);
- static FloatRect projectClippedRect(const WebKit::WebTransformationMatrix&, const FloatRect&);
-
- // Returns an array of vertices that represent the clipped polygon. After returning, indexes from
- // 0 to numVerticesInClippedQuad are valid in the clippedQuad array. Note that
- // numVerticesInClippedQuad may be zero, which means the entire quad was clipped, and
- // none of the vertices in the array are valid.
- static void mapClippedQuad(const WebKit::WebTransformationMatrix&, const FloatQuad& srcQuad, FloatPoint clippedQuad[8], int& numVerticesInClippedQuad);
-
- static FloatRect computeEnclosingRectOfVertices(FloatPoint vertices[], int numVertices);
- static FloatRect computeEnclosingClippedRect(const HomogeneousCoordinate& h1, const HomogeneousCoordinate& h2, const HomogeneousCoordinate& h3, const HomogeneousCoordinate& h4);
-
- // NOTE: These functions do not do correct clipping against w = 0 plane, but they
- // correctly detect the clipped condition via the boolean clipped.
- static FloatQuad mapQuad(const WebKit::WebTransformationMatrix&, const FloatQuad&, bool& clipped);
- static FloatPoint mapPoint(const WebKit::WebTransformationMatrix&, const FloatPoint&, bool& clipped);
- static FloatPoint3D mapPoint(const WebKit::WebTransformationMatrix&, const FloatPoint3D&, bool& clipped);
- static FloatQuad projectQuad(const WebKit::WebTransformationMatrix&, const FloatQuad&, bool& clipped);
- static FloatPoint projectPoint(const WebKit::WebTransformationMatrix&, const FloatPoint&, bool& clipped);
-
- static void flattenTransformTo2d(WebKit::WebTransformationMatrix&);
-
- // Returns the smallest angle between the given two vectors in degrees. Neither vector is
- // assumed to be normalized.
- static float smallestAngleBetweenVectors(const FloatSize&, const FloatSize&);
-
- // Projects the |source| vector onto |destination|. Neither vector is assumed to be normalized.
- static FloatSize projectVector(const FloatSize& source, const FloatSize& destination);
-};
-
-} // namespace cc
-
-#endif // #define CCMathUtil_h
+// Temporary forwarding header
+#include "cc/math_util.h"
diff --git a/cc/CCOcclusionTracker.h b/cc/CCOcclusionTracker.h
index c2526cd..b7c8ce0 100644
--- a/cc/CCOcclusionTracker.h
+++ b/cc/CCOcclusionTracker.h
@@ -2,104 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCOcclusionTracker_h
-#define CCOcclusionTracker_h
-
-#include "base/basictypes.h"
-#include "CCLayerIterator.h"
-#include "FloatQuad.h"
-#include "Region.h"
-
-namespace cc {
-class CCOverdrawMetrics;
-class CCLayerImpl;
-class CCRenderSurface;
-class LayerChromium;
-class RenderSurfaceChromium;
-
-// This class is used to track occlusion of layers while traversing them in a front-to-back order. As each layer is visited, one of the
-// methods in this class is called to notify it about the current target surface.
-// Then, occlusion in the content space of the current layer may be queried, via methods such as occluded() and unoccludedContentRect().
-// If the current layer owns a RenderSurface, then occlusion on that RenderSurface may also be queried via surfaceOccluded() and surfaceUnoccludedContentRect().
-// Finally, once finished with the layer, occlusion behind the layer should be marked by calling markOccludedBehindLayer().
-template<typename LayerType, typename RenderSurfaceType>
-class CCOcclusionTrackerBase {
-public:
- CCOcclusionTrackerBase(IntRect rootTargetRect, bool recordMetricsForFrame);
-
- // Called at the beginning of each step in the CCLayerIterator's front-to-back traversal.
- void enterLayer(const CCLayerIteratorPosition<LayerType>&);
- // Called at the end of each step in the CCLayerIterator's front-to-back traversal.
- void leaveLayer(const CCLayerIteratorPosition<LayerType>&);
-
- // Returns true if the given rect in content space for the layer is fully occluded in either screen space or the layer's target surface.
- bool occluded(const LayerType*, const IntRect& contentRect, bool* hasOcclusionFromOutsideTargetSurface = 0) const;
- // Gives an unoccluded sub-rect of |contentRect| in the content space of the layer. Used when considering occlusion for a layer that paints/draws something.
- IntRect unoccludedContentRect(const LayerType*, const IntRect& contentRect, bool* hasOcclusionFromOutsideTargetSurface = 0) const;
-
- // Gives an unoccluded sub-rect of |contentRect| in the content space of the renderTarget owned by the layer.
- // Used when considering occlusion for a contributing surface that is rendering into another target.
- IntRect unoccludedContributingSurfaceContentRect(const LayerType*, bool forReplica, const IntRect& contentRect, bool* hasOcclusionFromOutsideTargetSurface = 0) const;
-
- // Report operations for recording overdraw metrics.
- CCOverdrawMetrics& overdrawMetrics() const { return *m_overdrawMetrics.get(); }
-
- // Gives the region of the screen that is not occluded by something opaque.
- Region computeVisibleRegionInScreen() const { return subtract(Region(m_rootTargetRect), m_stack.last().occlusionInScreen); }
-
- void setMinimumTrackingSize(const IntSize& size) { m_minimumTrackingSize = size; }
-
- // The following is used for visualization purposes.
- void setOccludingScreenSpaceRectsContainer(Vector<IntRect>* rects) { m_occludingScreenSpaceRects = rects; }
-
-protected:
- struct StackObject {
- StackObject() : target(0) { }
- StackObject(const LayerType* target) : target(target) { }
- const LayerType* target;
- Region occlusionInScreen;
- Region occlusionInTarget;
- };
-
- // The stack holds occluded regions for subtrees in the RenderSurface-Layer tree, so that when we leave a subtree we may
- // apply a mask to it, but not to the parts outside the subtree.
- // - The first time we see a new subtree under a target, we add that target to the top of the stack. This can happen as a layer representing itself, or as a target surface.
- // - When we visit a target surface, we apply its mask to its subtree, which is at the top of the stack.
- // - When we visit a layer representing itself, we add its occlusion to the current subtree, which is at the top of the stack.
- // - When we visit a layer representing a contributing surface, the current target will never be the top of the stack since we just came from the contributing surface.
- // We merge the occlusion at the top of the stack with the new current subtree. This new target is pushed onto the stack if not already there.
- Vector<StackObject, 1> m_stack;
-
- // Allow tests to override this.
- virtual IntRect layerClipRectInTarget(const LayerType*) const;
-
-private:
- // Called when visiting a layer representing itself. If the target was not already current, then this indicates we have entered a new surface subtree.
- void enterRenderTarget(const LayerType* newTarget);
-
- // Called when visiting a layer representing a target surface. This indicates we have visited all the layers within the surface, and we may
- // perform any surface-wide operations.
- void finishedRenderTarget(const LayerType* finishedTarget);
-
- // Called when visiting a layer representing a contributing surface. This indicates that we are leaving our current surface, and
- // entering the new one. We then perform any operations required for merging results from the child subtree into its parent.
- void leaveToRenderTarget(const LayerType* newTarget);
-
- // Add the layer's occlusion to the tracked state.
- void markOccludedBehindLayer(const LayerType*);
-
- IntRect m_rootTargetRect;
- OwnPtr<CCOverdrawMetrics> m_overdrawMetrics;
- IntSize m_minimumTrackingSize;
-
- // This is used for visualizing the occlusion tracking process.
- Vector<IntRect>* m_occludingScreenSpaceRects;
-
- DISALLOW_COPY_AND_ASSIGN(CCOcclusionTrackerBase);
-};
-
-typedef CCOcclusionTrackerBase<LayerChromium, RenderSurfaceChromium> CCOcclusionTracker;
-typedef CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface> CCOcclusionTrackerImpl;
-
-}
-#endif // CCOcclusionTracker_h
+// Temporary forwarding header
+#include "cc/occlusion_tracker.h"
diff --git a/cc/CCOverdrawMetrics.h b/cc/CCOverdrawMetrics.h
index b907a64..94a1788 100644
--- a/cc/CCOverdrawMetrics.h
+++ b/cc/CCOverdrawMetrics.h
@@ -2,96 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCOverdrawMetrics_h
-#define CCOverdrawMetrics_h
-
-#include <wtf/PassOwnPtr.h>
-
-namespace WebKit {
-class WebTransformationMatrix;
-}
-
-namespace cc {
-class IntRect;
-class CCLayerTreeHost;
-class CCLayerTreeHostImpl;
-
-// FIXME: compute overdraw metrics only occasionally, not every frame.
-class CCOverdrawMetrics {
-public:
- static PassOwnPtr<CCOverdrawMetrics> create(bool recordMetricsForFrame) { return adoptPtr(new CCOverdrawMetrics(recordMetricsForFrame)); }
-
- // These methods are used for saving metrics during update/commit.
-
- // Record pixels painted by WebKit into the texture updater, but does not mean the pixels were rasterized in main memory.
- void didPaint(const IntRect& paintedRect);
- // Records that an invalid tile was culled and did not need to be painted/uploaded, and did not contribute to other tiles needing to be painted.
- void didCullTileForUpload();
- // Records pixels that were uploaded to texture memory.
- void didUpload(const WebKit::WebTransformationMatrix& transformToTarget, const IntRect& uploadRect, const IntRect& opaqueRect);
- // Record contents texture(s) behind present using the given number of bytes.
- void didUseContentsTextureMemoryBytes(size_t contentsTextureUseBytes);
- // Record RenderSurface texture(s) being present using the given number of bytes.
- void didUseRenderSurfaceTextureMemoryBytes(size_t renderSurfaceUseBytes);
-
- // These methods are used for saving metrics during draw.
-
- // Record pixels that were not drawn to screen.
- void didCullForDrawing(const WebKit::WebTransformationMatrix& transformToTarget, const IntRect& beforeCullRect, const IntRect& afterCullRect);
- // Record pixels that were drawn to screen.
- void didDraw(const WebKit::WebTransformationMatrix& transformToTarget, const IntRect& afterCullRect, const IntRect& opaqueRect);
-
- void recordMetrics(const CCLayerTreeHost*) const;
- void recordMetrics(const CCLayerTreeHostImpl*) const;
-
- // Accessors for tests.
- float pixelsDrawnOpaque() const { return m_pixelsDrawnOpaque; }
- float pixelsDrawnTranslucent() const { return m_pixelsDrawnTranslucent; }
- float pixelsCulledForDrawing() const { return m_pixelsCulledForDrawing; }
- float pixelsPainted() const { return m_pixelsPainted; }
- float pixelsUploadedOpaque() const { return m_pixelsUploadedOpaque; }
- float pixelsUploadedTranslucent() const { return m_pixelsUploadedTranslucent; }
- int tilesCulledForUpload() const { return m_tilesCulledForUpload; }
-
-private:
- enum MetricsType {
- UpdateAndCommit,
- DrawingToScreen
- };
-
- explicit CCOverdrawMetrics(bool recordMetricsForFrame);
-
- template<typename LayerTreeHostType>
- void recordMetricsInternal(MetricsType, const LayerTreeHostType*) const;
-
- // When false this class is a giant no-op.
- bool m_recordMetricsForFrame;
-
- // These values are used for saving metrics during update/commit.
-
- // Count of pixels that were painted due to invalidation.
- float m_pixelsPainted;
- // Count of pixels uploaded to textures and known to be opaque.
- float m_pixelsUploadedOpaque;
- // Count of pixels uploaded to textures and not known to be opaque.
- float m_pixelsUploadedTranslucent;
- // Count of tiles that were invalidated but not uploaded.
- int m_tilesCulledForUpload;
- // Count the number of bytes in contents textures.
- unsigned long long m_contentsTextureUseBytes;
- // Count the number of bytes in RenderSurface textures.
- unsigned long long m_renderSurfaceTextureUseBytes;
-
- // These values are used for saving metrics during draw.
-
- // Count of pixels that are opaque (and thus occlude). Ideally this is no more than wiewport width x height.
- float m_pixelsDrawnOpaque;
- // Count of pixels that are possibly translucent, and cannot occlude.
- float m_pixelsDrawnTranslucent;
- // Count of pixels not drawn as they are occluded by somthing opaque.
- float m_pixelsCulledForDrawing;
-};
-
-} // namespace cc
-
-#endif
+// Temporary forwarding header
+#include "cc/overdraw_metrics.h"
diff --git a/cc/CCPageScaleAnimation.h b/cc/CCPageScaleAnimation.h
index f597026..1c59d7d 100644
--- a/cc/CCPageScaleAnimation.h
+++ b/cc/CCPageScaleAnimation.h
@@ -1,74 +1,6 @@
-// Copyright 2011 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCPageScaleAnimation_h
-#define CCPageScaleAnimation_h
-
-#include "IntSize.h"
-#include <wtf/PassOwnPtr.h>
-
-namespace cc {
-
-// A small helper class that does the math for zoom animations, primarily for
-// double-tap zoom. Initialize it with starting and ending scroll/page scale
-// positions and an animation length time, then call ...AtTime() at every frame
-// to obtain the current interpolated position.
-class CCPageScaleAnimation {
-public:
- // Construct with the starting page scale and scroll offset (which is in
- // pageScaleStart space). The window size is the user-viewable area
- // in pixels.
- static PassOwnPtr<CCPageScaleAnimation> create(const IntSize& scrollStart, float pageScaleStart, const IntSize& windowSize, const IntSize& contentSize, double startTime);
-
- // The following methods initialize the animation. Call one of them
- // immediately after construction to set the final scroll and page scale.
-
- // Zoom while explicitly specifying the top-left scroll position. The
- // scroll offset is in finalPageScale coordinates.
- void zoomTo(const IntSize& finalScroll, float finalPageScale, double duration);
-
- // Zoom based on a specified onscreen anchor, which will remain at the same
- // position on the screen throughout the animation. The anchor is in local
- // space relative to scrollStart.
- void zoomWithAnchor(const IntSize& anchor, float finalPageScale, double duration);
-
- // Call these functions while the animation is in progress to output the
- // current state.
- IntSize scrollOffsetAtTime(double time) const;
- float pageScaleAtTime(double time) const;
- bool isAnimationCompleteAtTime(double time) const;
-
- // The following methods return state which is invariant throughout the
- // course of the animation.
- double startTime() const { return m_startTime; }
- double duration() const { return m_duration; }
- double endTime() const { return m_startTime + m_duration; }
- const IntSize& finalScrollOffset() const { return m_scrollEnd; }
- float finalPageScale() const { return m_pageScaleEnd; }
-
-protected:
- CCPageScaleAnimation(const IntSize& scrollStart, float pageScaleStart, const IntSize& windowSize, const IntSize& contentSize, double startTime);
-
-private:
- float progressRatioForTime(double time) const;
- IntSize scrollOffsetAtRatio(float ratio) const;
- float pageScaleAtRatio(float ratio) const;
-
- IntSize m_scrollStart;
- float m_pageScaleStart;
- IntSize m_windowSize;
- IntSize m_contentSize;
-
- bool m_anchorMode;
- IntSize m_anchor;
- IntSize m_scrollEnd;
- float m_pageScaleEnd;
-
- double m_startTime;
- double m_duration;
-};
-
-} // namespace cc
-
-#endif
+// Temporary forwarding header
+#include "cc/page_scale_animation.h"
diff --git a/cc/CCPrioritizedTexture.h b/cc/CCPrioritizedTexture.h
index 3196867..19fdca2 100644
--- a/cc/CCPrioritizedTexture.h
+++ b/cc/CCPrioritizedTexture.h
@@ -2,141 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCPrioritizedTexture_h
-#define CCPrioritizedTexture_h
-
-#include "base/basictypes.h"
-#include "base/memory/scoped_ptr.h"
-#include "CCPriorityCalculator.h"
-#include "CCResourceProvider.h"
-#include "CCTexture.h"
-#include "GraphicsContext3D.h"
-#include "IntRect.h"
-#include "IntSize.h"
-
-namespace cc {
-
-class CCPrioritizedTextureManager;
-
-class CCPrioritizedTexture {
-public:
- static scoped_ptr<CCPrioritizedTexture> create(CCPrioritizedTextureManager* manager, IntSize size, GC3Denum format)
- {
- return make_scoped_ptr(new CCPrioritizedTexture(manager, size, format));
- }
- static scoped_ptr<CCPrioritizedTexture> create(CCPrioritizedTextureManager* manager)
- {
- return make_scoped_ptr(new CCPrioritizedTexture(manager, IntSize(), 0));
- }
- ~CCPrioritizedTexture();
-
- // Texture properties. Changing these causes the backing texture to be lost.
- // Setting these to the same value is a no-op.
- void setTextureManager(CCPrioritizedTextureManager*);
- CCPrioritizedTextureManager* textureManager() { return m_manager; }
- void setDimensions(IntSize, GC3Denum format);
- GC3Denum format() const { return m_format; }
- IntSize size() const { return m_size; }
- size_t bytes() const { return m_bytes; }
-
- // Set priority for the requested texture.
- void setRequestPriority(int priority) { m_priority = priority; }
- int requestPriority() const { return m_priority; }
-
- // After CCPrioritizedTexture::prioritizeTextures() is called, this returns
- // if the the request succeeded and this texture can be acquired for use.
- bool canAcquireBackingTexture() const { return m_isAbovePriorityCutoff; }
-
- // This returns whether we still have a backing texture. This can continue
- // to be true even after canAcquireBackingTexture() becomes false. In this
- // case the texture can be used but shouldn't be updated since it will get
- // taken away "soon".
- bool haveBackingTexture() const { return !!backing(); }
-
- bool backingResourceWasEvicted() const;
-
- // If canAcquireBackingTexture() is true acquireBackingTexture() will acquire
- // a backing texture for use. Call this whenever the texture is actually needed.
- void acquireBackingTexture(CCResourceProvider*);
-
- // FIXME: Request late is really a hack for when we are totally out of memory
- // (all textures are visible) but we can still squeeze into the limit
- // by not painting occluded textures. In this case the manager
- // refuses all visible textures and requestLate() will enable
- // canAcquireBackingTexture() on a call-order basis. We might want to
- // just remove this in the future (carefully) and just make sure we don't
- // regress OOMs situations.
- bool requestLate();
-
- // Uploads pixels into the backing resource. This functions will aquire the backing if needed.
- void upload(CCResourceProvider*, const uint8_t* image, const IntRect& imageRect, const IntRect& sourceRect, const IntSize& destOffset);
-
- CCResourceProvider::ResourceId resourceId() const;
-
- // Self-managed textures are accounted for when prioritizing other textures,
- // but they are not allocated/recycled/deleted, so this needs to be done
- // externally. canAcquireBackingTexture() indicates if the texture would have
- // been allowed given its priority.
- void setIsSelfManaged(bool isSelfManaged) { m_isSelfManaged = isSelfManaged; }
- bool isSelfManaged() { return m_isSelfManaged; }
- void setToSelfManagedMemoryPlaceholder(size_t bytes);
-
-private:
- friend class CCPrioritizedTextureManager;
- friend class CCPrioritizedTextureTest;
-
- class Backing : public CCTexture {
- public:
- Backing(unsigned id, CCResourceProvider*, IntSize, GC3Denum format);
- ~Backing();
- void updatePriority();
-
- CCPrioritizedTexture* owner() { return m_owner; }
- bool hadOwnerAtLastPriorityUpdate() const { return m_ownerExistedAtLastPriorityUpdate; }
- int requestPriorityAtLastPriorityUpdate() const { return m_priorityAtLastPriorityUpdate; }
- bool wasAbovePriorityCutoffAtLastPriorityUpdate() const { return m_wasAbovePriorityCutoffAtLastPriorityUpdate; }
-
- void deleteResource(CCResourceProvider*);
- bool resourceHasBeenDeleted() const;
-
- private:
- friend class CCPrioritizedTexture;
- CCPrioritizedTexture* m_owner;
- int m_priorityAtLastPriorityUpdate;
- bool m_ownerExistedAtLastPriorityUpdate;
- bool m_wasAbovePriorityCutoffAtLastPriorityUpdate;
- bool m_resourceHasBeenDeleted;
-#ifndef NDEBUG
- CCResourceProvider* m_resourceProvider;
-#endif
-
- DISALLOW_COPY_AND_ASSIGN(Backing);
- };
-
- CCPrioritizedTexture(CCPrioritizedTextureManager*, IntSize, GC3Denum format);
-
- bool isAbovePriorityCutoff() { return m_isAbovePriorityCutoff; }
- void setAbovePriorityCutoff(bool isAbovePriorityCutoff) { m_isAbovePriorityCutoff = isAbovePriorityCutoff; }
- void setManagerInternal(CCPrioritizedTextureManager* manager) { m_manager = manager; }
-
- Backing* backing() const { return m_backing; }
- void link(Backing*);
- void unlink();
-
- IntSize m_size;
- GC3Denum m_format;
- size_t m_bytes;
-
- int m_priority;
- bool m_isAbovePriorityCutoff;
- bool m_isSelfManaged;
-
- Backing* m_backing;
- CCPrioritizedTextureManager* m_manager;
-
- DISALLOW_COPY_AND_ASSIGN(CCPrioritizedTexture);
-};
-
-} // namespace cc
-
-#endif
+// Temporary forwarding header
+#include "cc/prioritized_texture.h"
diff --git a/cc/CCPrioritizedTextureManager.h b/cc/CCPrioritizedTextureManager.h
index 1b3b1ed..cfeb804 100644
--- a/cc/CCPrioritizedTextureManager.h
+++ b/cc/CCPrioritizedTextureManager.h
@@ -2,158 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCPrioritizedTextureManager_h
-#define CCPrioritizedTextureManager_h
-
-#include "base/basictypes.h"
-#include "base/hash_tables.h"
-#include "base/memory/scoped_ptr.h"
-#include "CCPrioritizedTexture.h"
-#include "CCPriorityCalculator.h"
-#include "CCTexture.h"
-#include "GraphicsContext3D.h"
-#include "IntRect.h"
-#include "IntSize.h"
-#include <wtf/ListHashSet.h>
-#include <wtf/Vector.h>
-
-#if defined(COMPILER_GCC)
-namespace BASE_HASH_NAMESPACE {
-template<>
-struct hash<cc::CCPrioritizedTexture*> {
- size_t operator()(cc::CCPrioritizedTexture* ptr) const {
- return hash<size_t>()(reinterpret_cast<size_t>(ptr));
- }
-};
-} // namespace BASE_HASH_NAMESPACE
-#endif // COMPILER
-
-namespace cc {
-
-class CCPriorityCalculator;
-
-class CCPrioritizedTextureManager {
-public:
- static scoped_ptr<CCPrioritizedTextureManager> create(size_t maxMemoryLimitBytes, int maxTextureSize, int pool)
- {
- return make_scoped_ptr(new CCPrioritizedTextureManager(maxMemoryLimitBytes, maxTextureSize, pool));
- }
- scoped_ptr<CCPrioritizedTexture> createTexture(IntSize size, GC3Denum format)
- {
- return make_scoped_ptr(new CCPrioritizedTexture(this, size, format));
- }
- ~CCPrioritizedTextureManager();
-
- typedef Vector<CCPrioritizedTexture::Backing*> BackingVector;
-
- // FIXME (http://crbug.com/137094): This 64MB default is a straggler from the
- // old texture manager and is just to give us a default memory allocation before
- // we get a callback from the GPU memory manager. We should probaby either:
- // - wait for the callback before rendering anything instead
- // - push this into the GPU memory manager somehow.
- static size_t defaultMemoryAllocationLimit() { return 64 * 1024 * 1024; }
-
- // memoryUseBytes() describes the number of bytes used by existing allocated textures.
- // memoryAboveCutoffBytes() describes the number of bytes that would be used if all
- // textures that are above the cutoff were allocated.
- // memoryUseBytes() <= memoryAboveCutoffBytes() should always be true.
- size_t memoryUseBytes() const { return m_memoryUseBytes; }
- size_t memoryAboveCutoffBytes() const { return m_memoryAboveCutoffBytes; }
- size_t memoryForSelfManagedTextures() const { return m_maxMemoryLimitBytes - m_memoryAvailableBytes; }
-
- void setMaxMemoryLimitBytes(size_t bytes) { m_maxMemoryLimitBytes = bytes; }
- size_t maxMemoryLimitBytes() const { return m_maxMemoryLimitBytes; }
-
- void prioritizeTextures();
- void clearPriorities();
-
- void reduceMemoryOnImplThread(size_t limitBytes, CCResourceProvider*);
- bool evictedBackingsExist() const { return !m_evictedBackings.isEmpty(); }
- void getEvictedBackings(BackingVector& evictedBackings);
- void unlinkEvictedBackings(const BackingVector& evictedBackings);
- // Deletes all evicted backings, unlinking them from their owning textures if needed.
- // Returns true if this function unlinked any backings from their owning texture while
- // destroying them.
- bool deleteEvictedBackings();
-
- bool requestLate(CCPrioritizedTexture*);
-
- void reduceMemory(CCResourceProvider*);
- void clearAllMemory(CCResourceProvider*);
-
- void acquireBackingTextureIfNeeded(CCPrioritizedTexture*, CCResourceProvider*);
-
- void registerTexture(CCPrioritizedTexture*);
- void unregisterTexture(CCPrioritizedTexture*);
- void returnBackingTexture(CCPrioritizedTexture*);
-
-private:
- friend class CCPrioritizedTextureTest;
-
- enum EvictionPriorityPolicy {
- RespectManagerPriorityCutoff,
- DoNotRespectManagerPriorityCutoff,
- };
-
- // Compare textures. Highest priority first.
- static inline bool compareTextures(CCPrioritizedTexture* a, CCPrioritizedTexture* b)
- {
- if (a->requestPriority() == b->requestPriority())
- return a < b;
- return CCPriorityCalculator::priorityIsHigher(a->requestPriority(), b->requestPriority());
- }
- // Compare backings. Lowest priority first.
- static inline bool compareBackings(CCPrioritizedTexture::Backing* a, CCPrioritizedTexture::Backing* b)
- {
- int priorityA = a->requestPriorityAtLastPriorityUpdate();
- int priorityB = b->requestPriorityAtLastPriorityUpdate();
- if (priorityA != priorityB)
- return CCPriorityCalculator::priorityIsLower(priorityA, priorityB);
- bool aboveCutoffA = a->wasAbovePriorityCutoffAtLastPriorityUpdate();
- bool aboveCutoffB = b->wasAbovePriorityCutoffAtLastPriorityUpdate();
- if (!aboveCutoffA && aboveCutoffB)
- return true;
- if (aboveCutoffA && !aboveCutoffB)
- return false;
- return a < b;
- }
-
- CCPrioritizedTextureManager(size_t maxMemoryLimitBytes, int maxTextureSize, int pool);
-
- void updateBackingsPriorities();
- void evictBackingsToReduceMemory(size_t limitBytes, EvictionPriorityPolicy, CCResourceProvider*);
- CCPrioritizedTexture::Backing* createBacking(IntSize, GC3Denum format, CCResourceProvider*);
- void evictBackingResource(CCPrioritizedTexture::Backing*, CCResourceProvider*);
-
-#if !ASSERT_DISABLED
- void assertInvariants();
-#endif
-
- size_t m_maxMemoryLimitBytes;
- unsigned m_priorityCutoff;
- size_t m_memoryUseBytes;
- size_t m_memoryAboveCutoffBytes;
- size_t m_memoryAvailableBytes;
- int m_pool;
-
- typedef base::hash_set<CCPrioritizedTexture*> TextureSet;
- typedef ListHashSet<CCPrioritizedTexture::Backing*> BackingSet;
- typedef Vector<CCPrioritizedTexture*> TextureVector;
-
- TextureSet m_textures;
- BackingSet m_backings;
- BackingVector m_evictedBackings;
-
- TextureVector m_tempTextureVector;
- BackingVector m_tempBackingVector;
-
- // Set by the main thread when it adjust priorities in such a way that
- // the m_backings array's view of priorities is now out of date.
- bool m_needsUpdateBackingsPrioritites;
-
- DISALLOW_COPY_AND_ASSIGN(CCPrioritizedTextureManager);
-};
-
-} // namespace cc
-
-#endif
+// Temporary forwarding header
+#include "cc/prioritized_texture_manager.h"
diff --git a/cc/CCPriorityCalculator.h b/cc/CCPriorityCalculator.h
index 45f2e64..973da9f 100644
--- a/cc/CCPriorityCalculator.h
+++ b/cc/CCPriorityCalculator.h
@@ -1,32 +1,6 @@
-// Copyright 2010 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCPriorityCalculator_h
-#define CCPriorityCalculator_h
-
-#include "GraphicsContext3D.h"
-#include "IntRect.h"
-#include "IntSize.h"
-
-namespace cc {
-
-class CCPriorityCalculator {
-public:
- static int uiPriority(bool drawsToRootSurface);
- static int visiblePriority(bool drawsToRootSurface);
- static int renderSurfacePriority();
- static int lingeringPriority(int previousPriority);
- static int priorityFromDistance(const IntRect& visibleRect, const IntRect& textureRect, bool drawsToRootSurface);
- static int smallAnimatedLayerMinPriority();
-
- static inline int highestPriority() { return std::numeric_limits<int>::min(); }
- static inline int lowestPriority() { return std::numeric_limits<int>::max(); }
- static inline bool priorityIsLower(int a, int b) { return a > b; }
- static inline bool priorityIsHigher(int a, int b) { return a < b; }
- static inline bool maxPriority(int a, int b) { return priorityIsHigher(a, b) ? a : b; }
-};
-
-}
-
-#endif
+// Temporary forwarding header
+#include "cc/priority_calculator.h"
diff --git a/cc/CCProxy.h b/cc/CCProxy.h
index 30a62cc..012f06f 100644
--- a/cc/CCProxy.h
+++ b/cc/CCProxy.h
@@ -1,129 +1,6 @@
-// Copyright 2011 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCProxy_h
-#define CCProxy_h
-
-#include "base/basictypes.h"
-#include <public/WebCompositorOutputSurface.h>
-#include <wtf/PassOwnPtr.h>
-#include <wtf/PassRefPtr.h>
-
-namespace cc {
-
-class CCThread;
-class IntRect;
-class IntSize;
-struct CCRenderingStats;
-struct RendererCapabilities;
-
-// Abstract class responsible for proxying commands from the main-thread side of
-// the compositor over to the compositor implementation.
-class CCProxy {
-public:
- static void setMainThread(CCThread*);
- static CCThread* mainThread();
-
- static bool hasImplThread();
- static void setImplThread(CCThread*);
- static CCThread* implThread();
-
- // Returns 0 if the current thread is neither the main thread nor the impl thread.
- static CCThread* currentThread();
-
- virtual ~CCProxy();
-
- virtual bool compositeAndReadback(void *pixels, const IntRect&) = 0;
-
- virtual void startPageScaleAnimation(const IntSize& targetPosition, bool useAnchor, float scale, double durationSec) = 0;
-
- virtual void finishAllRendering() = 0;
-
- virtual bool isStarted() const = 0;
-
- // Attempts to initialize a context to use for rendering. Returns false if the context could not be created.
- // The context will not be used and no frames may be produced until initializeRenderer() is called.
- virtual bool initializeContext() = 0;
-
- // Indicates that the compositing surface associated with our context is ready to use.
- virtual void setSurfaceReady() = 0;
-
- virtual void setVisible(bool) = 0;
-
- // Attempts to initialize the layer renderer. Returns false if the context isn't usable for compositing.
- virtual bool initializeRenderer() = 0;
-
- // Attempts to recreate the context and layer renderer after a context lost. Returns false if the renderer couldn't be
- // reinitialized.
- virtual bool recreateContext() = 0;
-
- virtual void renderingStats(CCRenderingStats*) = 0;
-
- virtual const RendererCapabilities& rendererCapabilities() const = 0;
-
- virtual void setNeedsAnimate() = 0;
- virtual void setNeedsCommit() = 0;
- virtual void setNeedsRedraw() = 0;
-
- virtual void didAddAnimation() = 0;
-
- virtual bool commitRequested() const = 0;
-
- virtual void start() = 0; // Must be called before using the proxy.
- virtual void stop() = 0; // Must be called before deleting the proxy.
-
- // Forces 3D commands on all contexts to wait for all previous SwapBuffers to finish before executing in the GPU
- // process.
- virtual void forceSerializeOnSwapBuffers() = 0;
-
- // Maximum number of sub-region texture updates supported for each commit.
- virtual size_t maxPartialTextureUpdates() const = 0;
-
- virtual void acquireLayerTextures() = 0;
-
- // Debug hooks
-#ifndef NDEBUG
- static bool isMainThread();
- static bool isImplThread();
- static bool isMainThreadBlocked();
- static void setMainThreadBlocked(bool);
-#endif
-
- // Testing hooks
- virtual void loseContext() = 0;
-
-#ifndef NDEBUG
- static void setCurrentThreadIsImplThread(bool);
-#endif
-
-protected:
- CCProxy();
- friend class DebugScopedSetImplThread;
- friend class DebugScopedSetMainThreadBlocked;
-
-private:
- DISALLOW_COPY_AND_ASSIGN(CCProxy);
-};
-
-class DebugScopedSetMainThreadBlocked {
-public:
- DebugScopedSetMainThreadBlocked()
- {
-#if !ASSERT_DISABLED
- ASSERT(!CCProxy::isMainThreadBlocked());
- CCProxy::setMainThreadBlocked(true);
-#endif
- }
- ~DebugScopedSetMainThreadBlocked()
- {
-#if !ASSERT_DISABLED
- ASSERT(CCProxy::isMainThreadBlocked());
- CCProxy::setMainThreadBlocked(false);
-#endif
- }
-};
-
-}
-
-#endif
+// Temporary forwarding header
+#include "cc/proxy.h"
diff --git a/cc/CCQuadCuller.h b/cc/CCQuadCuller.h
index b3927cc..097fb78 100644
--- a/cc/CCQuadCuller.h
+++ b/cc/CCQuadCuller.h
@@ -2,36 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCQuadCuller_h
-#define CCQuadCuller_h
-
-#include "CCQuadSink.h"
-#include "CCRenderPass.h"
-
-namespace cc {
-class CCLayerImpl;
-class CCRenderSurface;
-template<typename LayerType, typename SurfaceType>
-class CCOcclusionTrackerBase;
-
-class CCQuadCuller : public CCQuadSink {
-public:
- CCQuadCuller(CCQuadList&, CCSharedQuadStateList&, CCLayerImpl*, const CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface>*, bool showCullingWithDebugBorderQuads, bool forSurface);
- virtual ~CCQuadCuller() { }
-
- // CCQuadSink implementation.
- virtual CCSharedQuadState* useSharedQuadState(scoped_ptr<CCSharedQuadState>) OVERRIDE;
- virtual bool append(scoped_ptr<CCDrawQuad>, CCAppendQuadsData&) OVERRIDE;
-
-private:
- CCQuadList& m_quadList;
- CCSharedQuadStateList& m_sharedQuadStateList;
- CCSharedQuadState* m_currentSharedQuadState;
- CCLayerImpl* m_layer;
- const CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface>* m_occlusionTracker;
- bool m_showCullingWithDebugBorderQuads;
- bool m_forSurface;
-};
-
-}
-#endif // CCQuadCuller_h
+// Temporary forwarding header
+#include "cc/quad_culler.h"
diff --git a/cc/CCQuadSink.h b/cc/CCQuadSink.h
index 06d31b0..a503c6c 100644
--- a/cc/CCQuadSink.h
+++ b/cc/CCQuadSink.h
@@ -2,29 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCQuadSink_h
-#define CCQuadSink_h
-
-#include "base/memory/scoped_ptr.h"
-
-namespace cc {
-
-class CCDrawQuad;
-
-struct CCAppendQuadsData;
-struct CCSharedQuadState;
-
-class CCQuadSink {
-public:
- virtual ~CCQuadSink() { }
-
- // Call this to add a SharedQuadState before appending quads that refer to it. Returns a pointer
- // to the given SharedQuadState for convenience, that can be set on the quads to append.
- virtual CCSharedQuadState* useSharedQuadState(scoped_ptr<CCSharedQuadState>) = 0;
-
- // Returns true if the quad is added to the list, and false if the quad is entirely culled.
- virtual bool append(scoped_ptr<CCDrawQuad> passDrawQuad, CCAppendQuadsData&) = 0;
-};
-
-}
-#endif // CCQuadCuller_h
+// Temporary forwarding header
+#include "cc/quad_sink.h"
diff --git a/cc/CCRenderPass.h b/cc/CCRenderPass.h
index cdfa958..ab2ae64 100644
--- a/cc/CCRenderPass.h
+++ b/cc/CCRenderPass.h
@@ -1,140 +1,6 @@
-// Copyright 2011 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCRenderPass_h
-#define CCRenderPass_h
-
-#include "base/basictypes.h"
-#include "cc/hash_pair.h"
-#include "cc/scoped_ptr_hash_map.h"
-#include "cc/scoped_ptr_vector.h"
-#include "CCDrawQuad.h"
-#include "CCSharedQuadState.h"
-#include "FloatRect.h"
-#include "SkColor.h"
-#include <public/WebFilterOperations.h>
-#include <public/WebTransformationMatrix.h>
-#include <vector>
-
-namespace cc {
-
-class CCLayerImpl;
-template<typename LayerType, typename SurfaceType>
-class CCOcclusionTrackerBase;
-class CCRenderSurface;
-
-struct CCAppendQuadsData;
-
-typedef CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface> CCOcclusionTrackerImpl;
-
-// A list of CCDrawQuad objects, sorted internally in front-to-back order.
-class CCQuadList : public ScopedPtrVector<CCDrawQuad> {
-public:
- typedef reverse_iterator backToFrontIterator;
- typedef const_reverse_iterator constBackToFrontIterator;
-
- inline backToFrontIterator backToFrontBegin() { return rbegin(); }
- inline backToFrontIterator backToFrontEnd() { return rend(); }
- inline constBackToFrontIterator backToFrontBegin() const { return rbegin(); }
- inline constBackToFrontIterator backToFrontEnd() const { return rend(); }
-};
-
-typedef ScopedPtrVector<CCSharedQuadState> CCSharedQuadStateList;
-
-class CCRenderPass {
-public:
- ~CCRenderPass();
-
- struct Id {
- int layerId;
- int index;
-
- Id(int layerId, int index)
- : layerId(layerId)
- , index(index)
- {
- }
-
- bool operator==(const Id& other) const { return layerId == other.layerId && index == other.index; }
- bool operator!=(const Id& other) const { return !(*this == other); }
- bool operator<(const Id& other) const { return layerId < other.layerId || (layerId == other.layerId && index < other.index); }
- };
-
- static scoped_ptr<CCRenderPass> create(Id, IntRect outputRect, const WebKit::WebTransformationMatrix& transformToRootTarget);
-
- // A shallow copy of the render pass, which does not include its quads.
- scoped_ptr<CCRenderPass> copy(Id newId) const;
-
- void appendQuadsForLayer(CCLayerImpl*, CCOcclusionTrackerImpl*, CCAppendQuadsData&);
- void appendQuadsForRenderSurfaceLayer(CCLayerImpl*, const CCRenderPass* contributingRenderPass, CCOcclusionTrackerImpl*, CCAppendQuadsData&);
- void appendQuadsToFillScreen(CCLayerImpl* rootLayer, SkColor screenBackgroundColor, const CCOcclusionTrackerImpl&);
-
- const CCQuadList& quadList() const { return m_quadList; }
-
- Id id() const { return m_id; }
-
- // FIXME: Modify this transform when merging the RenderPass into a parent compositor.
- // Transforms from quad's original content space to the root target's content space.
- const WebKit::WebTransformationMatrix& transformToRootTarget() const { return m_transformToRootTarget; }
-
- // This denotes the bounds in physical pixels of the output generated by this RenderPass.
- const IntRect& outputRect() const { return m_outputRect; }
-
- FloatRect damageRect() const { return m_damageRect; }
- void setDamageRect(FloatRect rect) { m_damageRect = rect; }
-
- const WebKit::WebFilterOperations& filters() const { return m_filters; }
- void setFilters(const WebKit::WebFilterOperations& filters) { m_filters = filters; }
-
- const WebKit::WebFilterOperations& backgroundFilters() const { return m_backgroundFilters; }
- void setBackgroundFilters(const WebKit::WebFilterOperations& filters) { m_backgroundFilters = filters; }
-
- bool hasTransparentBackground() const { return m_hasTransparentBackground; }
- void setHasTransparentBackground(bool transparent) { m_hasTransparentBackground = transparent; }
-
- bool hasOcclusionFromOutsideTargetSurface() const { return m_hasOcclusionFromOutsideTargetSurface; }
- void setHasOcclusionFromOutsideTargetSurface(bool hasOcclusionFromOutsideTargetSurface) { m_hasOcclusionFromOutsideTargetSurface = hasOcclusionFromOutsideTargetSurface; }
-protected:
- CCRenderPass(Id, IntRect outputRect, const WebKit::WebTransformationMatrix& transformToRootTarget);
-
- Id m_id;
- CCQuadList m_quadList;
- CCSharedQuadStateList m_sharedQuadStateList;
- WebKit::WebTransformationMatrix m_transformToRootTarget;
- IntRect m_outputRect;
- FloatRect m_damageRect;
- bool m_hasTransparentBackground;
- bool m_hasOcclusionFromOutsideTargetSurface;
- WebKit::WebFilterOperations m_filters;
- WebKit::WebFilterOperations m_backgroundFilters;
-
- DISALLOW_COPY_AND_ASSIGN(CCRenderPass);
-};
-
-} // namespace cc
-
-namespace BASE_HASH_NAMESPACE {
-#if defined(COMPILER_MSVC)
-template<>
-inline size_t hash_value<cc::CCRenderPass::Id>(const cc::CCRenderPass::Id& key) {
- return hash_value<std::pair<int, int> >(std::pair<int, int>(key.layerId, key.index));
-}
-#elif defined(COMPILER_GCC)
-template<>
-struct hash<cc::CCRenderPass::Id> {
- size_t operator()(cc::CCRenderPass::Id key) const {
- return hash<std::pair<int, int> >()(std::pair<int, int>(key.layerId, key.index));
- }
-};
-#else
-#error define a hash function for your compiler
-#endif // COMPILER
-}
-
-namespace cc {
-typedef std::vector<CCRenderPass*> CCRenderPassList;
-typedef ScopedPtrHashMap<CCRenderPass::Id, CCRenderPass> CCRenderPassIdHashMap;
-} // namespace cc
-
-#endif
+// Temporary forwarding header
+#include "cc/render_pass.h"
diff --git a/cc/CCRenderPassDrawQuad.h b/cc/CCRenderPassDrawQuad.h
index 99222d9..d665960 100644
--- a/cc/CCRenderPassDrawQuad.h
+++ b/cc/CCRenderPassDrawQuad.h
@@ -1,51 +1,6 @@
-// Copyright 2011 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCRenderPassDrawQuad_h
-#define CCRenderPassDrawQuad_h
-
-#include "base/basictypes.h"
-#include "base/memory/scoped_ptr.h"
-#include "CCDrawQuad.h"
-#include "CCRenderPass.h"
-#include "CCResourceProvider.h"
-#include "IntRect.h"
-
-namespace cc {
-
-class CCRenderPassDrawQuad : public CCDrawQuad {
-public:
- static scoped_ptr<CCRenderPassDrawQuad> create(const CCSharedQuadState*, const IntRect&, CCRenderPass::Id renderPassId, bool isReplica, CCResourceProvider::ResourceId maskResourceId, const IntRect& contentsChangedSinceLastFrame, float maskTexCoordScaleX, float maskTexCoordScaleY, float maskTexCoordOffsetX, float maskTexCoordOffsetY);
-
- CCRenderPass::Id renderPassId() const { return m_renderPassId; }
- bool isReplica() const { return m_isReplica; }
- CCResourceProvider::ResourceId maskResourceId() const { return m_maskResourceId; }
- const IntRect& contentsChangedSinceLastFrame() const { return m_contentsChangedSinceLastFrame; }
-
- static const CCRenderPassDrawQuad* materialCast(const CCDrawQuad*);
- float maskTexCoordScaleX() const { return m_maskTexCoordScaleX; }
- float maskTexCoordScaleY() const { return m_maskTexCoordScaleY; }
- float maskTexCoordOffsetX() const { return m_maskTexCoordOffsetX; }
- float maskTexCoordOffsetY() const { return m_maskTexCoordOffsetY; }
-
- scoped_ptr<CCRenderPassDrawQuad> copy(const CCSharedQuadState* copiedSharedQuadState, CCRenderPass::Id copiedRenderPassId) const;
-
-private:
- CCRenderPassDrawQuad(const CCSharedQuadState*, const IntRect&, CCRenderPass::Id renderPassId, bool isReplica, CCResourceProvider::ResourceId maskResourceId, const IntRect& contentsChangedSinceLastFrame, float maskTexCoordScaleX, float maskTexCoordScaleY, float maskTexCoordOffsetX, float maskTexCoordOffsetY);
-
- CCRenderPass::Id m_renderPassId;
- bool m_isReplica;
- CCResourceProvider::ResourceId m_maskResourceId;
- IntRect m_contentsChangedSinceLastFrame;
- float m_maskTexCoordScaleX;
- float m_maskTexCoordScaleY;
- float m_maskTexCoordOffsetX;
- float m_maskTexCoordOffsetY;
-
- DISALLOW_COPY_AND_ASSIGN(CCRenderPassDrawQuad);
-};
-
-}
-
-#endif
+// Temporary forwarding header
+#include "cc/render_pass_draw_quad.h"
diff --git a/cc/CCRenderPassSink.h b/cc/CCRenderPassSink.h
index f3bac1d..6f8bf64 100644
--- a/cc/CCRenderPassSink.h
+++ b/cc/CCRenderPassSink.h
@@ -2,19 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCRenderPassSink_h
-#define CCRenderPassSink_h
-
-#include "base/memory/scoped_ptr.h"
-
-namespace cc {
-
-class CCRenderPass;
-
-class CCRenderPassSink {
-public:
- virtual void appendRenderPass(scoped_ptr<CCRenderPass>) = 0;
-};
-
-}
-#endif // CCRenderPassSink_h
+// Temporary forwarding header
+#include "cc/render_pass_sink.h"
diff --git a/cc/CCRenderSurface.h b/cc/CCRenderSurface.h
index afdf062..7747efd 100644
--- a/cc/CCRenderSurface.h
+++ b/cc/CCRenderSurface.h
@@ -1,132 +1,6 @@
-// Copyright 2011 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCRenderSurface_h
-#define CCRenderSurface_h
-
-#if USE(ACCELERATED_COMPOSITING)
-
-#include "base/basictypes.h"
-#include "base/memory/scoped_ptr.h"
-#include "CCRenderPass.h"
-#include "CCSharedQuadState.h"
-#include "FloatRect.h"
-#include "IntRect.h"
-#include <public/WebTransformationMatrix.h>
-
-namespace cc {
-
-class CCDamageTracker;
-class CCDelegatedRendererLayerImpl;
-class CCQuadSink;
-class CCRenderPassSink;
-class CCLayerImpl;
-
-struct CCAppendQuadsData;
-
-class CCRenderSurface {
-public:
- explicit CCRenderSurface(CCLayerImpl*);
- virtual ~CCRenderSurface();
-
- std::string name() const;
- void dumpSurface(std::string*, int indent) const;
-
- FloatPoint contentRectCenter() const { return FloatRect(m_contentRect).center(); }
-
- // Returns the rect that encloses the RenderSurface including any reflection.
- FloatRect drawableContentRect() const;
-
- float drawOpacity() const { return m_drawOpacity; }
- void setDrawOpacity(float opacity) { m_drawOpacity = opacity; }
-
- void setNearestAncestorThatMovesPixels(CCRenderSurface* surface) { m_nearestAncestorThatMovesPixels = surface; }
- const CCRenderSurface* nearestAncestorThatMovesPixels() const { return m_nearestAncestorThatMovesPixels; }
-
- bool drawOpacityIsAnimating() const { return m_drawOpacityIsAnimating; }
- void setDrawOpacityIsAnimating(bool drawOpacityIsAnimating) { m_drawOpacityIsAnimating = drawOpacityIsAnimating; }
-
- void setDrawTransform(const WebKit::WebTransformationMatrix& drawTransform) { m_drawTransform = drawTransform; }
- const WebKit::WebTransformationMatrix& drawTransform() const { return m_drawTransform; }
-
- void setScreenSpaceTransform(const WebKit::WebTransformationMatrix& screenSpaceTransform) { m_screenSpaceTransform = screenSpaceTransform; }
- const WebKit::WebTransformationMatrix& screenSpaceTransform() const { return m_screenSpaceTransform; }
-
- void setReplicaDrawTransform(const WebKit::WebTransformationMatrix& replicaDrawTransform) { m_replicaDrawTransform = replicaDrawTransform; }
- const WebKit::WebTransformationMatrix& replicaDrawTransform() const { return m_replicaDrawTransform; }
-
- void setReplicaScreenSpaceTransform(const WebKit::WebTransformationMatrix& replicaScreenSpaceTransform) { m_replicaScreenSpaceTransform = replicaScreenSpaceTransform; }
- const WebKit::WebTransformationMatrix& replicaScreenSpaceTransform() const { return m_replicaScreenSpaceTransform; }
-
- bool targetSurfaceTransformsAreAnimating() const { return m_targetSurfaceTransformsAreAnimating; }
- void setTargetSurfaceTransformsAreAnimating(bool animating) { m_targetSurfaceTransformsAreAnimating = animating; }
- bool screenSpaceTransformsAreAnimating() const { return m_screenSpaceTransformsAreAnimating; }
- void setScreenSpaceTransformsAreAnimating(bool animating) { m_screenSpaceTransformsAreAnimating = animating; }
-
- void setClipRect(const IntRect&);
- const IntRect& clipRect() const { return m_clipRect; }
-
- bool contentsChanged() const;
-
- void setContentRect(const IntRect&);
- const IntRect& contentRect() const { return m_contentRect; }
-
- std::vector<CCLayerImpl*>& layerList() { return m_layerList; }
- void addContributingDelegatedRenderPassLayer(CCLayerImpl*);
- void clearLayerLists();
-
- int owningLayerId() const;
-
- void resetPropertyChangedFlag() { m_surfacePropertyChanged = false; }
- bool surfacePropertyChanged() const;
- bool surfacePropertyChangedOnlyFromDescendant() const;
-
- CCDamageTracker* damageTracker() const { return m_damageTracker.get(); }
-
- CCRenderPass::Id renderPassId();
-
- void appendRenderPasses(CCRenderPassSink&);
- void appendQuads(CCQuadSink&, CCAppendQuadsData&, bool forReplica, CCRenderPass::Id renderPassId);
-
-private:
- CCLayerImpl* m_owningLayer;
-
- // Uses this surface's space.
- IntRect m_contentRect;
- bool m_surfacePropertyChanged;
-
- float m_drawOpacity;
- bool m_drawOpacityIsAnimating;
- WebKit::WebTransformationMatrix m_drawTransform;
- WebKit::WebTransformationMatrix m_screenSpaceTransform;
- WebKit::WebTransformationMatrix m_replicaDrawTransform;
- WebKit::WebTransformationMatrix m_replicaScreenSpaceTransform;
- bool m_targetSurfaceTransformsAreAnimating;
- bool m_screenSpaceTransformsAreAnimating;
-
- // Uses the space of the surface's target surface.
- IntRect m_clipRect;
-
- std::vector<CCLayerImpl*> m_layerList;
- std::vector<CCDelegatedRendererLayerImpl*> m_contributingDelegatedRenderPassLayerList;
-
- // The nearest ancestor target surface that will contain the contents of this surface, and that is going
- // to move pixels within the surface (such as with a blur). This can point to itself.
- CCRenderSurface* m_nearestAncestorThatMovesPixels;
-
- scoped_ptr<CCDamageTracker> m_damageTracker;
-
- // For CCLayerIteratorActions
- int m_targetRenderSurfaceLayerIndexHistory;
- int m_currentLayerIndexHistory;
-
- friend struct CCLayerIteratorActions;
-
- DISALLOW_COPY_AND_ASSIGN(CCRenderSurface);
-};
-
-}
-#endif // USE(ACCELERATED_COMPOSITING)
-
-#endif
+// Temporary forwarding header
+#include "cc/render_surface_impl.h"
diff --git a/cc/CCRenderSurfaceFilters.h b/cc/CCRenderSurfaceFilters.h
index cd199b5..f102a22 100644
--- a/cc/CCRenderSurfaceFilters.h
+++ b/cc/CCRenderSurfaceFilters.h
@@ -2,33 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-
-#ifndef CCRenderSurfaceFilters_h
-#define CCRenderSurfaceFilters_h
-
-#if USE(ACCELERATED_COMPOSITING)
-
-class GrContext;
-class SkBitmap;
-
-namespace WebKit {
-class WebFilterOperations;
-class WebGraphicsContext3D;
-}
-
-namespace cc {
-class FloatSize;
-
-class CCRenderSurfaceFilters {
-public:
- static SkBitmap apply(const WebKit::WebFilterOperations& filters, unsigned textureId, const FloatSize&, WebKit::WebGraphicsContext3D*, GrContext*);
- static WebKit::WebFilterOperations optimize(const WebKit::WebFilterOperations& filters);
-
-private:
- CCRenderSurfaceFilters();
-};
-
-}
-#endif // USE(ACCELERATED_COMPOSITING)
-
-#endif
+// Temporary forwarding header
+#include "cc/render_surface_filters.h"
diff --git a/cc/CCRenderer.h b/cc/CCRenderer.h
index 740ba0b..3e37b7f 100644
--- a/cc/CCRenderer.h
+++ b/cc/CCRenderer.h
@@ -2,83 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCRenderer_h
-#define CCRenderer_h
-
-#include "base/basictypes.h"
-#include "CCLayerTreeHost.h"
-#include "CCRenderPass.h"
-#include "FloatQuad.h"
-#include "IntRect.h"
-#include <wtf/PassRefPtr.h>
-
-namespace cc {
-
-class CCScopedTexture;
-
-class CCRendererClient {
-public:
- virtual const IntSize& deviceViewportSize() const = 0;
- virtual const CCLayerTreeSettings& settings() const = 0;
- virtual void didLoseContext() = 0;
- virtual void onSwapBuffersComplete() = 0;
- virtual void releaseContentsTextures() = 0;
- virtual void setFullRootLayerDamage() = 0;
- virtual void setMemoryAllocationLimitBytes(size_t) = 0;
-protected:
- virtual ~CCRendererClient() { }
-};
-
-class CCRenderer {
-public:
- // This enum defines the various resource pools for the CCResourceProvider
- // where textures get allocated.
- enum ResourcePool {
- ImplPool = 1, // This pool is for textures that get allocated on the impl thread (e.g. RenderSurfaces).
- ContentPool // This pool is for textures that get allocated on the main thread (e.g. tiles).
- };
-
- virtual ~CCRenderer() { }
-
- virtual const RendererCapabilities& capabilities() const = 0;
-
- const CCLayerTreeSettings& settings() const { return m_client->settings(); }
-
- const IntSize& viewportSize() { return m_client->deviceViewportSize(); }
- int viewportWidth() { return viewportSize().width(); }
- int viewportHeight() { return viewportSize().height(); }
-
- virtual void viewportChanged() { }
-
- virtual void decideRenderPassAllocationsForFrame(const CCRenderPassList&) { }
- virtual bool haveCachedResourcesForRenderPassId(CCRenderPass::Id) const;
-
- virtual void drawFrame(const CCRenderPassList&, const CCRenderPassIdHashMap&) = 0;
-
- // waits for rendering to finish
- virtual void finish() = 0;
-
- virtual void doNoOp() { }
- // puts backbuffer onscreen
- virtual bool swapBuffers() = 0;
-
- virtual void getFramebufferPixels(void *pixels, const IntRect&) = 0;
-
- virtual bool isContextLost();
-
- virtual void setVisible(bool) = 0;
-
-protected:
- explicit CCRenderer(CCRendererClient* client)
- : m_client(client)
- {
- }
-
- CCRendererClient* m_client;
-
- DISALLOW_COPY_AND_ASSIGN(CCRenderer);
-};
-
-}
-
-#endif // CCRenderer_h
+// Temporary forwarding header
+#include "cc/renderer.h"
diff --git a/cc/CCRendererGL.h b/cc/CCRendererGL.h
index a5f2c4f..a4458d6 100644
--- a/cc/CCRendererGL.h
+++ b/cc/CCRendererGL.h
@@ -1,240 +1,6 @@
-// Copyright 2010 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-
-#ifndef CCRendererGL_h
-#define CCRendererGL_h
-
-#if USE(ACCELERATED_COMPOSITING)
-
-#include "base/basictypes.h"
-#include "CCCheckerboardDrawQuad.h"
-#include "CCDebugBorderDrawQuad.h"
-#include "CCDirectRenderer.h"
-#include "CCIOSurfaceDrawQuad.h"
-#include "CCRenderPassDrawQuad.h"
-#include "CCRenderer.h"
-#include "CCSolidColorDrawQuad.h"
-#include "CCStreamVideoDrawQuad.h"
-#include "CCTextureDrawQuad.h"
-#include "CCTileDrawQuad.h"
-#include "CCYUVVideoDrawQuad.h"
-#include "Extensions3DChromium.h"
-#include <wtf/PassOwnPtr.h>
-
-namespace WebKit {
-class WebGraphicsContext3D;
-}
-
-namespace cc {
-
-class CCScopedTexture;
-class GeometryBinding;
-class ScopedEnsureFramebufferAllocation;
-
-// Class that handles drawing of composited render layers using GL.
-class CCRendererGL : public CCDirectRenderer,
- public WebKit::WebGraphicsContext3D::WebGraphicsSwapBuffersCompleteCallbackCHROMIUM,
- public WebKit::WebGraphicsContext3D::WebGraphicsMemoryAllocationChangedCallbackCHROMIUM ,
- public WebKit::WebGraphicsContext3D::WebGraphicsContextLostCallback {
-public:
- static PassOwnPtr<CCRendererGL> create(CCRendererClient*, CCResourceProvider*);
-
- virtual ~CCRendererGL();
-
- virtual const RendererCapabilities& capabilities() const OVERRIDE;
-
- WebKit::WebGraphicsContext3D* context();
-
- virtual void viewportChanged() OVERRIDE;
-
- const FloatQuad& sharedGeometryQuad() const { return m_sharedGeometryQuad; }
-
- // waits for rendering to finish
- virtual void finish() OVERRIDE;
-
- virtual void doNoOp() OVERRIDE;
- // puts backbuffer onscreen
- virtual bool swapBuffers() OVERRIDE;
-
- static void debugGLCall(WebKit::WebGraphicsContext3D*, const char* command, const char* file, int line);
-
- const GeometryBinding* sharedGeometry() const { return m_sharedGeometry.get(); }
-
- virtual void getFramebufferPixels(void *pixels, const IntRect&) OVERRIDE;
- bool getFramebufferTexture(CCScopedTexture*, const IntRect& deviceRect);
-
- virtual bool isContextLost() OVERRIDE;
-
- virtual void setVisible(bool) OVERRIDE;
-
-protected:
- CCRendererGL(CCRendererClient*, CCResourceProvider*);
-
- bool isFramebufferDiscarded() const { return m_isFramebufferDiscarded; }
- bool initialize();
-
- void releaseRenderPassTextures();
-
- virtual void bindFramebufferToOutputSurface(DrawingFrame&) OVERRIDE;
- virtual bool bindFramebufferToTexture(DrawingFrame&, const CCScopedTexture*, const IntRect& framebufferRect) OVERRIDE;
- virtual void setDrawViewportSize(const IntSize&) OVERRIDE;
- virtual void enableScissorTestRect(const IntRect& scissorRect) OVERRIDE;
- virtual void disableScissorTest() OVERRIDE;
- virtual void clearFramebuffer(DrawingFrame&) OVERRIDE;
- virtual void drawQuad(DrawingFrame&, const CCDrawQuad*) OVERRIDE;
- virtual void beginDrawingFrame(DrawingFrame&) OVERRIDE;
- virtual void finishDrawingFrame(DrawingFrame&) OVERRIDE;
- virtual bool flippedFramebuffer() const OVERRIDE;
-
-private:
- static void toGLMatrix(float*, const WebKit::WebTransformationMatrix&);
-
- void drawCheckerboardQuad(const DrawingFrame&, const CCCheckerboardDrawQuad*);
- void drawDebugBorderQuad(const DrawingFrame&, const CCDebugBorderDrawQuad*);
- PassOwnPtr<CCScopedTexture> drawBackgroundFilters(DrawingFrame&, const CCRenderPassDrawQuad*, const WebKit::WebFilterOperations&, const WebKit::WebTransformationMatrix& deviceTransform);
- void drawRenderPassQuad(DrawingFrame&, const CCRenderPassDrawQuad*);
- void drawSolidColorQuad(const DrawingFrame&, const CCSolidColorDrawQuad*);
- void drawStreamVideoQuad(const DrawingFrame&, const CCStreamVideoDrawQuad*);
- void drawTextureQuad(const DrawingFrame&, const CCTextureDrawQuad*);
- void drawIOSurfaceQuad(const DrawingFrame&, const CCIOSurfaceDrawQuad*);
- void drawTileQuad(const DrawingFrame&, const CCTileDrawQuad*);
- void drawYUVVideoQuad(const DrawingFrame&, const CCYUVVideoDrawQuad*);
-
- void setShaderOpacity(float opacity, int alphaLocation);
- void setShaderFloatQuad(const FloatQuad&, int quadLocation);
- void drawQuadGeometry(const DrawingFrame&, const WebKit::WebTransformationMatrix& drawTransform, const FloatRect& quadRect, int matrixLocation);
-
- void copyTextureToFramebuffer(const DrawingFrame&, int textureId, const IntRect&, const WebKit::WebTransformationMatrix& drawMatrix);
-
- bool useScopedTexture(DrawingFrame&, const CCScopedTexture*, const IntRect& viewportRect);
-
- bool makeContextCurrent();
-
- bool initializeSharedObjects();
- void cleanupSharedObjects();
-
- // WebKit::WebGraphicsContext3D::WebGraphicsSwapBuffersCompleteCallbackCHROMIUM implementation.
- virtual void onSwapBuffersComplete() OVERRIDE;
-
- // WebKit::WebGraphicsContext3D::WebGraphicsMemoryAllocationChangedCallbackCHROMIUM implementation.
- virtual void onMemoryAllocationChanged(WebKit::WebGraphicsMemoryAllocation) OVERRIDE;
- void onMemoryAllocationChangedOnImplThread(WebKit::WebGraphicsMemoryAllocation);
- void discardFramebuffer();
- void ensureFramebuffer();
-
- // WebGraphicsContext3D::WebGraphicsContextLostCallback implementation.
- virtual void onContextLost() OVERRIDE;
-
- RendererCapabilities m_capabilities;
-
- unsigned m_offscreenFramebufferId;
-
- OwnPtr<GeometryBinding> m_sharedGeometry;
- FloatQuad m_sharedGeometryQuad;
-
- // This block of bindings defines all of the programs used by the compositor itself.
-
- // Tiled layer shaders.
- typedef ProgramBinding<VertexShaderTile, FragmentShaderRGBATexAlpha> TileProgram;
- typedef ProgramBinding<VertexShaderTile, FragmentShaderRGBATexClampAlphaAA> TileProgramAA;
- typedef ProgramBinding<VertexShaderTile, FragmentShaderRGBATexClampSwizzleAlphaAA> TileProgramSwizzleAA;
- typedef ProgramBinding<VertexShaderTile, FragmentShaderRGBATexOpaque> TileProgramOpaque;
- typedef ProgramBinding<VertexShaderTile, FragmentShaderRGBATexSwizzleAlpha> TileProgramSwizzle;
- typedef ProgramBinding<VertexShaderTile, FragmentShaderRGBATexSwizzleOpaque> TileProgramSwizzleOpaque;
- typedef ProgramBinding<VertexShaderPosTex, FragmentShaderCheckerboard> TileCheckerboardProgram;
-
- // Render surface shaders.
- typedef ProgramBinding<VertexShaderPosTex, FragmentShaderRGBATexAlpha> RenderPassProgram;
- typedef ProgramBinding<VertexShaderPosTex, FragmentShaderRGBATexAlphaMask> RenderPassMaskProgram;
- typedef ProgramBinding<VertexShaderQuad, FragmentShaderRGBATexAlphaAA> RenderPassProgramAA;
- typedef ProgramBinding<VertexShaderQuad, FragmentShaderRGBATexAlphaMaskAA> RenderPassMaskProgramAA;
-
- // Texture shaders.
- typedef ProgramBinding<VertexShaderPosTexTransform, FragmentShaderRGBATexAlpha> TextureProgram;
- typedef ProgramBinding<VertexShaderPosTexTransform, FragmentShaderRGBATexFlipAlpha> TextureProgramFlip;
- typedef ProgramBinding<VertexShaderPosTexTransform, FragmentShaderRGBATexRectAlpha> TextureIOSurfaceProgram;
-
- // Video shaders.
- typedef ProgramBinding<VertexShaderVideoTransform, FragmentShaderOESImageExternal> VideoStreamTextureProgram;
- typedef ProgramBinding<VertexShaderPosTexYUVStretch, FragmentShaderYUVVideo> VideoYUVProgram;
-
- // Special purpose / effects shaders.
- typedef ProgramBinding<VertexShaderPos, FragmentShaderColor> SolidColorProgram;
-
- const TileProgram* tileProgram();
- const TileProgramOpaque* tileProgramOpaque();
- const TileProgramAA* tileProgramAA();
- const TileProgramSwizzle* tileProgramSwizzle();
- const TileProgramSwizzleOpaque* tileProgramSwizzleOpaque();
- const TileProgramSwizzleAA* tileProgramSwizzleAA();
- const TileCheckerboardProgram* tileCheckerboardProgram();
-
- const RenderPassProgram* renderPassProgram();
- const RenderPassProgramAA* renderPassProgramAA();
- const RenderPassMaskProgram* renderPassMaskProgram();
- const RenderPassMaskProgramAA* renderPassMaskProgramAA();
-
- const TextureProgram* textureProgram();
- const TextureProgramFlip* textureProgramFlip();
- const TextureIOSurfaceProgram* textureIOSurfaceProgram();
-
- const VideoYUVProgram* videoYUVProgram();
- const VideoStreamTextureProgram* videoStreamTextureProgram();
-
- const SolidColorProgram* solidColorProgram();
-
- OwnPtr<TileProgram> m_tileProgram;
- OwnPtr<TileProgramOpaque> m_tileProgramOpaque;
- OwnPtr<TileProgramAA> m_tileProgramAA;
- OwnPtr<TileProgramSwizzle> m_tileProgramSwizzle;
- OwnPtr<TileProgramSwizzleOpaque> m_tileProgramSwizzleOpaque;
- OwnPtr<TileProgramSwizzleAA> m_tileProgramSwizzleAA;
- OwnPtr<TileCheckerboardProgram> m_tileCheckerboardProgram;
-
- OwnPtr<RenderPassProgram> m_renderPassProgram;
- OwnPtr<RenderPassProgramAA> m_renderPassProgramAA;
- OwnPtr<RenderPassMaskProgram> m_renderPassMaskProgram;
- OwnPtr<RenderPassMaskProgramAA> m_renderPassMaskProgramAA;
-
- OwnPtr<TextureProgram> m_textureProgram;
- OwnPtr<TextureProgramFlip> m_textureProgramFlip;
- OwnPtr<TextureIOSurfaceProgram> m_textureIOSurfaceProgram;
-
- OwnPtr<VideoYUVProgram> m_videoYUVProgram;
- OwnPtr<VideoStreamTextureProgram> m_videoStreamTextureProgram;
-
- OwnPtr<SolidColorProgram> m_solidColorProgram;
-
- WebKit::WebGraphicsContext3D* m_context;
-
- IntRect m_swapBufferRect;
- bool m_isViewportChanged;
- bool m_isFramebufferDiscarded;
- bool m_isUsingBindUniform;
- bool m_visible;
-
- OwnPtr<CCResourceProvider::ScopedWriteLockGL> m_currentFramebufferLock;
-
- DISALLOW_COPY_AND_ASSIGN(CCRendererGL);
-};
-
-
-// Setting DEBUG_GL_CALLS to 1 will call glGetError() after almost every GL
-// call made by the compositor. Useful for debugging rendering issues but
-// will significantly degrade performance.
-#define DEBUG_GL_CALLS 0
-
-#if DEBUG_GL_CALLS && !defined ( NDEBUG )
-#define GLC(context, x) (x, CCRendererGL::debugGLCall(&*context, #x, __FILE__, __LINE__))
-#else
-#define GLC(context, x) (x)
-#endif
-
-
-}
-
-#endif // USE(ACCELERATED_COMPOSITING)
-
-#endif
+// Temporary forwarding header
+#include "cc/gl_renderer.h"
diff --git a/cc/CCRendererSoftware.h b/cc/CCRendererSoftware.h
index 2ad688f..827aa21 100644
--- a/cc/CCRendererSoftware.h
+++ b/cc/CCRendererSoftware.h
@@ -2,75 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCRendererSoftware_h
-#define CCRendererSoftware_h
-
-#include "base/basictypes.h"
-#include "CCDirectRenderer.h"
-#include "CCLayerTreeHost.h"
-#include <public/WebCompositorSoftwareOutputDevice.h>
-
-namespace cc {
-
-class CCDebugBorderDrawQuad;
-class CCRendererClient;
-class CCResourceProvider;
-class CCSolidColorDrawQuad;
-class CCTextureDrawQuad;
-class CCTileDrawQuad;
-
-class CCRendererSoftware : public CCDirectRenderer {
-public:
- static PassOwnPtr<CCRendererSoftware> create(CCRendererClient*, CCResourceProvider*, WebKit::WebCompositorSoftwareOutputDevice*);
- virtual ~CCRendererSoftware();
-
- virtual const RendererCapabilities& capabilities() const OVERRIDE;
-
- virtual void viewportChanged() OVERRIDE;
-
- virtual void finish() OVERRIDE;
-
- virtual bool swapBuffers() OVERRIDE;
-
- virtual void getFramebufferPixels(void *pixels, const IntRect&) OVERRIDE;
-
- virtual void setVisible(bool) OVERRIDE;
-
-protected:
- virtual void bindFramebufferToOutputSurface(DrawingFrame&) OVERRIDE;
- virtual bool bindFramebufferToTexture(DrawingFrame&, const CCScopedTexture*, const IntRect& framebufferRect) OVERRIDE;
- virtual void setDrawViewportSize(const IntSize&) OVERRIDE;
- virtual void enableScissorTestRect(const IntRect& scissorRect) OVERRIDE;
- virtual void disableScissorTest() OVERRIDE;
- virtual void clearFramebuffer(DrawingFrame&) OVERRIDE;
- virtual void drawQuad(DrawingFrame&, const CCDrawQuad*) OVERRIDE;
- virtual void beginDrawingFrame(DrawingFrame&) OVERRIDE;
- virtual void finishDrawingFrame(DrawingFrame&) OVERRIDE;
- virtual bool flippedFramebuffer() const OVERRIDE;
-
-private:
- CCRendererSoftware(CCRendererClient*, CCResourceProvider*, WebKit::WebCompositorSoftwareOutputDevice*);
-
- bool isSoftwareResource(CCResourceProvider::ResourceId) const;
-
- void drawDebugBorderQuad(const DrawingFrame&, const CCDebugBorderDrawQuad*);
- void drawSolidColorQuad(const DrawingFrame&, const CCSolidColorDrawQuad*);
- void drawTextureQuad(const DrawingFrame&, const CCTextureDrawQuad*);
- void drawTileQuad(const DrawingFrame&, const CCTileDrawQuad*);
- void drawUnsupportedQuad(const DrawingFrame&, const CCDrawQuad*);
-
- RendererCapabilities m_capabilities;
- bool m_visible;
-
- WebKit::WebCompositorSoftwareOutputDevice* m_outputDevice;
- OwnPtr<SkCanvas> m_skRootCanvas;
- SkCanvas* m_skCurrentCanvas;
- SkPaint m_skCurrentPaint;
- OwnPtr<CCResourceProvider::ScopedWriteLockSoftware> m_currentFramebufferLock;
-
- DISALLOW_COPY_AND_ASSIGN(CCRendererSoftware);
-};
-
-}
-
-#endif
+// Temporary forwarding header
+#include "cc/software_renderer.h"
diff --git a/cc/CCRenderingStats.h b/cc/CCRenderingStats.h
index fb178a8..d95e987 100644
--- a/cc/CCRenderingStats.h
+++ b/cc/CCRenderingStats.h
@@ -2,37 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCRenderingStats_h
-#define CCRenderingStats_h
-
-namespace cc {
-
-struct CCRenderingStats {
- // FIXME: Rename these to animationFrameCount and screenFrameCount, crbug.com/138641.
- int numAnimationFrames;
- int numFramesSentToScreen;
- int droppedFrameCount;
- double totalPaintTimeInSeconds;
- double totalRasterizeTimeInSeconds;
- double totalCommitTimeInSeconds;
- size_t totalCommitCount;
- size_t numImplThreadScrolls;
- size_t numMainThreadScrolls;
-
- CCRenderingStats()
- : numAnimationFrames(0)
- , numFramesSentToScreen(0)
- , droppedFrameCount(0)
- , totalPaintTimeInSeconds(0)
- , totalRasterizeTimeInSeconds(0)
- , totalCommitTimeInSeconds(0)
- , totalCommitCount(0)
- , numImplThreadScrolls(0)
- , numMainThreadScrolls(0)
- {
- }
-};
-
-}
-
-#endif
+// Temporary forwarding header
+#include "cc/rendering_stats.h"
diff --git a/cc/CCResourceProvider.h b/cc/CCResourceProvider.h
index f515c11..be760bb 100644
--- a/cc/CCResourceProvider.h
+++ b/cc/CCResourceProvider.h
@@ -2,274 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCResourceProvider_h
-#define CCResourceProvider_h
-
-#include "base/basictypes.h"
-#include "CCGraphicsContext.h"
-#include "GraphicsContext3D.h"
-#include "IntSize.h"
-#include "SkBitmap.h"
-#include "SkCanvas.h"
-#include "TextureCopier.h"
-#include <wtf/Deque.h>
-#include <wtf/HashMap.h>
-#include <wtf/OwnPtr.h>
-#include <wtf/PassOwnPtr.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefPtr.h>
-#include <wtf/Vector.h>
-
-namespace WebKit {
-class WebGraphicsContext3D;
-}
-
-namespace cc {
-
-class IntRect;
-class LayerTextureSubImage;
-class TextureCopier;
-class TextureUploader;
-
-// Thread-safety notes: this class is not thread-safe and can only be called
-// from the thread it was created on (in practice, the compositor thread).
-class CCResourceProvider {
-public:
- typedef unsigned ResourceId;
- typedef Vector<ResourceId> ResourceIdArray;
- typedef HashMap<ResourceId, ResourceId> ResourceIdMap;
- enum TextureUsageHint { TextureUsageAny, TextureUsageFramebuffer };
- enum ResourceType {
- GLTexture = 1,
- Bitmap,
- };
- struct Mailbox {
- GC3Dbyte name[64];
- };
- struct TransferableResource {
- unsigned id;
- GC3Denum format;
- IntSize size;
- Mailbox mailbox;
- };
- typedef Vector<TransferableResource> TransferableResourceArray;
- struct TransferableResourceList {
- TransferableResourceList();
- ~TransferableResourceList();
-
- TransferableResourceArray resources;
- unsigned syncPoint;
- };
-
- static PassOwnPtr<CCResourceProvider> create(CCGraphicsContext*);
-
- virtual ~CCResourceProvider();
-
- WebKit::WebGraphicsContext3D* graphicsContext3D();
- TextureUploader* textureUploader() const { return m_textureUploader.get(); }
- TextureCopier* textureCopier() const { return m_textureCopier.get(); }
- int maxTextureSize() const { return m_maxTextureSize; }
- unsigned numResources() const { return m_resources.size(); }
-
- // Checks whether a resource is in use by a consumer.
- bool inUseByConsumer(ResourceId);
-
-
- // Producer interface.
-
- void setDefaultResourceType(ResourceType type) { m_defaultResourceType = type; }
- ResourceType defaultResourceType() const { return m_defaultResourceType; }
- ResourceType resourceType(ResourceId);
-
- // Creates a resource of the default resource type.
- ResourceId createResource(int pool, const IntSize&, GC3Denum format, TextureUsageHint);
-
- // You can also explicitly create a specific resource type.
- ResourceId createGLTexture(int pool, const IntSize&, GC3Denum format, TextureUsageHint);
- ResourceId createBitmap(int pool, const IntSize&);
- // Wraps an external texture into a GL resource.
- ResourceId createResourceFromExternalTexture(unsigned textureId);
-
- void deleteResource(ResourceId);
-
- // Deletes all resources owned by a given pool.
- void deleteOwnedResources(int pool);
-
- // Upload data from image, copying sourceRect (in image) into destRect (in the resource).
- void upload(ResourceId, const uint8_t* image, const IntRect& imageRect, const IntRect& sourceRect, const IntSize& destOffset);
-
- // Flush all context operations, kicking uploads and ensuring ordering with
- // respect to other contexts.
- void flush();
-
- // Only flush the command buffer if supported.
- // Returns true if the shallow flush occurred, false otherwise.
- bool shallowFlushIfSupported();
-
- // Creates accounting for a child, and associate it with a pool. Resources
- // transfered from that child will go to that pool. Returns a child ID.
- int createChild(int pool);
-
- // Destroys accounting for the child, deleting all resources from that pool.
- void destroyChild(int child);
-
- // Gets the child->parent resource ID map.
- const ResourceIdMap& getChildToParentMap(int child) const;
-
- // Prepares resources to be transfered to the parent, moving them to
- // mailboxes and serializing meta-data into TransferableResources.
- // Resources are not removed from the CCResourceProvider, but are markes as
- // "in use".
- TransferableResourceList prepareSendToParent(const ResourceIdArray&);
-
- // Prepares resources to be transfered back to the child, moving them to
- // mailboxes and serializing meta-data into TransferableResources.
- // Resources are removed from the CCResourceProvider. Note: the resource IDs
- // passed are in the parent namespace and will be translated to the child
- // namespace when returned.
- TransferableResourceList prepareSendToChild(int child, const ResourceIdArray&);
-
- // Receives resources from a child, moving them from mailboxes. Resource IDs
- // passed are in the child namespace, and will be translated to the parent
- // namespace, added to the child->parent map.
- // NOTE: if the syncPoint filed in TransferableResourceList is set, this
- // will wait on it.
- void receiveFromChild(int child, const TransferableResourceList&);
-
- // Receives resources from the parent, moving them from mailboxes. Resource IDs
- // passed are in the child namespace.
- // NOTE: if the syncPoint filed in TransferableResourceList is set, this
- // will wait on it.
- void receiveFromParent(const TransferableResourceList&);
-
- // Only for testing
- size_t mailboxCount() const { return m_mailboxes.size(); }
-
- // The following lock classes are part of the CCResourceProvider API and are
- // needed to read and write the resource contents. The user must ensure
- // that they only use GL locks on GL resources, etc, and this is enforced
- // by assertions.
- class ScopedReadLockGL {
- public:
- ScopedReadLockGL(CCResourceProvider*, CCResourceProvider::ResourceId);
- ~ScopedReadLockGL();
-
- unsigned textureId() const { return m_textureId; }
-
- private:
- CCResourceProvider* m_resourceProvider;
- CCResourceProvider::ResourceId m_resourceId;
- unsigned m_textureId;
-
- DISALLOW_COPY_AND_ASSIGN(ScopedReadLockGL);
- };
-
- class ScopedWriteLockGL {
- public:
- ScopedWriteLockGL(CCResourceProvider*, CCResourceProvider::ResourceId);
- ~ScopedWriteLockGL();
-
- unsigned textureId() const { return m_textureId; }
-
- private:
- CCResourceProvider* m_resourceProvider;
- CCResourceProvider::ResourceId m_resourceId;
- unsigned m_textureId;
-
- DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockGL);
- };
-
- class ScopedReadLockSoftware {
- public:
- ScopedReadLockSoftware(CCResourceProvider*, CCResourceProvider::ResourceId);
- ~ScopedReadLockSoftware();
-
- const SkBitmap* skBitmap() const { return &m_skBitmap; }
-
- private:
- CCResourceProvider* m_resourceProvider;
- CCResourceProvider::ResourceId m_resourceId;
- SkBitmap m_skBitmap;
-
- DISALLOW_COPY_AND_ASSIGN(ScopedReadLockSoftware);
- };
-
- class ScopedWriteLockSoftware {
- public:
- ScopedWriteLockSoftware(CCResourceProvider*, CCResourceProvider::ResourceId);
- ~ScopedWriteLockSoftware();
-
- SkCanvas* skCanvas() { return m_skCanvas.get(); }
-
- private:
- CCResourceProvider* m_resourceProvider;
- CCResourceProvider::ResourceId m_resourceId;
- SkBitmap m_skBitmap;
- OwnPtr<SkCanvas> m_skCanvas;
-
- DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockSoftware);
- };
-
-private:
- struct Resource {
- Resource();
- Resource(unsigned textureId, int pool, const IntSize& size, GC3Denum format);
- Resource(uint8_t* pixels, int pool, const IntSize& size, GC3Denum format);
-
- unsigned glId;
- uint8_t* pixels;
- int pool;
- int lockForReadCount;
- bool lockedForWrite;
- bool external;
- bool exported;
- IntSize size;
- GC3Denum format;
- ResourceType type;
- };
- typedef HashMap<ResourceId, Resource> ResourceMap;
- struct Child {
- Child();
- ~Child();
-
- int pool;
- ResourceIdMap childToParentMap;
- ResourceIdMap parentToChildMap;
- };
- typedef HashMap<int, Child> ChildMap;
-
- explicit CCResourceProvider(CCGraphicsContext*);
- bool initialize();
-
- const Resource* lockForRead(ResourceId);
- void unlockForRead(ResourceId);
- const Resource* lockForWrite(ResourceId);
- void unlockForWrite(ResourceId);
- static void populateSkBitmapWithResource(SkBitmap*, const Resource*);
-
- bool transferResource(WebKit::WebGraphicsContext3D*, ResourceId, TransferableResource*);
- void trimMailboxDeque();
-
- CCGraphicsContext* m_context;
- ResourceId m_nextId;
- ResourceMap m_resources;
- int m_nextChild;
- ChildMap m_children;
-
- Deque<Mailbox> m_mailboxes;
-
- ResourceType m_defaultResourceType;
- bool m_useTextureStorageExt;
- bool m_useTextureUsageHint;
- bool m_useShallowFlush;
- OwnPtr<LayerTextureSubImage> m_texSubImage;
- OwnPtr<TextureUploader> m_textureUploader;
- OwnPtr<AcceleratedTextureCopier> m_textureCopier;
- int m_maxTextureSize;
-
- DISALLOW_COPY_AND_ASSIGN(CCResourceProvider);
-};
-
-}
-
-#endif
+// Temporary forwarding header
+#include "cc/resource_provider.h"
diff --git a/cc/CCScheduler.h b/cc/CCScheduler.h
index 1b48307..7032779 100644
--- a/cc/CCScheduler.h
+++ b/cc/CCScheduler.h
@@ -1,109 +1,6 @@
-// Copyright 2011 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCScheduler_h
-#define CCScheduler_h
-
-#include "base/basictypes.h"
-#include "base/memory/scoped_ptr.h"
-#include "base/time.h"
-#include "CCFrameRateController.h"
-#include "CCSchedulerStateMachine.h"
-#include <wtf/PassOwnPtr.h>
-
-namespace cc {
-
-class CCThread;
-
-struct CCScheduledActionDrawAndSwapResult {
- CCScheduledActionDrawAndSwapResult()
- : didDraw(false)
- , didSwap(false)
- {
- }
- CCScheduledActionDrawAndSwapResult(bool didDraw, bool didSwap)
- : didDraw(didDraw)
- , didSwap(didSwap)
- {
- }
- bool didDraw;
- bool didSwap;
-};
-
-class CCSchedulerClient {
-public:
- virtual void scheduledActionBeginFrame() = 0;
- virtual CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapIfPossible() = 0;
- virtual CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapForced() = 0;
- virtual void scheduledActionCommit() = 0;
- virtual void scheduledActionBeginContextRecreation() = 0;
- virtual void scheduledActionAcquireLayerTexturesForMainThread() = 0;
- virtual void didAnticipatedDrawTimeChange(base::TimeTicks) = 0;
-
-protected:
- virtual ~CCSchedulerClient() { }
-};
-
-class CCScheduler : CCFrameRateControllerClient {
-public:
- static PassOwnPtr<CCScheduler> create(CCSchedulerClient* client, scoped_ptr<CCFrameRateController> frameRateController)
- {
- return adoptPtr(new CCScheduler(client, frameRateController.Pass()));
- }
-
- virtual ~CCScheduler();
-
- void setCanBeginFrame(bool);
-
- void setVisible(bool);
- void setCanDraw(bool);
-
- void setNeedsCommit();
-
- // Like setNeedsCommit(), but ensures a commit will definitely happen even if we are not visible.
- void setNeedsForcedCommit();
-
- void setNeedsRedraw();
-
- void setMainThreadNeedsLayerTextures();
-
- // Like setNeedsRedraw(), but ensures the draw will definitely happen even if we are not visible.
- void setNeedsForcedRedraw();
-
- void beginFrameComplete();
- void beginFrameAborted();
-
- void setMaxFramesPending(int);
- void setSwapBuffersCompleteSupported(bool);
- void didSwapBuffersComplete();
-
- void didLoseContext();
- void didRecreateContext();
-
- bool commitPending() const { return m_stateMachine.commitPending(); }
- bool redrawPending() const { return m_stateMachine.redrawPending(); }
-
- void setTimebaseAndInterval(base::TimeTicks timebase, base::TimeDelta interval);
-
- base::TimeTicks anticipatedDrawTime();
-
- // CCFrameRateControllerClient implementation
- virtual void vsyncTick(bool throttled) OVERRIDE;
-
-private:
- CCScheduler(CCSchedulerClient*, scoped_ptr<CCFrameRateController>);
-
- void processScheduledActions();
-
- CCSchedulerClient* m_client;
- scoped_ptr<CCFrameRateController> m_frameRateController;
- CCSchedulerStateMachine m_stateMachine;
- bool m_insideProcessScheduledActions;
-
- DISALLOW_COPY_AND_ASSIGN(CCScheduler);
-};
-
-} // namespace cc
-
-#endif // CCScheduler_h
+// Temporary forwarding header
+#include "cc/scheduler.h"
diff --git a/cc/CCSchedulerStateMachine.h b/cc/CCSchedulerStateMachine.h
index 092231f..a585284 100644
--- a/cc/CCSchedulerStateMachine.h
+++ b/cc/CCSchedulerStateMachine.h
@@ -1,161 +1,6 @@
-// Copyright 2011 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCSchedulerStateMachine_h
-#define CCSchedulerStateMachine_h
-
-#include <string>
-
-#include "base/basictypes.h"
-
-namespace cc {
-
-// The CCSchedulerStateMachine decides how to coordinate main thread activites
-// like painting/running javascript with rendering and input activities on the
-// impl thread.
-//
-// The state machine tracks internal state but is also influenced by external state.
-// Internal state includes things like whether a frame has been requested, while
-// external state includes things like the current time being near to the vblank time.
-//
-// The scheduler seperates "what to do next" from the updating of its internal state to
-// make testing cleaner.
-class CCSchedulerStateMachine {
-public:
- CCSchedulerStateMachine();
-
- enum CommitState {
- COMMIT_STATE_IDLE,
- COMMIT_STATE_FRAME_IN_PROGRESS,
- COMMIT_STATE_READY_TO_COMMIT,
- COMMIT_STATE_WAITING_FOR_FIRST_DRAW,
- };
-
- enum TextureState {
- LAYER_TEXTURE_STATE_UNLOCKED,
- LAYER_TEXTURE_STATE_ACQUIRED_BY_MAIN_THREAD,
- LAYER_TEXTURE_STATE_ACQUIRED_BY_IMPL_THREAD,
- };
-
- enum ContextState {
- CONTEXT_ACTIVE,
- CONTEXT_LOST,
- CONTEXT_RECREATING,
- };
-
- bool commitPending() const
- {
- return m_commitState != COMMIT_STATE_IDLE;
- }
-
- bool redrawPending() const { return m_needsRedraw; }
-
- enum Action {
- ACTION_NONE,
- ACTION_BEGIN_FRAME,
- ACTION_COMMIT,
- ACTION_DRAW_IF_POSSIBLE,
- ACTION_DRAW_FORCED,
- ACTION_BEGIN_CONTEXT_RECREATION,
- ACTION_ACQUIRE_LAYER_TEXTURES_FOR_MAIN_THREAD,
- };
- Action nextAction() const;
- void updateState(Action);
-
- // Indicates whether the scheduler needs a vsync callback in order to make
- // progress.
- bool vsyncCallbackNeeded() const;
-
- // Indicates that the system has entered and left a vsync callback.
- // The scheduler will not draw more than once in a given vsync callback.
- void didEnterVSync();
- void didLeaveVSync();
-
- // Indicates whether the LayerTreeHostImpl is visible.
- void setVisible(bool);
-
- // Indicates that a redraw is required, either due to the impl tree changing
- // or the screen being damaged and simply needing redisplay.
- void setNeedsRedraw();
-
- // As setNeedsRedraw(), but ensures the draw will definitely happen even if
- // we are not visible.
- void setNeedsForcedRedraw();
-
- // Indicates whether ACTION_DRAW_IF_POSSIBLE drew to the screen or not.
- void didDrawIfPossibleCompleted(bool success);
-
- // Indicates that a new commit flow needs to be performed, either to pull
- // updates from the main thread to the impl, or to push deltas from the impl
- // thread to main.
- void setNeedsCommit();
-
- // As setNeedsCommit(), but ensures the beginFrame will definitely happen even if
- // we are not visible.
- void setNeedsForcedCommit();
-
- // Call this only in response to receiving an ACTION_BEGIN_FRAME
- // from nextState. Indicates that all painting is complete.
- void beginFrameComplete();
-
- // Call this only in response to receiving an ACTION_BEGIN_FRAME
- // from nextState if the client rejects the beginFrame message.
- void beginFrameAborted();
-
- // Request exclusive access to the textures that back single buffered
- // layers on behalf of the main thread. Upon acqusition,
- // ACTION_DRAW_IF_POSSIBLE will not draw until the main thread releases the
- // textures to the impl thread by committing the layers.
- void setMainThreadNeedsLayerTextures();
-
- // Indicates whether we can successfully begin a frame at this time.
- void setCanBeginFrame(bool can) { m_canBeginFrame = can; }
-
- // Indicates whether drawing would, at this time, make sense.
- // canDraw can be used to supress flashes or checkerboarding
- // when such behavior would be undesirable.
- void setCanDraw(bool can) { m_canDraw = can; }
-
- void didLoseContext();
- void didRecreateContext();
-
- // Exposed for testing purposes.
- void setMaximumNumberOfFailedDrawsBeforeDrawIsForced(int);
-
- std::string toString();
-
-protected:
- bool shouldDrawForced() const;
- bool drawSuspendedUntilCommit() const;
- bool scheduledToDraw() const;
- bool shouldDraw() const;
- bool shouldAcquireLayerTexturesForMainThread() const;
- bool hasDrawnThisFrame() const;
-
- CommitState m_commitState;
-
- int m_currentFrameNumber;
- int m_lastFrameNumberWhereDrawWasCalled;
- int m_consecutiveFailedDraws;
- int m_maximumNumberOfFailedDrawsBeforeDrawIsForced;
- bool m_needsRedraw;
- bool m_needsForcedRedraw;
- bool m_needsForcedRedrawAfterNextCommit;
- bool m_needsCommit;
- bool m_needsForcedCommit;
- bool m_mainThreadNeedsLayerTextures;
- bool m_insideVSync;
- bool m_visible;
- bool m_canBeginFrame;
- bool m_canDraw;
- bool m_drawIfPossibleFailed;
- TextureState m_textureState;
- ContextState m_contextState;
-
- DISALLOW_COPY_AND_ASSIGN(CCSchedulerStateMachine);
-};
-
-}
-
-#endif // CCSchedulerStateMachine_h
+// Temporary forwarding header
+#include "cc/scheduler_state_machine.h"
diff --git a/cc/CCScopedTexture.h b/cc/CCScopedTexture.h
index a5b615c..faa11f5 100644
--- a/cc/CCScopedTexture.h
+++ b/cc/CCScopedTexture.h
@@ -2,45 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCScopedTexture_h
-#define CCScopedTexture_h
-
-#include "base/basictypes.h"
-#include "CCTexture.h"
-
-#if !ASSERT_DISABLED
-#include "base/threading/platform_thread.h"
-#endif
-
-namespace cc {
-
-class CCScopedTexture : protected CCTexture {
-public:
- static PassOwnPtr<CCScopedTexture> create(CCResourceProvider* resourceProvider) { return adoptPtr(new CCScopedTexture(resourceProvider)); }
- virtual ~CCScopedTexture();
-
- using CCTexture::id;
- using CCTexture::size;
- using CCTexture::format;
- using CCTexture::bytes;
-
- bool allocate(int pool, const IntSize&, GC3Denum format, CCResourceProvider::TextureUsageHint);
- void free();
- void leak();
-
-protected:
- explicit CCScopedTexture(CCResourceProvider*);
-
-private:
- CCResourceProvider* m_resourceProvider;
-
-#if !ASSERT_DISABLED
- base::PlatformThreadId m_allocateThreadIdentifier;
-#endif
-
- DISALLOW_COPY_AND_ASSIGN(CCScopedTexture);
-};
-
-}
-
-#endif
+// Temporary forwarding header
+#include "cc/scoped_texture.h"
diff --git a/cc/CCScopedThreadProxy.h b/cc/CCScopedThreadProxy.h
index 802046d..20a6b07 100644
--- a/cc/CCScopedThreadProxy.h
+++ b/cc/CCScopedThreadProxy.h
@@ -1,74 +1,6 @@
-// Copyright 2011 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCScopedThreadProxy_h
-#define CCScopedThreadProxy_h
-
-#include "CCThreadTask.h"
-#include "base/threading/platform_thread.h"
-#include <wtf/OwnPtr.h>
-#include <wtf/PassOwnPtr.h>
-#include <wtf/ThreadSafeRefCounted.h>
-
-namespace cc {
-
-// This class is a proxy used to post tasks to an target thread from any other thread. The proxy may be shut down at
-// any point from the target thread after which no more tasks posted to the proxy will run. In other words, all
-// tasks posted via a proxy are scoped to the lifecycle of the proxy. Use this when posting tasks to an object that
-// might die with tasks in flight.
-//
-// The proxy must be created and shut down from the target thread, tasks may be posted from any thread.
-//
-// Implementation note: Unlike ScopedRunnableMethodFactory in Chromium, pending tasks are not cancelled by actually
-// destroying the proxy. Instead each pending task holds a reference to the proxy to avoid maintaining an explicit
-// list of outstanding tasks.
-class CCScopedThreadProxy : public ThreadSafeRefCounted<CCScopedThreadProxy> {
-public:
- static PassRefPtr<CCScopedThreadProxy> create(CCThread* targetThread)
- {
- ASSERT(base::PlatformThread::CurrentId() == targetThread->threadID());
- return adoptRef(new CCScopedThreadProxy(targetThread));
- }
-
- ~CCScopedThreadProxy();
-
- // Can be called from any thread. Posts a task to the target thread that runs unless
- // shutdown() is called before it runs.
- void postTask(PassOwnPtr<CCThread::Task> task)
- {
- ref();
- m_targetThread->postTask(createCCThreadTask(this, &CCScopedThreadProxy::runTaskIfNotShutdown, task));
- }
-
- void shutdown()
- {
- ASSERT(base::PlatformThread::CurrentId() == m_targetThread->threadID());
- ASSERT(!m_shutdown);
- m_shutdown = true;
- }
-
-private:
- explicit CCScopedThreadProxy(CCThread* targetThread);
-
- void runTaskIfNotShutdown(PassOwnPtr<CCThread::Task> popTask)
- {
- OwnPtr<CCThread::Task> task = popTask;
- // If our shutdown flag is set, it's possible that m_targetThread has already been destroyed so don't
- // touch it.
- if (m_shutdown) {
- deref();
- return;
- }
- ASSERT(base::PlatformThread::CurrentId() == m_targetThread->threadID());
- task->performTask();
- deref();
- }
-
- CCThread* m_targetThread;
- bool m_shutdown; // Only accessed on the target thread
-};
-
-}
-
-#endif
+// Temporary forwarding header
+#include "cc/scoped_thread_proxy.h"
diff --git a/cc/CCScrollbarAnimationController.h b/cc/CCScrollbarAnimationController.h
index bb387d7..584c8dc 100644
--- a/cc/CCScrollbarAnimationController.h
+++ b/cc/CCScrollbarAnimationController.h
@@ -2,63 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCScrollbarAnimationController_h
-#define CCScrollbarAnimationController_h
-
-#include "FloatPoint.h"
-#include "IntSize.h"
-#include <wtf/PassOwnPtr.h>
-
-namespace cc {
-
-class CCLayerImpl;
-class CCScrollbarLayerImpl;
-
-// This abstract class represents the compositor-side analogy of ScrollbarAnimator.
-// Individual platforms should subclass it to provide specialized implementation.
-class CCScrollbarAnimationController {
-public:
- // Implemented by subclass.
- static PassOwnPtr<CCScrollbarAnimationController> create(CCLayerImpl* scrollLayer);
-
- virtual ~CCScrollbarAnimationController();
-
- virtual bool animate(double monotonicTime);
- void didPinchGestureBegin();
- void didPinchGestureUpdate();
- void didPinchGestureEnd();
- void updateScrollOffset(CCLayerImpl* scrollLayer);
-
- void setHorizontalScrollbarLayer(CCScrollbarLayerImpl* layer) { m_horizontalScrollbarLayer = layer; }
- CCScrollbarLayerImpl* horizontalScrollbarLayer() const { return m_horizontalScrollbarLayer; }
-
- void setVerticalScrollbarLayer(CCScrollbarLayerImpl* layer) { m_verticalScrollbarLayer = layer; }
- CCScrollbarLayerImpl* verticalScrollbarLayer() const { return m_verticalScrollbarLayer; }
-
- FloatPoint currentPos() const { return m_currentPos; }
- IntSize totalSize() const { return m_totalSize; }
- IntSize maximum() const { return m_maximum; }
-
- virtual void didPinchGestureBeginAtTime(double monotonicTime) { }
- virtual void didPinchGestureUpdateAtTime(double monotonicTime) { }
- virtual void didPinchGestureEndAtTime(double monotonicTime) { }
- virtual void updateScrollOffsetAtTime(CCLayerImpl* scrollLayer, double monotonicTime);
-
-protected:
- explicit CCScrollbarAnimationController(CCLayerImpl* scrollLayer);
-
-private:
- static IntSize getScrollLayerBounds(const CCLayerImpl*);
-
- // Beware of dangling pointer. Always update these during tree synchronization.
- CCScrollbarLayerImpl* m_horizontalScrollbarLayer;
- CCScrollbarLayerImpl* m_verticalScrollbarLayer;
-
- FloatPoint m_currentPos;
- IntSize m_totalSize;
- IntSize m_maximum;
-};
-
-} // namespace cc
-
-#endif // CCScrollbarAnimationController_h
+// Temporary forwarding header
+#include "cc/scrollbar_animation_controller.h"
diff --git a/cc/CCScrollbarAnimationControllerLinearFade.h b/cc/CCScrollbarAnimationControllerLinearFade.h
index 749dca5..7ce0e02 100644
--- a/cc/CCScrollbarAnimationControllerLinearFade.h
+++ b/cc/CCScrollbarAnimationControllerLinearFade.h
@@ -2,38 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCScrollbarAnimationControllerLinearFade_h
-#define CCScrollbarAnimationControllerLinearFade_h
-
-#include "CCScrollbarAnimationController.h"
-
-namespace cc {
-
-class CCScrollbarAnimationControllerLinearFade : public CCScrollbarAnimationController {
-public:
- static PassOwnPtr<CCScrollbarAnimationControllerLinearFade> create(CCLayerImpl* scrollLayer, double fadeoutDelay, double fadeoutLength);
-
- virtual ~CCScrollbarAnimationControllerLinearFade();
-
- virtual bool animate(double monotonicTime) OVERRIDE;
-
- virtual void didPinchGestureUpdateAtTime(double monotonicTime) OVERRIDE;
- virtual void didPinchGestureEndAtTime(double monotonicTime) OVERRIDE;
- virtual void updateScrollOffsetAtTime(CCLayerImpl* scrollLayer, double monotonicTime) OVERRIDE;
-
-protected:
- CCScrollbarAnimationControllerLinearFade(CCLayerImpl* scrollLayer, double fadeoutDelay, double fadeoutLength);
-
-private:
- float opacityAtTime(double monotonicTime);
-
- double m_lastAwakenTime;
- bool m_pinchGestureInEffect;
-
- double m_fadeoutDelay;
- double m_fadeoutLength;
-};
-
-} // namespace cc
-
-#endif // CCScrollbarAnimationControllerLinearFade_h
+// Temporary forwarding header
+#include "cc/scrollbar_animation_controller_linear_fade.h"
diff --git a/cc/CCScrollbarGeometryFixedThumb.h b/cc/CCScrollbarGeometryFixedThumb.h
index fe0db12..e19a679 100644
--- a/cc/CCScrollbarGeometryFixedThumb.h
+++ b/cc/CCScrollbarGeometryFixedThumb.h
@@ -2,38 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCScrollbarGeometryFixedThumb_h
-#define CCScrollbarGeometryFixedThumb_h
-
-#include "CCScrollbarGeometryStub.h"
-#include "IntSize.h"
-
-namespace cc {
-
-// This scrollbar geometry class behaves exactly like a normal geometry except
-// it always returns a fixed thumb length. This allows a page to zoom (changing
-// the total size of the scrollable area, changing the thumb length) while not
-// requiring the thumb resource to be repainted.
-class CCScrollbarGeometryFixedThumb : public CCScrollbarGeometryStub {
-public:
- static PassOwnPtr<CCScrollbarGeometryFixedThumb> create(PassOwnPtr<WebKit::WebScrollbarThemeGeometry>);
- virtual ~CCScrollbarGeometryFixedThumb();
-
- // Update thumb length from scrollbar
- void update(WebKit::WebScrollbar*);
-
- // WebScrollbarThemeGeometry interface
- virtual WebKit::WebScrollbarThemeGeometry* clone() const OVERRIDE;
- virtual int thumbLength(WebKit::WebScrollbar*) OVERRIDE;
- virtual int thumbPosition(WebKit::WebScrollbar*) OVERRIDE;
- virtual void splitTrack(WebKit::WebScrollbar*, const WebKit::WebRect& track, WebKit::WebRect& startTrack, WebKit::WebRect& thumb, WebKit::WebRect& endTrack) OVERRIDE;
-
-private:
- explicit CCScrollbarGeometryFixedThumb(PassOwnPtr<WebKit::WebScrollbarThemeGeometry>);
-
- IntSize m_thumbSize;
-};
-
-}
-
-#endif
+// Temporary forwarding header
+#include "cc/scrollbar_geometry_fixed_thumb.h"
diff --git a/cc/CCScrollbarGeometryStub.h b/cc/CCScrollbarGeometryStub.h
index 0d23a4e..3d0d81a5 100644
--- a/cc/CCScrollbarGeometryStub.h
+++ b/cc/CCScrollbarGeometryStub.h
@@ -2,51 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCScrollbarGeometryStub_h
-#define CCScrollbarGeometryStub_h
-
-#include <public/WebScrollbarThemeGeometry.h>
-#include <wtf/OwnPtr.h>
-#include <wtf/PassOwnPtr.h>
-
-namespace cc {
-
-// This subclass wraps an existing scrollbar geometry class so that
-// another class can derive from it and override specific functions, while
-// passing through the remaining ones.
-class CCScrollbarGeometryStub : public WebKit::WebScrollbarThemeGeometry {
-public:
- virtual ~CCScrollbarGeometryStub();
-
- // Allow derived classes to update themselves from a scrollbar.
- void update(WebKit::WebScrollbar*) { }
-
- // WebScrollbarThemeGeometry interface
- virtual WebKit::WebScrollbarThemeGeometry* clone() const OVERRIDE;
- virtual int thumbPosition(WebKit::WebScrollbar*) OVERRIDE;
- virtual int thumbLength(WebKit::WebScrollbar*) OVERRIDE;
- virtual int trackPosition(WebKit::WebScrollbar*) OVERRIDE;
- virtual int trackLength(WebKit::WebScrollbar*) OVERRIDE;
- virtual bool hasButtons(WebKit::WebScrollbar*) OVERRIDE;
- virtual bool hasThumb(WebKit::WebScrollbar*) OVERRIDE;
- virtual WebKit::WebRect trackRect(WebKit::WebScrollbar*) OVERRIDE;
- virtual WebKit::WebRect thumbRect(WebKit::WebScrollbar*) OVERRIDE;
- virtual int minimumThumbLength(WebKit::WebScrollbar*) OVERRIDE;
- virtual int scrollbarThickness(WebKit::WebScrollbar*) OVERRIDE;
- virtual WebKit::WebRect backButtonStartRect(WebKit::WebScrollbar*) OVERRIDE;
- virtual WebKit::WebRect backButtonEndRect(WebKit::WebScrollbar*) OVERRIDE;
- virtual WebKit::WebRect forwardButtonStartRect(WebKit::WebScrollbar*) OVERRIDE;
- virtual WebKit::WebRect forwardButtonEndRect(WebKit::WebScrollbar*) OVERRIDE;
- virtual WebKit::WebRect constrainTrackRectToTrackPieces(WebKit::WebScrollbar*, const WebKit::WebRect&) OVERRIDE;
- virtual void splitTrack(WebKit::WebScrollbar*, const WebKit::WebRect& track, WebKit::WebRect& startTrack, WebKit::WebRect& thumb, WebKit::WebRect& endTrack) OVERRIDE;
-
-protected:
- explicit CCScrollbarGeometryStub(PassOwnPtr<WebKit::WebScrollbarThemeGeometry>);
-
-private:
- OwnPtr<WebKit::WebScrollbarThemeGeometry> m_geometry;
-};
-
-}
-
-#endif
+// Temporary forwarding header
+#include "cc/scrollbar_geometry_stub.h"
diff --git a/cc/CCScrollbarLayerImpl.h b/cc/CCScrollbarLayerImpl.h
index e7cf584..69fd3c4 100644
--- a/cc/CCScrollbarLayerImpl.h
+++ b/cc/CCScrollbarLayerImpl.h
@@ -2,111 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCScrollbarLayerImpl_h
-#define CCScrollbarLayerImpl_h
-
-#if USE(ACCELERATED_COMPOSITING)
-
-#include "CCLayerImpl.h"
-#include "CCScrollbarGeometryFixedThumb.h"
-#include <public/WebRect.h>
-#include <public/WebScrollbar.h>
-#include <public/WebVector.h>
-
-namespace cc {
-
-class ScrollView;
-
-class CCScrollbarLayerImpl : public CCLayerImpl {
-public:
- static scoped_ptr<CCScrollbarLayerImpl> create(int id);
- virtual ~CCScrollbarLayerImpl();
-
- CCScrollbarGeometryFixedThumb* scrollbarGeometry() const { return m_geometry.get(); }
- void setScrollbarGeometry(PassOwnPtr<CCScrollbarGeometryFixedThumb>);
- void setScrollbarData(WebKit::WebScrollbar*);
-
- void setBackTrackResourceId(CCResourceProvider::ResourceId id) { m_backTrackResourceId = id; }
- void setForeTrackResourceId(CCResourceProvider::ResourceId id) { m_foreTrackResourceId = id; }
- void setThumbResourceId(CCResourceProvider::ResourceId id) { m_thumbResourceId = id; }
-
- float currentPos() const { return m_currentPos; }
- void setCurrentPos(float currentPos) { m_currentPos = currentPos; }
-
- int totalSize() const { return m_totalSize; }
- void setTotalSize(int totalSize) { m_totalSize = totalSize; }
-
- int maximum() const { return m_maximum; }
- void setMaximum(int maximum) { m_maximum = maximum; }
-
- WebKit::WebScrollbar::Orientation orientation() const { return m_orientation; }
-
- virtual void appendQuads(CCQuadSink&, CCAppendQuadsData&) OVERRIDE;
-
- virtual void didLoseContext() OVERRIDE;
-
-protected:
- explicit CCScrollbarLayerImpl(int id);
-
-private:
- // nested class only to avoid namespace problem
- class CCScrollbar : public WebKit::WebScrollbar {
- public:
- explicit CCScrollbar(CCScrollbarLayerImpl* owner) : m_owner(owner) { }
-
- // WebScrollbar implementation
- virtual bool isOverlay() const;
- virtual int value() const;
- virtual WebKit::WebPoint location() const;
- virtual WebKit::WebSize size() const;
- virtual bool enabled() const;
- virtual int maximum() const;
- virtual int totalSize() const;
- virtual bool isScrollViewScrollbar() const;
- virtual bool isScrollableAreaActive() const;
- virtual void getTickmarks(WebKit::WebVector<WebKit::WebRect>& tickmarks) const;
- virtual WebScrollbar::ScrollbarControlSize controlSize() const;
- virtual WebScrollbar::ScrollbarPart pressedPart() const;
- virtual WebScrollbar::ScrollbarPart hoveredPart() const;
- virtual WebScrollbar::ScrollbarOverlayStyle scrollbarOverlayStyle() const;
- virtual WebScrollbar::Orientation orientation() const;
- virtual bool isCustomScrollbar() const;
-
- private:
- CCScrollbarLayerImpl* m_owner;
-
- };
-
- virtual const char* layerTypeAsString() const OVERRIDE;
-
- CCScrollbar m_scrollbar;
-
- CCResourceProvider::ResourceId m_backTrackResourceId;
- CCResourceProvider::ResourceId m_foreTrackResourceId;
- CCResourceProvider::ResourceId m_thumbResourceId;
-
- OwnPtr<CCScrollbarGeometryFixedThumb> m_geometry;
-
- // Data to implement CCScrollbar
- WebKit::WebScrollbar::ScrollbarOverlayStyle m_scrollbarOverlayStyle;
- WebKit::WebVector<WebKit::WebRect> m_tickmarks;
- WebKit::WebScrollbar::Orientation m_orientation;
- WebKit::WebScrollbar::ScrollbarControlSize m_controlSize;
- WebKit::WebScrollbar::ScrollbarPart m_pressedPart;
- WebKit::WebScrollbar::ScrollbarPart m_hoveredPart;
-
- float m_currentPos;
- int m_totalSize;
- int m_maximum;
-
- bool m_isScrollableAreaActive;
- bool m_isScrollViewScrollbar;
- bool m_enabled;
- bool m_isCustomScrollbar;
- bool m_isOverlayScrollbar;
-};
-
-}
-#endif // USE(ACCELERATED_COMPOSITING)
-
-#endif
+// Temporary forwarding header
+#include "cc/scrollbar_layer_impl.h"
diff --git a/cc/CCSettings.h b/cc/CCSettings.h
index cde48ca..af2de40 100644
--- a/cc/CCSettings.h
+++ b/cc/CCSettings.h
@@ -2,39 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCSettings_h
-#define CCSettings_h
-
-#include "IntSize.h"
-
-namespace cc {
-
-// This file is for settings that apply to all compositors. Add settings to
-// CCLayerTreeSettings if a ui and renderer compositor might not want the same
-// setting.
-
-class CCSettings {
-public:
- static bool perTilePaintingEnabled();
- static bool partialSwapEnabled();
- static bool acceleratedAnimationEnabled();
- static bool pageScalePinchZoomEnabled();
-
- static bool jankInsteadOfCheckerboard();
- static bool backgroundColorInsteadOfCheckerboard();
-
- // These setters should only be used on the main thread before the layer
- // renderer is initialized.
- static void setPerTilePaintingEnabled(bool);
- static void setPartialSwapEnabled(bool);
- static void setAcceleratedAnimationEnabled(bool);
- static void setPageScalePinchZoomEnabled(bool);
-
- // These settings are meant to be set only once, and only read thereafter.
- // This function is only for resetting settings in tests.
- static void reset();
-};
-
-} // namespace cc
-
-#endif // CCSettings_h
+// Temporary forwarding header
+#include "cc/settings.h"
diff --git a/cc/CCSharedQuadState.h b/cc/CCSharedQuadState.h
index 0f5e386..c5d50d8 100644
--- a/cc/CCSharedQuadState.h
+++ b/cc/CCSharedQuadState.h
@@ -2,32 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCSharedQuadState_h
-#define CCSharedQuadState_h
-
-#include "IntRect.h"
-#include "base/memory/scoped_ptr.h"
-#include <public/WebTransformationMatrix.h>
-
-namespace cc {
-
-struct CCSharedQuadState {
- int id;
-
- // Transforms from quad's original content space to its target content space.
- WebKit::WebTransformationMatrix quadTransform;
- // This rect lives in the content space for the quad's originating layer.
- IntRect visibleContentRect;
- IntRect clippedRectInTarget;
- float opacity;
- bool opaque;
-
- static scoped_ptr<CCSharedQuadState> create(const WebKit::WebTransformationMatrix& quadTransform, const IntRect& visibleContentRect, const IntRect& clippedRectInTarget, float opacity, bool opaque);
- CCSharedQuadState(const WebKit::WebTransformationMatrix& quadTransform, const IntRect& visibleContentRect, const IntRect& clippedRectInTarget, float opacity, bool opaque);
-
- scoped_ptr<CCSharedQuadState> copy() const;
-};
-
-}
-
-#endif
+// Temporary forwarding header
+#include "cc/shared_quad_state.h"
diff --git a/cc/CCSingleThreadProxy.h b/cc/CCSingleThreadProxy.h
index 979dbb3..4a6f21e 100644
--- a/cc/CCSingleThreadProxy.h
+++ b/cc/CCSingleThreadProxy.h
@@ -1,134 +1,6 @@
-// Copyright 2011 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCSingleThreadProxy_h
-#define CCSingleThreadProxy_h
-
-#include "CCAnimationEvents.h"
-#include "CCLayerTreeHostImpl.h"
-#include "CCProxy.h"
-#include <base/time.h>
-#include <limits>
-
-namespace cc {
-
-class CCLayerTreeHost;
-
-class CCSingleThreadProxy : public CCProxy, CCLayerTreeHostImplClient {
-public:
- static scoped_ptr<CCProxy> create(CCLayerTreeHost*);
- virtual ~CCSingleThreadProxy();
-
- // CCProxy implementation
- virtual bool compositeAndReadback(void *pixels, const IntRect&) OVERRIDE;
- virtual void startPageScaleAnimation(const IntSize& targetPosition, bool useAnchor, float scale, double duration) OVERRIDE;
- virtual void finishAllRendering() OVERRIDE;
- virtual bool isStarted() const OVERRIDE;
- virtual bool initializeContext() OVERRIDE;
- virtual void setSurfaceReady() OVERRIDE;
- virtual void setVisible(bool) OVERRIDE;
- virtual bool initializeRenderer() OVERRIDE;
- virtual bool recreateContext() OVERRIDE;
- virtual void renderingStats(CCRenderingStats*) OVERRIDE;
- virtual const RendererCapabilities& rendererCapabilities() const OVERRIDE;
- virtual void loseContext() OVERRIDE;
- virtual void setNeedsAnimate() OVERRIDE;
- virtual void setNeedsCommit() OVERRIDE;
- virtual void setNeedsRedraw() OVERRIDE;
- virtual bool commitRequested() const OVERRIDE;
- virtual void didAddAnimation() OVERRIDE;
- virtual void start() OVERRIDE;
- virtual void stop() OVERRIDE;
- virtual size_t maxPartialTextureUpdates() const OVERRIDE;
- virtual void acquireLayerTextures() OVERRIDE { }
- virtual void forceSerializeOnSwapBuffers() OVERRIDE;
-
- // CCLayerTreeHostImplClient implementation
- virtual void didLoseContextOnImplThread() OVERRIDE { }
- virtual void onSwapBuffersCompleteOnImplThread() OVERRIDE;
- virtual void onVSyncParametersChanged(double monotonicTimebase, double intervalInSeconds) OVERRIDE { }
- virtual void onCanDrawStateChanged(bool canDraw) OVERRIDE { }
- virtual void setNeedsRedrawOnImplThread() OVERRIDE;
- virtual void setNeedsCommitOnImplThread() OVERRIDE;
- virtual void postAnimationEventsToMainThreadOnImplThread(scoped_ptr<CCAnimationEventsVector>, double wallClockTime) OVERRIDE;
- virtual void releaseContentsTexturesOnImplThread() OVERRIDE;
-
- // Called by the legacy path where RenderWidget does the scheduling.
- void compositeImmediately();
-
-private:
- explicit CCSingleThreadProxy(CCLayerTreeHost*);
-
- bool commitAndComposite();
- void doCommit(PassOwnPtr<CCTextureUpdateQueue>);
- bool doComposite();
- void didSwapFrame();
-
- // Accessed on main thread only.
- CCLayerTreeHost* m_layerTreeHost;
- bool m_contextLost;
-
- // Holds on to the context between initializeContext() and initializeRenderer() calls. Shouldn't
- // be used for anything else.
- scoped_ptr<CCGraphicsContext> m_contextBeforeInitialization;
-
- // Used on the CCThread, but checked on main thread during initialization/shutdown.
- scoped_ptr<CCLayerTreeHostImpl> m_layerTreeHostImpl;
- bool m_rendererInitialized;
- RendererCapabilities m_RendererCapabilitiesForMainThread;
-
- bool m_nextFrameIsNewlyCommittedFrame;
-
- base::TimeDelta m_totalCommitTime;
- size_t m_totalCommitCount;
-};
-
-// For use in the single-threaded case. In debug builds, it pretends that the
-// code is running on the impl thread to satisfy assertion checks.
-class DebugScopedSetImplThread {
-public:
- DebugScopedSetImplThread()
- {
-#if !ASSERT_DISABLED
- CCProxy::setCurrentThreadIsImplThread(true);
-#endif
- }
- ~DebugScopedSetImplThread()
- {
-#if !ASSERT_DISABLED
- CCProxy::setCurrentThreadIsImplThread(false);
-#endif
- }
-};
-
-// For use in the single-threaded case. In debug builds, it pretends that the
-// code is running on the main thread to satisfy assertion checks.
-class DebugScopedSetMainThread {
-public:
- DebugScopedSetMainThread()
- {
-#if !ASSERT_DISABLED
- CCProxy::setCurrentThreadIsImplThread(false);
-#endif
- }
- ~DebugScopedSetMainThread()
- {
-#if !ASSERT_DISABLED
- CCProxy::setCurrentThreadIsImplThread(true);
-#endif
- }
-};
-
-// For use in the single-threaded case. In debug builds, it pretends that the
-// code is running on the impl thread and that the main thread is blocked to
-// satisfy assertion checks
-class DebugScopedSetImplThreadAndMainThreadBlocked {
-private:
- DebugScopedSetImplThread m_implThread;
- DebugScopedSetMainThreadBlocked m_mainThreadBlocked;
-};
-
-} // namespace cc
-
-#endif
+// Temporary forwarding header
+#include "cc/single_thread_proxy.h"
diff --git a/cc/CCSolidColorDrawQuad.h b/cc/CCSolidColorDrawQuad.h
index 6825612..ca00bc9 100644
--- a/cc/CCSolidColorDrawQuad.h
+++ b/cc/CCSolidColorDrawQuad.h
@@ -2,32 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCSolidColorDrawQuad_h
-#define CCSolidColorDrawQuad_h
-
-#include "CCDrawQuad.h"
-#include "SkColor.h"
-#include "base/memory/scoped_ptr.h"
-
-namespace cc {
-
-#pragma pack(push, 4)
-
-class CCSolidColorDrawQuad : public CCDrawQuad {
-public:
- static scoped_ptr<CCSolidColorDrawQuad> create(const CCSharedQuadState*, const IntRect&, SkColor);
-
- SkColor color() const { return m_color; };
-
- static const CCSolidColorDrawQuad* materialCast(const CCDrawQuad*);
-private:
- CCSolidColorDrawQuad(const CCSharedQuadState*, const IntRect&, SkColor);
-
- SkColor m_color;
-};
-
-#pragma pack(pop)
-
-}
-
-#endif
+// Temporary forwarding header
+#include "cc/solid_color_draw_quad.h"
diff --git a/cc/CCSolidColorLayerImpl.h b/cc/CCSolidColorLayerImpl.h
index 72beb25..b763bf7 100644
--- a/cc/CCSolidColorLayerImpl.h
+++ b/cc/CCSolidColorLayerImpl.h
@@ -2,33 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCSolidColorLayerImpl_h
-#define CCSolidColorLayerImpl_h
-
-#include "CCLayerImpl.h"
-#include <public/WebTransformationMatrix.h>
-
-namespace cc {
-
-class CCSolidColorLayerImpl : public CCLayerImpl {
-public:
- static scoped_ptr<CCSolidColorLayerImpl> create(int id)
- {
- return make_scoped_ptr(new CCSolidColorLayerImpl(id));
- }
- virtual ~CCSolidColorLayerImpl();
-
- virtual void appendQuads(CCQuadSink&, CCAppendQuadsData&) OVERRIDE;
-
-protected:
- explicit CCSolidColorLayerImpl(int id);
-
-private:
- virtual const char* layerTypeAsString() const OVERRIDE;
-
- const int m_tileSize;
-};
-
-}
-
-#endif // CCSolidColorLayerImpl_h
+// Temporary forwarding header
+#include "cc/solid_color_layer_impl.h"
diff --git a/cc/CCStreamVideoDrawQuad.h b/cc/CCStreamVideoDrawQuad.h
index 6a1b6c4..fb996bfa 100644
--- a/cc/CCStreamVideoDrawQuad.h
+++ b/cc/CCStreamVideoDrawQuad.h
@@ -2,34 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCStreamVideoDrawQuad_h
-#define CCStreamVideoDrawQuad_h
-
-#include "CCDrawQuad.h"
-#include "base/memory/scoped_ptr.h"
-#include <public/WebTransformationMatrix.h>
-
-namespace cc {
-
-#pragma pack(push, 4)
-
-class CCStreamVideoDrawQuad : public CCDrawQuad {
-public:
- static scoped_ptr<CCStreamVideoDrawQuad> create(const CCSharedQuadState*, const IntRect&, unsigned textureId, const WebKit::WebTransformationMatrix&);
-
- unsigned textureId() const { return m_textureId; }
- const WebKit::WebTransformationMatrix& matrix() const { return m_matrix; }
-
- static const CCStreamVideoDrawQuad* materialCast(const CCDrawQuad*);
-private:
- CCStreamVideoDrawQuad(const CCSharedQuadState*, const IntRect&, unsigned textureId, const WebKit::WebTransformationMatrix&);
-
- unsigned m_textureId;
- WebKit::WebTransformationMatrix m_matrix;
-};
-
-#pragma pack(pop)
-
-}
-
-#endif
+// Temporary forwarding header
+#include "cc/stream_video_draw_quad.h"
diff --git a/cc/CCTexture.h b/cc/CCTexture.h
index 8d0def3..4f798d0 100644
--- a/cc/CCTexture.h
+++ b/cc/CCTexture.h
@@ -2,41 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCTexture_h
-#define CCTexture_h
-
-#include "CCResourceProvider.h"
-#include "CCTexture.h"
-#include "GraphicsContext3D.h"
-#include "IntSize.h"
-
-namespace cc {
-
-class CCTexture {
-public:
- CCTexture() : m_id(0) { }
- CCTexture(unsigned id, IntSize size, GC3Denum format)
- : m_id(id)
- , m_size(size)
- , m_format(format) { }
-
- CCResourceProvider::ResourceId id() const { return m_id; }
- const IntSize& size() const { return m_size; }
- GC3Denum format() const { return m_format; }
-
- void setId(CCResourceProvider::ResourceId id) { m_id = id; }
- void setDimensions(const IntSize&, GC3Denum format);
-
- size_t bytes() const;
-
- static size_t memorySizeBytes(const IntSize&, GC3Denum format);
-
-private:
- CCResourceProvider::ResourceId m_id;
- IntSize m_size;
- GC3Denum m_format;
-};
-
-}
-
-#endif
+// Temporary forwarding header
+#include "cc/texture.h"
diff --git a/cc/CCTextureDrawQuad.h b/cc/CCTextureDrawQuad.h
index daa600f..2ad6600 100644
--- a/cc/CCTextureDrawQuad.h
+++ b/cc/CCTextureDrawQuad.h
@@ -2,40 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCTextureDrawQuad_h
-#define CCTextureDrawQuad_h
-
-#include "CCDrawQuad.h"
-#include "FloatRect.h"
-#include "base/memory/scoped_ptr.h"
-
-namespace cc {
-
-#pragma pack(push, 4)
-
-class CCTextureDrawQuad : public CCDrawQuad {
-public:
- static scoped_ptr<CCTextureDrawQuad> create(const CCSharedQuadState*, const IntRect&, unsigned resourceId, bool premultipliedAlpha, const FloatRect& uvRect, bool flipped);
- FloatRect uvRect() const { return m_uvRect; }
-
- unsigned resourceId() const { return m_resourceId; }
- bool premultipliedAlpha() const { return m_premultipliedAlpha; }
- bool flipped() const { return m_flipped; }
-
- void setNeedsBlending();
-
- static const CCTextureDrawQuad* materialCast(const CCDrawQuad*);
-private:
- CCTextureDrawQuad(const CCSharedQuadState*, const IntRect&, unsigned resourceId, bool premultipliedAlpha, const FloatRect& uvRect, bool flipped);
-
- unsigned m_resourceId;
- bool m_premultipliedAlpha;
- FloatRect m_uvRect;
- bool m_flipped;
-};
-
-#pragma pack(pop)
-
-}
-
-#endif
+// Temporary forwarding header
+#include "cc/texture_draw_quad.h"
diff --git a/cc/CCTextureLayerImpl.h b/cc/CCTextureLayerImpl.h
index ff88ff3..8b05959 100644
--- a/cc/CCTextureLayerImpl.h
+++ b/cc/CCTextureLayerImpl.h
@@ -2,47 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCTextureLayerImpl_h
-#define CCTextureLayerImpl_h
-
-#include "CCLayerImpl.h"
-
-namespace cc {
-
-class CCTextureLayerImpl : public CCLayerImpl {
-public:
- static scoped_ptr<CCTextureLayerImpl> create(int id)
- {
- return make_scoped_ptr(new CCTextureLayerImpl(id));
- }
- virtual ~CCTextureLayerImpl();
-
- virtual void willDraw(CCResourceProvider*) OVERRIDE;
- virtual void appendQuads(CCQuadSink&, CCAppendQuadsData&) OVERRIDE;
- virtual void didDraw(CCResourceProvider*) OVERRIDE;
-
- virtual void didLoseContext() OVERRIDE;
-
- virtual void dumpLayerProperties(std::string*, int indent) const OVERRIDE;
-
- unsigned textureId() const { return m_textureId; }
- void setTextureId(unsigned id) { m_textureId = id; }
- void setPremultipliedAlpha(bool premultipliedAlpha) { m_premultipliedAlpha = premultipliedAlpha; }
- void setFlipped(bool flipped) { m_flipped = flipped; }
- void setUVRect(const FloatRect& rect) { m_uvRect = rect; }
-
-private:
- explicit CCTextureLayerImpl(int);
-
- virtual const char* layerTypeAsString() const OVERRIDE;
-
- unsigned m_textureId;
- CCResourceProvider::ResourceId m_externalTextureResource;
- bool m_premultipliedAlpha;
- bool m_flipped;
- FloatRect m_uvRect;
-};
-
-}
-
-#endif // CCTextureLayerImpl_h
+// Temporary forwarding header
+#include "cc/texture_layer_impl.h"
diff --git a/cc/CCTextureUpdateController.h b/cc/CCTextureUpdateController.h
index 74bb8ca..9c00820 100644
--- a/cc/CCTextureUpdateController.h
+++ b/cc/CCTextureUpdateController.h
@@ -2,76 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCTextureUpdateController_h
-#define CCTextureUpdateController_h
-
-#include "base/basictypes.h"
-#include "base/time.h"
-#include "CCTextureUpdateQueue.h"
-#include "CCTimer.h"
-#include <wtf/OwnPtr.h>
-
-namespace cc {
-
-class TextureUploader;
-
-class CCTextureUpdateControllerClient {
-public:
- virtual void readyToFinalizeTextureUpdates() = 0;
-
-protected:
- virtual ~CCTextureUpdateControllerClient() { }
-};
-
-class CCTextureUpdateController : public CCTimerClient {
-public:
- static PassOwnPtr<CCTextureUpdateController> create(CCTextureUpdateControllerClient* client, CCThread* thread, PassOwnPtr<CCTextureUpdateQueue> queue, CCResourceProvider* resourceProvider, TextureUploader* uploader)
- {
- return adoptPtr(new CCTextureUpdateController(client, thread, queue, resourceProvider, uploader));
- }
- static size_t maxPartialTextureUpdates();
-
- virtual ~CCTextureUpdateController();
-
- // Discard uploads to textures that were evicted on the impl thread.
- void discardUploadsToEvictedResources();
-
- void performMoreUpdates(base::TimeTicks timeLimit);
- void finalize();
-
- // CCTimerClient implementation.
- virtual void onTimerFired() OVERRIDE;
-
- // Virtual for testing.
- virtual base::TimeTicks now() const;
- virtual base::TimeDelta updateMoreTexturesTime() const;
- virtual size_t updateMoreTexturesSize() const;
-
-protected:
- CCTextureUpdateController(CCTextureUpdateControllerClient*, CCThread*, PassOwnPtr<CCTextureUpdateQueue>, CCResourceProvider*, TextureUploader*);
-
- static size_t maxFullUpdatesPerTick(TextureUploader*);
-
- size_t maxBlockingUpdates() const;
-
- // This returns true when there were textures left to update.
- bool updateMoreTexturesIfEnoughTimeRemaining();
- void updateMoreTexturesNow();
-
- CCTextureUpdateControllerClient* m_client;
- OwnPtr<CCTimer> m_timer;
- OwnPtr<CCTextureUpdateQueue> m_queue;
- bool m_contentsTexturesPurged;
- CCResourceProvider* m_resourceProvider;
- TextureUploader* m_uploader;
- base::TimeTicks m_timeLimit;
- size_t m_textureUpdatesPerTick;
- bool m_firstUpdateAttempt;
-
-private:
- DISALLOW_COPY_AND_ASSIGN(CCTextureUpdateController);
-};
-
-}
-
-#endif // CCTextureUpdateController_h
+// Temporary forwarding header
+#include "cc/texture_update_controller.h"
diff --git a/cc/CCTextureUpdateQueue.h b/cc/CCTextureUpdateQueue.h
index 4cf29338..b3ead95 100644
--- a/cc/CCTextureUpdateQueue.h
+++ b/cc/CCTextureUpdateQueue.h
@@ -2,46 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCTextureUpdateQueue_h
-#define CCTextureUpdateQueue_h
-
-#include "base/basictypes.h"
-#include "TextureCopier.h"
-#include "TextureUploader.h"
-#include <wtf/Deque.h>
-
-namespace cc {
-
-class CCTextureUpdateQueue {
-public:
- CCTextureUpdateQueue();
- virtual ~CCTextureUpdateQueue();
-
- void appendFullUpload(TextureUploader::Parameters);
- void appendPartialUpload(TextureUploader::Parameters);
- void appendCopy(TextureCopier::Parameters);
-
- void clearUploadsToEvictedResources();
-
- TextureUploader::Parameters takeFirstFullUpload();
- TextureUploader::Parameters takeFirstPartialUpload();
- TextureCopier::Parameters takeFirstCopy();
-
- size_t fullUploadSize() const { return m_fullEntries.size(); }
- size_t partialUploadSize() const { return m_partialEntries.size(); }
- size_t copySize() const { return m_copyEntries.size(); }
-
- bool hasMoreUpdates() const;
-
-private:
- void clearUploadsToEvictedResources(Deque<TextureUploader::Parameters>& entryQueue);
- Deque<TextureUploader::Parameters> m_fullEntries;
- Deque<TextureUploader::Parameters> m_partialEntries;
- Deque<TextureCopier::Parameters> m_copyEntries;
-
- DISALLOW_COPY_AND_ASSIGN(CCTextureUpdateQueue);
-};
-
-}
-
-#endif // CCTextureUpdateQueue_h
+// Temporary forwarding header
+#include "cc/texture_update_queue.h"
diff --git a/cc/CCThread.h b/cc/CCThread.h
index 1ac4946..aaa3579 100644
--- a/cc/CCThread.h
+++ b/cc/CCThread.h
@@ -1,43 +1,6 @@
-// Copyright 2011 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCThread_h
-#define CCThread_h
-
-#include "base/basictypes.h"
-#include "base/threading/platform_thread.h"
-#include <wtf/PassOwnPtr.h>
-
-namespace cc {
-
-// CCThread provides basic infrastructure for messaging with the compositor in a
-// platform-neutral way.
-class CCThread {
-public:
- virtual ~CCThread() { }
-
- class Task {
- public:
- virtual ~Task() { }
- virtual void performTask() = 0;
- void* instance() const { return m_instance; }
- protected:
- Task(void* instance) : m_instance(instance) { }
- void* m_instance;
- private:
- DISALLOW_COPY_AND_ASSIGN(Task);
- };
-
- // Executes the task on context's thread asynchronously.
- virtual void postTask(PassOwnPtr<Task>) = 0;
-
- // Executes the task after the specified delay.
- virtual void postDelayedTask(PassOwnPtr<Task>, long long delayMs) = 0;
-
- virtual base::PlatformThreadId threadID() const = 0;
-};
-
-}
-
-#endif
+// Temporary forwarding header
+#include "cc/thread.h"
diff --git a/cc/CCThreadProxy.h b/cc/CCThreadProxy.h
index a6ea6ac..04899c0 100644
--- a/cc/CCThreadProxy.h
+++ b/cc/CCThreadProxy.h
@@ -1,185 +1,6 @@
-// Copyright 2011 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCThreadProxy_h
-#define CCThreadProxy_h
-
-#include "CCAnimationEvents.h"
-#include "CCCompletionEvent.h"
-#include "CCLayerTreeHostImpl.h"
-#include "CCProxy.h"
-#include "CCScheduler.h"
-#include "CCTextureUpdateController.h"
-#include <base/time.h>
-#include <wtf/OwnPtr.h>
-
-namespace cc {
-
-class CCInputHandler;
-class CCLayerTreeHost;
-class CCScheduler;
-class CCScopedThreadProxy;
-class CCTextureUpdateQueue;
-class CCThread;
-class CCThreadProxyContextRecreationTimer;
-
-class CCThreadProxy : public CCProxy, CCLayerTreeHostImplClient, CCSchedulerClient, CCTextureUpdateControllerClient {
-public:
- static scoped_ptr<CCProxy> create(CCLayerTreeHost*);
-
- virtual ~CCThreadProxy();
-
- // CCProxy implementation
- virtual bool compositeAndReadback(void *pixels, const IntRect&) OVERRIDE;
- virtual void startPageScaleAnimation(const IntSize& targetPosition, bool useAnchor, float scale, double duration) OVERRIDE;
- virtual void finishAllRendering() OVERRIDE;
- virtual bool isStarted() const OVERRIDE;
- virtual bool initializeContext() OVERRIDE;
- virtual void setSurfaceReady() OVERRIDE;
- virtual void setVisible(bool) OVERRIDE;
- virtual bool initializeRenderer() OVERRIDE;
- virtual bool recreateContext() OVERRIDE;
- virtual void renderingStats(CCRenderingStats*) OVERRIDE;
- virtual const RendererCapabilities& rendererCapabilities() const OVERRIDE;
- virtual void loseContext() OVERRIDE;
- virtual void setNeedsAnimate() OVERRIDE;
- virtual void setNeedsCommit() OVERRIDE;
- virtual void setNeedsRedraw() OVERRIDE;
- virtual bool commitRequested() const OVERRIDE;
- virtual void didAddAnimation() OVERRIDE { }
- virtual void start() OVERRIDE;
- virtual void stop() OVERRIDE;
- virtual size_t maxPartialTextureUpdates() const OVERRIDE;
- virtual void acquireLayerTextures() OVERRIDE;
- virtual void forceSerializeOnSwapBuffers() OVERRIDE;
-
- // CCLayerTreeHostImplClient implementation
- virtual void didLoseContextOnImplThread() OVERRIDE;
- virtual void onSwapBuffersCompleteOnImplThread() OVERRIDE;
- virtual void onVSyncParametersChanged(double monotonicTimebase, double intervalInSeconds) OVERRIDE;
- virtual void onCanDrawStateChanged(bool canDraw) OVERRIDE;
- virtual void setNeedsRedrawOnImplThread() OVERRIDE;
- virtual void setNeedsCommitOnImplThread() OVERRIDE;
- virtual void postAnimationEventsToMainThreadOnImplThread(scoped_ptr<CCAnimationEventsVector>, double wallClockTime) OVERRIDE;
- virtual void releaseContentsTexturesOnImplThread() OVERRIDE;
-
- // CCSchedulerClient implementation
- virtual void scheduledActionBeginFrame() OVERRIDE;
- virtual CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapIfPossible() OVERRIDE;
- virtual CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapForced() OVERRIDE;
- virtual void scheduledActionCommit() OVERRIDE;
- virtual void scheduledActionBeginContextRecreation() OVERRIDE;
- virtual void scheduledActionAcquireLayerTexturesForMainThread() OVERRIDE;
- virtual void didAnticipatedDrawTimeChange(base::TimeTicks) OVERRIDE;
-
- // CCTextureUpdateControllerClient implementation
- virtual void readyToFinalizeTextureUpdates() OVERRIDE;
-
-private:
- explicit CCThreadProxy(CCLayerTreeHost*);
- friend class CCThreadProxyContextRecreationTimer;
-
- // Set on impl thread, read on main thread.
- struct BeginFrameAndCommitState {
- BeginFrameAndCommitState();
- ~BeginFrameAndCommitState();
-
- double monotonicFrameBeginTime;
- scoped_ptr<CCScrollAndScaleSet> scrollInfo;
- WebKit::WebTransformationMatrix implTransform;
- CCPrioritizedTextureManager::BackingVector evictedContentsTexturesBackings;
- size_t memoryAllocationLimitBytes;
- };
- OwnPtr<BeginFrameAndCommitState> m_pendingBeginFrameRequest;
-
- // Called on main thread
- void beginFrame();
- void didCommitAndDrawFrame();
- void didCompleteSwapBuffers();
- void setAnimationEvents(CCAnimationEventsVector*, double wallClockTime);
- void beginContextRecreation();
- void tryToRecreateContext();
-
- // Called on impl thread
- struct ReadbackRequest {
- CCCompletionEvent completion;
- bool success;
- void* pixels;
- IntRect rect;
- };
- void forceBeginFrameOnImplThread(CCCompletionEvent*);
- void beginFrameCompleteOnImplThread(CCCompletionEvent*, PassOwnPtr<CCTextureUpdateQueue>);
- void beginFrameAbortedOnImplThread();
- void requestReadbackOnImplThread(ReadbackRequest*);
- void requestStartPageScaleAnimationOnImplThread(IntSize targetPosition, bool useAnchor, float scale, double durationSec);
- void finishAllRenderingOnImplThread(CCCompletionEvent*);
- void initializeImplOnImplThread(CCCompletionEvent*, CCInputHandler*);
- void setSurfaceReadyOnImplThread();
- void setVisibleOnImplThread(CCCompletionEvent*, bool);
- void initializeContextOnImplThread(CCGraphicsContext*);
- void initializeRendererOnImplThread(CCCompletionEvent*, bool* initializeSucceeded, RendererCapabilities*);
- void layerTreeHostClosedOnImplThread(CCCompletionEvent*);
- void setFullRootLayerDamageOnImplThread();
- void acquireLayerTexturesForMainThreadOnImplThread(CCCompletionEvent*);
- void recreateContextOnImplThread(CCCompletionEvent*, CCGraphicsContext*, bool* recreateSucceeded, RendererCapabilities*);
- void renderingStatsOnImplThread(CCCompletionEvent*, CCRenderingStats*);
- CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapInternal(bool forcedDraw);
- void forceSerializeOnSwapBuffersOnImplThread(CCCompletionEvent*);
- void setNeedsForcedCommitOnImplThread();
-
- // Accessed on main thread only.
- bool m_animateRequested; // Set only when setNeedsAnimate is called.
- bool m_commitRequested; // Set only when setNeedsCommit is called.
- bool m_commitRequestSentToImplThread; // Set by setNeedsCommit and setNeedsAnimate.
- bool m_forcedCommitRequested;
- OwnPtr<CCThreadProxyContextRecreationTimer> m_contextRecreationTimer;
- CCLayerTreeHost* m_layerTreeHost;
- bool m_rendererInitialized;
- RendererCapabilities m_RendererCapabilitiesMainThreadCopy;
- bool m_started;
- bool m_texturesAcquired;
- bool m_inCompositeAndReadback;
-
- scoped_ptr<CCLayerTreeHostImpl> m_layerTreeHostImpl;
-
- scoped_ptr<CCInputHandler> m_inputHandlerOnImplThread;
-
- OwnPtr<CCScheduler> m_schedulerOnImplThread;
-
- RefPtr<CCScopedThreadProxy> m_mainThreadProxy;
-
- // Holds on to the context we might use for compositing in between initializeContext()
- // and initializeRenderer() calls.
- scoped_ptr<CCGraphicsContext> m_contextBeforeInitializationOnImplThread;
-
- // Set when the main thread is waiting on a scheduledActionBeginFrame to be issued.
- CCCompletionEvent* m_beginFrameCompletionEventOnImplThread;
-
- // Set when the main thread is waiting on a readback.
- ReadbackRequest* m_readbackRequestOnImplThread;
-
- // Set when the main thread is waiting on a commit to complete.
- CCCompletionEvent* m_commitCompletionEventOnImplThread;
-
- // Set when the main thread is waiting on layers to be drawn.
- CCCompletionEvent* m_textureAcquisitionCompletionEventOnImplThread;
-
- OwnPtr<CCTextureUpdateController> m_currentTextureUpdateControllerOnImplThread;
-
- // Set when we need to reset the contentsTexturesPurged flag after the
- // commit.
- bool m_resetContentsTexturesPurgedAfterCommitOnImplThread;
-
- // Set when the next draw should post didCommitAndDrawFrame to the main thread.
- bool m_nextFrameIsNewlyCommittedFrameOnImplThread;
-
- bool m_renderVSyncEnabled;
-
- base::TimeDelta m_totalCommitTime;
- size_t m_totalCommitCount;
-};
-
-}
-
-#endif
+// Temporary forwarding header
+#include "cc/thread_proxy.h"
diff --git a/cc/CCThreadTask.h b/cc/CCThreadTask.h
index 25c5509..561156b7 100644
--- a/cc/CCThreadTask.h
+++ b/cc/CCThreadTask.h
@@ -1,305 +1,6 @@
-// Copyright 2011 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCThreadTask_h
-#define CCThreadTask_h
-#include "CCThread.h"
-#include <wtf/PassOwnPtr.h>
-#include <wtf/PassRefPtr.h>
-
-namespace cc {
-
-template<typename T>
-class CCThreadTask0 : public CCThread::Task {
-public:
- typedef void (T::*Method)();
- typedef CCThreadTask0<T> CCThreadTaskImpl;
-
- static PassOwnPtr<CCThreadTaskImpl> create(T* instance, Method method)
- {
- return adoptPtr(new CCThreadTaskImpl(instance, method));
- }
-
-private:
- CCThreadTask0(T* instance, Method method)
- : CCThread::Task(instance)
- , m_method(method)
- {
- }
-
- virtual void performTask() OVERRIDE
- {
- (*static_cast<T*>(instance()).*m_method)();
- }
-
-private:
- Method m_method;
-};
-
-template<typename T, typename P1, typename MP1>
-class CCThreadTask1 : public CCThread::Task {
-public:
- typedef void (T::*Method)(MP1);
- typedef CCThreadTask1<T, P1, MP1> CCThreadTaskImpl;
-
- static PassOwnPtr<CCThreadTaskImpl> create(T* instance, Method method, P1 parameter1)
- {
- return adoptPtr(new CCThreadTaskImpl(instance, method, parameter1));
- }
-
-private:
- CCThreadTask1(T* instance, Method method, P1 parameter1)
- : CCThread::Task(instance)
- , m_method(method)
- , m_parameter1(parameter1)
- {
- }
-
- virtual void performTask() OVERRIDE
- {
- (*static_cast<T*>(instance()).*m_method)(m_parameter1);
- }
-
-private:
- Method m_method;
- P1 m_parameter1;
-};
-
-template<typename T, typename P1, typename MP1, typename P2, typename MP2>
-class CCThreadTask2 : public CCThread::Task {
-public:
- typedef void (T::*Method)(MP1, MP2);
- typedef CCThreadTask2<T, P1, MP1, P2, MP2> CCThreadTaskImpl;
-
- static PassOwnPtr<CCThreadTaskImpl> create(T* instance, Method method, P1 parameter1, P2 parameter2)
- {
- return adoptPtr(new CCThreadTaskImpl(instance, method, parameter1, parameter2));
- }
-
-private:
- CCThreadTask2(T* instance, Method method, P1 parameter1, P2 parameter2)
- : CCThread::Task(instance)
- , m_method(method)
- , m_parameter1(parameter1)
- , m_parameter2(parameter2)
- {
- }
-
- virtual void performTask() OVERRIDE
- {
- (*static_cast<T*>(instance()).*m_method)(m_parameter1, m_parameter2);
- }
-
-private:
- Method m_method;
- P1 m_parameter1;
- P2 m_parameter2;
-};
-
-template<typename T, typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3>
-class CCThreadTask3 : public CCThread::Task {
-public:
- typedef void (T::*Method)(MP1, MP2, MP3);
- typedef CCThreadTask3<T, P1, MP1, P2, MP2, P3, MP3> CCThreadTaskImpl;
-
- static PassOwnPtr<CCThreadTaskImpl> create(T* instance, Method method, P1 parameter1, P2 parameter2, P3 parameter3)
- {
- return adoptPtr(new CCThreadTaskImpl(instance, method, parameter1, parameter2, parameter3));
- }
-
-private:
- CCThreadTask3(T* instance, Method method, P1 parameter1, P2 parameter2, P3 parameter3)
- : CCThread::Task(instance)
- , m_method(method)
- , m_parameter1(parameter1)
- , m_parameter2(parameter2)
- , m_parameter3(parameter3)
- {
- }
-
- virtual void performTask() OVERRIDE
- {
- (*static_cast<T*>(instance()).*m_method)(m_parameter1, m_parameter2, m_parameter3);
- }
-
-private:
- Method m_method;
- P1 m_parameter1;
- P2 m_parameter2;
- P3 m_parameter3;
-};
-
-
-template<typename T, typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3, typename P4, typename MP4>
-class CCThreadTask4 : public CCThread::Task {
-public:
- typedef void (T::*Method)(MP1, MP2, MP3, MP4);
- typedef CCThreadTask4<T, P1, MP1, P2, MP2, P3, MP3, P4, MP4> CCThreadTaskImpl;
-
- static PassOwnPtr<CCThreadTaskImpl> create(T* instance, Method method, P1 parameter1, P2 parameter2, P3 parameter3, P4 parameter4)
- {
- return adoptPtr(new CCThreadTaskImpl(instance, method, parameter1, parameter2, parameter3, parameter4));
- }
-
-private:
- CCThreadTask4(T* instance, Method method, P1 parameter1, P2 parameter2, P3 parameter3, P4 parameter4)
- : CCThread::Task(instance)
- , m_method(method)
- , m_parameter1(parameter1)
- , m_parameter2(parameter2)
- , m_parameter3(parameter3)
- , m_parameter4(parameter4)
- {
- }
-
- virtual void performTask() OVERRIDE
- {
- (*static_cast<T*>(instance()).*m_method)(m_parameter1, m_parameter2, m_parameter3, m_parameter4);
- }
-
-private:
- Method m_method;
- P1 m_parameter1;
- P2 m_parameter2;
- P3 m_parameter3;
- P4 m_parameter4;
-};
-
-template<typename T, typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3, typename P4, typename MP4, typename P5, typename MP5>
-class CCThreadTask5 : public CCThread::Task {
-public:
- typedef void (T::*Method)(MP1, MP2, MP3, MP4, MP5);
- typedef CCThreadTask5<T, P1, MP1, P2, MP2, P3, MP3, P4, MP4, P5, MP5> CCThreadTaskImpl;
-
- static PassOwnPtr<CCThreadTaskImpl> create(T* instance, Method method, P1 parameter1, P2 parameter2, P3 parameter3, P4 parameter4, P5 parameter5)
- {
- return adoptPtr(new CCThreadTaskImpl(instance, method, parameter1, parameter2, parameter3, parameter4, parameter5));
- }
-
-private:
- CCThreadTask5(T* instance, Method method, P1 parameter1, P2 parameter2, P3 parameter3, P4 parameter4, P5 parameter5)
- : CCThread::Task(instance)
- , m_method(method)
- , m_parameter1(parameter1)
- , m_parameter2(parameter2)
- , m_parameter3(parameter3)
- , m_parameter4(parameter4)
- , m_parameter5(parameter5)
- {
- }
-
- virtual void performTask() OVERRIDE
- {
- (*static_cast<T*>(instance()).*m_method)(m_parameter1, m_parameter2, m_parameter3, m_parameter4, m_parameter5);
- }
-
-private:
- Method m_method;
- P1 m_parameter1;
- P2 m_parameter2;
- P3 m_parameter3;
- P4 m_parameter4;
- P5 m_parameter5;
-};
-
-template<typename T>
-PassOwnPtr<CCThread::Task> createCCThreadTask(
- T* const callee,
- void (T::*method)());
-
-template<typename T>
-PassOwnPtr<CCThread::Task> createCCThreadTask(
- T* const callee,
- void (T::*method)())
-{
- return CCThreadTask0<T>::create(
- callee,
- method);
-}
-
-template<typename T, typename P1, typename MP1>
-PassOwnPtr<CCThread::Task> createCCThreadTask(
- T* const callee,
- void (T::*method)(MP1),
- const P1& parameter1)
-{
- return CCThreadTask1<T, P1, MP1>::create(
- callee,
- method,
- parameter1);
-}
-
-template<typename T, typename P1, typename MP1, typename P2, typename MP2>
-PassOwnPtr<CCThread::Task> createCCThreadTask(
- T* const callee,
- void (T::*method)(MP1, MP2),
- const P1& parameter1,
- const P2& parameter2)
-{
- return CCThreadTask2<T, P1, MP1, P2, MP2>::create(
- callee,
- method,
- parameter1,
- parameter2);
-}
-
-template<typename T, typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3>
-PassOwnPtr<CCThread::Task> createCCThreadTask(
- T* const callee,
- void (T::*method)(MP1, MP2, MP3),
- const P1& parameter1,
- const P2& parameter2,
- const P3& parameter3)
-{
- return CCThreadTask3<T, P1, MP1, P2, MP2, P3, MP3>::create(
- callee,
- method,
- parameter1,
- parameter2,
- parameter3);
-}
-
-template<typename T, typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3, typename P4, typename MP4>
-PassOwnPtr<CCThread::Task> createCCThreadTask(
- T* const callee,
- void (T::*method)(MP1, MP2, MP3, MP4),
- const P1& parameter1,
- const P2& parameter2,
- const P3& parameter3,
- const P4& parameter4)
-{
- return CCThreadTask4<T, P1, MP1, P2, MP2, P3, MP3, P4, MP4>::create(
- callee,
- method,
- parameter1,
- parameter2,
- parameter3,
- parameter4);
-
-}
-
-template<typename T, typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3, typename P4, typename MP4, typename P5, typename MP5>
-PassOwnPtr<CCThread::Task> createCCThreadTask(
- T* const callee,
- void (T::*method)(MP1, MP2, MP3, MP4, MP5),
- const P1& parameter1,
- const P2& parameter2,
- const P3& parameter3,
- const P4& parameter4,
- const P5& parameter5)
-{
- return CCThreadTask5<T, P1, MP1, P2, MP2, P3, MP3, P4, MP4, P5, MP5>::create(
- callee,
- method,
- parameter1,
- parameter2,
- parameter3,
- parameter4,
- parameter5);
-
-}
-
-} // namespace cc
-
-#endif // CCThreadTask_h
+// Temporary forwarding header
+#include "cc/thread_task.h"
diff --git a/cc/CCTileDrawQuad.h b/cc/CCTileDrawQuad.h
index 21a98cf..584c439 100644
--- a/cc/CCTileDrawQuad.h
+++ b/cc/CCTileDrawQuad.h
@@ -2,53 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCTileDrawQuad_h
-#define CCTileDrawQuad_h
-
-#include "CCDrawQuad.h"
-#include "GraphicsTypes3D.h"
-#include "IntPoint.h"
-#include "IntSize.h"
-#include "base/memory/scoped_ptr.h"
-
-namespace cc {
-
-#pragma pack(push, 4)
-
-class CCTileDrawQuad : public CCDrawQuad {
-public:
- static scoped_ptr<CCTileDrawQuad> create(const CCSharedQuadState*, const IntRect& quadRect, const IntRect& opaqueRect, unsigned resourceId, const IntPoint& textureOffset, const IntSize& textureSize, GC3Dint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA);
-
- unsigned resourceId() const { return m_resourceId; }
- IntPoint textureOffset() const { return m_textureOffset; }
- IntSize textureSize() const { return m_textureSize; }
- GC3Dint textureFilter() const { return m_textureFilter; }
- bool swizzleContents() const { return m_swizzleContents; }
-
- bool leftEdgeAA() const { return m_leftEdgeAA; }
- bool topEdgeAA() const { return m_topEdgeAA; }
- bool rightEdgeAA() const { return m_rightEdgeAA; }
- bool bottomEdgeAA() const { return m_bottomEdgeAA; }
-
- bool isAntialiased() const { return leftEdgeAA() || topEdgeAA() || rightEdgeAA() || bottomEdgeAA(); }
-
- static const CCTileDrawQuad* materialCast(const CCDrawQuad*);
-private:
- CCTileDrawQuad(const CCSharedQuadState*, const IntRect& quadRect, const IntRect& opaqueRect, unsigned resourceId, const IntPoint& textureOffset, const IntSize& textureSize, GC3Dint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA);
-
- unsigned m_resourceId;
- IntPoint m_textureOffset;
- IntSize m_textureSize;
- GC3Dint m_textureFilter;
- bool m_swizzleContents;
- bool m_leftEdgeAA;
- bool m_topEdgeAA;
- bool m_rightEdgeAA;
- bool m_bottomEdgeAA;
-};
-
-#pragma pack(pop)
-
-}
-
-#endif
+// Temporary forwarding header
+#include "cc/tile_draw_quad.h"
diff --git a/cc/CCTiledLayerImpl.h b/cc/CCTiledLayerImpl.h
index 2d6803d..b9726e2 100644
--- a/cc/CCTiledLayerImpl.h
+++ b/cc/CCTiledLayerImpl.h
@@ -1,62 +1,6 @@
-// Copyright 2011 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCTiledLayerImpl_h
-#define CCTiledLayerImpl_h
-
-#include "CCLayerImpl.h"
-#include <public/WebTransformationMatrix.h>
-
-namespace cc {
-
-class CCLayerTilingData;
-class DrawableTile;
-
-class CCTiledLayerImpl : public CCLayerImpl {
-public:
- static scoped_ptr<CCTiledLayerImpl> create(int id)
- {
- return make_scoped_ptr(new CCTiledLayerImpl(id));
- }
- virtual ~CCTiledLayerImpl();
-
- virtual void appendQuads(CCQuadSink&, CCAppendQuadsData&) OVERRIDE;
-
- virtual CCResourceProvider::ResourceId contentsResourceId() const OVERRIDE;
-
- virtual void dumpLayerProperties(std::string*, int indent) const OVERRIDE;
-
- void setSkipsDraw(bool skipsDraw) { m_skipsDraw = skipsDraw; }
- void setTilingData(const CCLayerTilingData& tiler);
- void pushTileProperties(int, int, CCResourceProvider::ResourceId, const IntRect& opaqueRect);
- void pushInvalidTile(int, int);
-
- void setContentsSwizzled(bool contentsSwizzled) { m_contentsSwizzled = contentsSwizzled; }
- bool contentsSwizzled() const { return m_contentsSwizzled; }
-
- virtual Region visibleContentOpaqueRegion() const OVERRIDE;
- virtual void didLoseContext() OVERRIDE;
-
-protected:
- explicit CCTiledLayerImpl(int id);
- // Exposed for testing.
- bool hasTileAt(int, int) const;
- bool hasResourceIdForTileAt(int, int) const;
-
-private:
-
- virtual const char* layerTypeAsString() const OVERRIDE;
-
- DrawableTile* tileAt(int, int) const;
- DrawableTile* createTile(int, int);
-
- bool m_skipsDraw;
- bool m_contentsSwizzled;
-
- OwnPtr<CCLayerTilingData> m_tiler;
-};
-
-}
-
-#endif // CCTiledLayerImpl_h
+// Temporary forwarding header
+#include "cc/tiled_layer_impl.h"
diff --git a/cc/CCTimeSource.h b/cc/CCTimeSource.h
index 6f24d35..e0fa624 100644
--- a/cc/CCTimeSource.h
+++ b/cc/CCTimeSource.h
@@ -1,40 +1,6 @@
-// Copyright 2011 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCTimeSource_h
-#define CCTimeSource_h
-
-#include "base/time.h"
-#include <wtf/RefCounted.h>
-
-namespace cc {
-
-class CCThread;
-
-class CCTimeSourceClient {
-public:
- virtual void onTimerTick() = 0;
-
-protected:
- virtual ~CCTimeSourceClient() { }
-};
-
-// An generic interface for getting a reliably-ticking timesource of
-// a specified rate.
-//
-// Be sure to call setActive(false) before releasing your reference to the
-// timer, or it will keep on ticking!
-class CCTimeSource : public RefCounted<CCTimeSource> {
-public:
- virtual ~CCTimeSource() { }
- virtual void setClient(CCTimeSourceClient*) = 0;
- virtual void setActive(bool) = 0;
- virtual bool active() const = 0;
- virtual void setTimebaseAndInterval(base::TimeTicks timebase, base::TimeDelta interval) = 0;
- virtual base::TimeTicks lastTickTime() = 0;
- virtual base::TimeTicks nextTickTime() = 0;
-};
-
-}
-#endif // CCSmoothedTimer_h
+// Temporary forwarding header
+#include "cc/time_source.h"
diff --git a/cc/CCTimer.h b/cc/CCTimer.h
index 9424aef..5dee85a 100644
--- a/cc/CCTimer.h
+++ b/cc/CCTimer.h
@@ -1,41 +1,6 @@
-// Copyright 2011 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCTimer_h
-#define CCTimer_h
-
-namespace cc {
-
-class CCThread;
-class CCTimerTask;
-
-class CCTimerClient {
-public:
- virtual ~CCTimerClient() { }
-
- virtual void onTimerFired() = 0;
-};
-
-class CCTimer {
-public:
- CCTimer(CCThread*, CCTimerClient*);
- ~CCTimer();
-
- // If a previous task is pending, it will be replaced with the new one.
- void startOneShot(double intervalSeconds);
- void stop();
-
- bool isActive() const { return m_task; }
-
-private:
- friend class CCTimerTask;
-
- CCTimerClient* m_client;
- CCThread* m_thread;
- CCTimerTask* m_task; // weak pointer
-};
-
-} // namespace cc
-
-#endif
+// Temporary forwarding header
+#include "cc/timer.h"
diff --git a/cc/CCTimingFunction.h b/cc/CCTimingFunction.h
index 993ab87..82dd931 100644
--- a/cc/CCTimingFunction.h
+++ b/cc/CCTimingFunction.h
@@ -2,61 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCTimingFunction_h
-#define CCTimingFunction_h
-
-#include "CCAnimationCurve.h"
-#include "UnitBezier.h"
-
-namespace cc {
-
-// See http://www.w3.org/TR/css3-transitions/.
-class CCTimingFunction : public CCFloatAnimationCurve {
-public:
- virtual ~CCTimingFunction();
-
- // Partial implementation of CCFloatAnimationCurve.
- virtual double duration() const OVERRIDE;
-
-protected:
- CCTimingFunction();
-};
-
-class CCCubicBezierTimingFunction : public CCTimingFunction {
-public:
- static scoped_ptr<CCCubicBezierTimingFunction> create(double x1, double y1, double x2, double y2);
- virtual ~CCCubicBezierTimingFunction();
-
- // Partial implementation of CCFloatAnimationCurve.
- virtual float getValue(double time) const OVERRIDE;
- virtual scoped_ptr<CCAnimationCurve> clone() const OVERRIDE;
-
-protected:
- CCCubicBezierTimingFunction(double x1, double y1, double x2, double y2);
-
- UnitBezier m_curve;
-};
-
-class CCEaseTimingFunction {
-public:
- static scoped_ptr<CCTimingFunction> create();
-};
-
-class CCEaseInTimingFunction {
-public:
- static scoped_ptr<CCTimingFunction> create();
-};
-
-class CCEaseOutTimingFunction {
-public:
- static scoped_ptr<CCTimingFunction> create();
-};
-
-class CCEaseInOutTimingFunction {
-public:
- static scoped_ptr<CCTimingFunction> create();
-};
-
-} // namespace cc
-
-#endif // CCTimingFunction_h
+// Temporary forwarding header
+#include "cc/timing_function.h"
diff --git a/cc/CCVideoLayerImpl.h b/cc/CCVideoLayerImpl.h
index b254e8c..f147549 100644
--- a/cc/CCVideoLayerImpl.h
+++ b/cc/CCVideoLayerImpl.h
@@ -2,88 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCVideoLayerImpl_h
-#define CCVideoLayerImpl_h
-
-#include "CCLayerImpl.h"
-#include "GraphicsContext3D.h"
-#include "IntSize.h"
-#include <public/WebTransformationMatrix.h>
-#include <public/WebVideoFrameProvider.h>
-
-namespace WebKit {
-class WebVideoFrame;
-}
-
-namespace cc {
-
-class CCLayerTreeHostImpl;
-class CCVideoLayerImpl;
-
-class CCVideoLayerImpl : public CCLayerImpl
- , public WebKit::WebVideoFrameProvider::Client {
-public:
- static scoped_ptr<CCVideoLayerImpl> create(int id, WebKit::WebVideoFrameProvider* provider)
- {
- return make_scoped_ptr(new CCVideoLayerImpl(id, provider));
- }
- virtual ~CCVideoLayerImpl();
-
- virtual void willDraw(CCResourceProvider*) OVERRIDE;
- virtual void appendQuads(CCQuadSink&, CCAppendQuadsData&) OVERRIDE;
- virtual void didDraw(CCResourceProvider*) OVERRIDE;
-
- virtual void dumpLayerProperties(std::string*, int indent) const OVERRIDE;
-
- Mutex& providerMutex() { return m_providerMutex; }
-
- // WebKit::WebVideoFrameProvider::Client implementation.
- virtual void stopUsingProvider(); // Callable on any thread.
- virtual void didReceiveFrame(); // Callable on impl thread.
- virtual void didUpdateMatrix(const float*); // Callable on impl thread.
-
- virtual void didLoseContext() OVERRIDE;
-
- void setNeedsRedraw();
-
- struct FramePlane {
- CCResourceProvider::ResourceId resourceId;
- IntSize size;
- GC3Denum format;
- IntSize visibleSize;
-
- FramePlane() : resourceId(0) { }
-
- bool allocateData(CCResourceProvider*);
- void freeData(CCResourceProvider*);
- };
-
-private:
- CCVideoLayerImpl(int, WebKit::WebVideoFrameProvider*);
-
- static IntSize computeVisibleSize(const WebKit::WebVideoFrame&, unsigned plane);
- virtual const char* layerTypeAsString() const OVERRIDE;
-
- void willDrawInternal(CCResourceProvider*);
- bool allocatePlaneData(CCResourceProvider*);
- bool copyPlaneData(CCResourceProvider*);
- void freePlaneData(CCResourceProvider*);
- void freeUnusedPlaneData(CCResourceProvider*);
-
- // Guards the destruction of m_provider and the frame that it provides
- Mutex m_providerMutex;
- WebKit::WebVideoFrameProvider* m_provider;
-
- WebKit::WebTransformationMatrix m_streamTextureMatrix;
-
- WebKit::WebVideoFrame* m_frame;
- GC3Denum m_format;
- CCResourceProvider::ResourceId m_externalTextureResource;
-
- // Each index in this array corresponds to a plane in WebKit::WebVideoFrame.
- FramePlane m_framePlanes[WebKit::WebVideoFrame::maxPlanes];
-};
-
-}
-
-#endif // CCVideoLayerImpl_h
+// Temporary forwarding header
+#include "cc/video_layer_impl.h"
diff --git a/cc/CCYUVVideoDrawQuad.h b/cc/CCYUVVideoDrawQuad.h
index 5d574b7b..ebdd1e5 100644
--- a/cc/CCYUVVideoDrawQuad.h
+++ b/cc/CCYUVVideoDrawQuad.h
@@ -2,35 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CCYUVVideoDrawQuad_h
-#define CCYUVVideoDrawQuad_h
-
-#include "base/basictypes.h"
-#include "base/memory/scoped_ptr.h"
-#include "CCDrawQuad.h"
-#include "CCVideoLayerImpl.h"
-
-namespace cc {
-
-class CCYUVVideoDrawQuad : public CCDrawQuad {
-public:
- static scoped_ptr<CCYUVVideoDrawQuad> create(const CCSharedQuadState*, const IntRect&, const CCVideoLayerImpl::FramePlane& yPlane, const CCVideoLayerImpl::FramePlane& uPlane, const CCVideoLayerImpl::FramePlane& vPlane);
-
- const CCVideoLayerImpl::FramePlane& yPlane() const { return m_yPlane; }
- const CCVideoLayerImpl::FramePlane& uPlane() const { return m_uPlane; }
- const CCVideoLayerImpl::FramePlane& vPlane() const { return m_vPlane; }
-
- static const CCYUVVideoDrawQuad* materialCast(const CCDrawQuad*);
-private:
- CCYUVVideoDrawQuad(const CCSharedQuadState*, const IntRect&, const CCVideoLayerImpl::FramePlane& yPlane, const CCVideoLayerImpl::FramePlane& uPlane, const CCVideoLayerImpl::FramePlane& vPlane);
-
- CCVideoLayerImpl::FramePlane m_yPlane;
- CCVideoLayerImpl::FramePlane m_uPlane;
- CCVideoLayerImpl::FramePlane m_vPlane;
-
- DISALLOW_COPY_AND_ASSIGN(CCYUVVideoDrawQuad);
-};
-
-}
-
-#endif
+// Temporary forwarding header
+#include "cc/yuv_video_draw_quad.h"
diff --git a/cc/CanvasLayerTextureUpdater.h b/cc/CanvasLayerTextureUpdater.h
index c8bb9b0..cb14510 100644
--- a/cc/CanvasLayerTextureUpdater.h
+++ b/cc/CanvasLayerTextureUpdater.h
@@ -1,39 +1,6 @@
-// Copyright 2011 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-
-#ifndef CanvasLayerTextureUpdater_h
-#define CanvasLayerTextureUpdater_h
-
-#if USE(ACCELERATED_COMPOSITING)
-
-#include "LayerTextureUpdater.h"
-
-class SkCanvas;
-
-namespace cc {
-
-class LayerPainterChromium;
-
-// Base class for BitmapCanvasLayerTextureUpdater and
-// SkPictureCanvasLayerTextureUpdater that reduces code duplication between
-// their respective paintContents implementations.
-class CanvasLayerTextureUpdater : public LayerTextureUpdater {
-public:
- virtual ~CanvasLayerTextureUpdater();
-
-protected:
- explicit CanvasLayerTextureUpdater(PassOwnPtr<LayerPainterChromium>);
-
- void paintContents(SkCanvas*, const IntRect& contentRect, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpaqueRect, CCRenderingStats&);
- const IntRect& contentRect() const { return m_contentRect; }
-
-private:
- IntRect m_contentRect;
- OwnPtr<LayerPainterChromium> m_painter;
-};
-
-} // namespace cc
-#endif // USE(ACCELERATED_COMPOSITING)
-#endif // CanvasLayerTextureUpdater_h
+// Temporary forwarding header
+#include "cc/canvas_layer_texture_updater.h"
diff --git a/cc/ContentLayerChromium.h b/cc/ContentLayerChromium.h
index b8ac462..687dbd4 100644
--- a/cc/ContentLayerChromium.h
+++ b/cc/ContentLayerChromium.h
@@ -1,67 +1,6 @@
-// Copyright 2010 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-
-#ifndef ContentLayerChromium_h
-#define ContentLayerChromium_h
-
-#if USE(ACCELERATED_COMPOSITING)
-
-#include "base/basictypes.h"
-#include "LayerPainterChromium.h"
-#include "TiledLayerChromium.h"
-
-class SkCanvas;
-
-namespace cc {
-
-class ContentLayerChromiumClient;
-class FloatRect;
-class IntRect;
-class LayerTextureUpdater;
-
-class ContentLayerPainter : public LayerPainterChromium {
-public:
- static PassOwnPtr<ContentLayerPainter> create(ContentLayerChromiumClient*);
-
- virtual void paint(SkCanvas*, const IntRect& contentRect, FloatRect& opaque) OVERRIDE;
-
-private:
- explicit ContentLayerPainter(ContentLayerChromiumClient*);
-
- ContentLayerChromiumClient* m_client;
-
- DISALLOW_COPY_AND_ASSIGN(ContentLayerPainter);
-};
-
-// A layer that renders its contents into an SkCanvas.
-class ContentLayerChromium : public TiledLayerChromium {
-public:
- static scoped_refptr<ContentLayerChromium> create(ContentLayerChromiumClient*);
-
- void clearClient() { m_client = 0; }
-
- virtual bool drawsContent() const OVERRIDE;
- virtual void setTexturePriorities(const CCPriorityCalculator&) OVERRIDE;
- virtual void update(CCTextureUpdateQueue&, const CCOcclusionTracker*, CCRenderingStats&) OVERRIDE;
- virtual bool needMoreUpdates() OVERRIDE;
-
- virtual void setContentsOpaque(bool) OVERRIDE;
-
-protected:
- explicit ContentLayerChromium(ContentLayerChromiumClient*);
- virtual ~ContentLayerChromium();
-
-private:
- virtual LayerTextureUpdater* textureUpdater() const OVERRIDE;
- virtual void createTextureUpdaterIfNeeded() OVERRIDE;
-
- ContentLayerChromiumClient* m_client;
- RefPtr<LayerTextureUpdater> m_textureUpdater;
-};
-
-}
-#endif // USE(ACCELERATED_COMPOSITING)
-
-#endif
+// Temporary forwarding header
+#include "cc/content_layer.h"
diff --git a/cc/ContentLayerChromiumClient.h b/cc/ContentLayerChromiumClient.h
index 54a9267..2bfb52a 100644
--- a/cc/ContentLayerChromiumClient.h
+++ b/cc/ContentLayerChromiumClient.h
@@ -2,23 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef ContentLayerChromiumClient_h
-#define ContentLayerChromiumClient_h
-
-class SkCanvas;
-
-namespace cc {
-class FloatRect;
-class IntRect;
-
-class ContentLayerChromiumClient {
-public:
- virtual void paintContents(SkCanvas*, const IntRect& clip, FloatRect& opaque) = 0;
-
-protected:
- virtual ~ContentLayerChromiumClient() { }
-};
-
-}
-
-#endif // ContentLayerChromiumClient_h
+// Temporary forwarding header
+#include "cc/content_layer_client.h"
diff --git a/cc/DelegatedRendererLayerChromium.h b/cc/DelegatedRendererLayerChromium.h
index c7f8d2c..1b7e4e2 100644
--- a/cc/DelegatedRendererLayerChromium.h
+++ b/cc/DelegatedRendererLayerChromium.h
@@ -2,25 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef DelegatedRendererLayerChromium_h
-#define DelegatedRendererLayerChromium_h
-
-#include "LayerChromium.h"
-
-namespace cc {
-
-class DelegatedRendererLayerChromium : public LayerChromium {
-public:
- static scoped_refptr<DelegatedRendererLayerChromium> create();
-
- virtual scoped_ptr<CCLayerImpl> createCCLayerImpl() OVERRIDE;
-
-protected:
- DelegatedRendererLayerChromium();
-
-private:
- virtual ~DelegatedRendererLayerChromium();
-};
-
-}
-#endif
+// Temporary forwarding header
+#include "cc/delegated_renderer_layer.h"
diff --git a/cc/FrameBufferSkPictureCanvasLayerTextureUpdater.h b/cc/FrameBufferSkPictureCanvasLayerTextureUpdater.h
index 79093f2..78c4b33 100644
--- a/cc/FrameBufferSkPictureCanvasLayerTextureUpdater.h
+++ b/cc/FrameBufferSkPictureCanvasLayerTextureUpdater.h
@@ -1,52 +1,6 @@
-// Copyright 2011 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-
-#ifndef FrameBufferSkPictureCanvasLayerTextureUpdater_h
-#define FrameBufferSkPictureCanvasLayerTextureUpdater_h
-
-#if USE(ACCELERATED_COMPOSITING)
-
-#include "SkPictureCanvasLayerTextureUpdater.h"
-
-class GrContext;
-
-namespace WebKit {
-class WebGraphicsContext3D;
-class WebSharedGraphicsContext3D;
-}
-
-namespace cc {
-
-// This class records the contentRect into an SkPicture, then uses accelerated
-// drawing to update the texture. The accelerated drawing goes to an
-// intermediate framebuffer and then is copied to the destination texture once done.
-class FrameBufferSkPictureCanvasLayerTextureUpdater : public SkPictureCanvasLayerTextureUpdater {
-public:
- class Texture : public LayerTextureUpdater::Texture {
- public:
- Texture(FrameBufferSkPictureCanvasLayerTextureUpdater*, scoped_ptr<CCPrioritizedTexture>);
- virtual ~Texture();
-
- virtual void updateRect(CCResourceProvider*, const IntRect& sourceRect, const IntSize& destOffset) OVERRIDE;
-
- private:
- FrameBufferSkPictureCanvasLayerTextureUpdater* textureUpdater() { return m_textureUpdater; }
-
- FrameBufferSkPictureCanvasLayerTextureUpdater* m_textureUpdater;
- };
-
- static PassRefPtr<FrameBufferSkPictureCanvasLayerTextureUpdater> create(PassOwnPtr<LayerPainterChromium>);
- virtual ~FrameBufferSkPictureCanvasLayerTextureUpdater();
-
- virtual PassOwnPtr<LayerTextureUpdater::Texture> createTexture(CCPrioritizedTextureManager*) OVERRIDE;
- virtual SampledTexelFormat sampledTexelFormat(GC3Denum textureFormat) OVERRIDE;
- void updateTextureRect(WebKit::WebGraphicsContext3D*, GrContext*, CCResourceProvider*, CCPrioritizedTexture*, const IntRect& sourceRect, const IntSize& destOffset);
-
-private:
- explicit FrameBufferSkPictureCanvasLayerTextureUpdater(PassOwnPtr<LayerPainterChromium>);
-};
-} // namespace cc
-#endif // USE(ACCELERATED_COMPOSITING)
-#endif // FrameBufferSkPictureCanvasLayerTextureUpdater_h
+// Temporary forwarding header
+#include "cc/frame_buffer_skpicture_canvas_layer_texture_updater.h"
diff --git a/cc/GeometryBinding.h b/cc/GeometryBinding.h
index f0b6e72..9af39a8 100644
--- a/cc/GeometryBinding.h
+++ b/cc/GeometryBinding.h
@@ -1,48 +1,6 @@
-// Copyright 2011 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef GeometryBinding_h
-#define GeometryBinding_h
-
-#include "FloatRect.h"
-
-#if USE(ACCELERATED_COMPOSITING)
-
-namespace WebKit {
-class WebGraphicsContext3D;
-}
-
-namespace cc {
-
-class GeometryBinding {
-public:
- GeometryBinding(WebKit::WebGraphicsContext3D*, const FloatRect& quadVertexRect);
- ~GeometryBinding();
-
- bool initialized() const { return m_initialized; }
-
- WebKit::WebGraphicsContext3D* context() const { return m_context; }
- unsigned quadVerticesVbo() const { return m_quadVerticesVbo; }
- unsigned quadElementsVbo() const { return m_quadElementsVbo; }
-
- void prepareForDraw();
-
- // All layer shaders share the same attribute locations for the vertex
- // positions and texture coordinates. This allows switching shaders without
- // rebinding attribute arrays.
- static int positionAttribLocation() { return 0; }
- static int texCoordAttribLocation() { return 1; }
-
-private:
- WebKit::WebGraphicsContext3D* m_context;
- unsigned m_quadVerticesVbo;
- unsigned m_quadElementsVbo;
- bool m_initialized;
-};
-
-} // namespace cc
-
-#endif // USE(ACCELERATED_COMPOSITING)
-
-#endif
+// Temporary forwarding header
+#include "cc/geometry_binding.h"
diff --git a/cc/HeadsUpDisplayLayerChromium.h b/cc/HeadsUpDisplayLayerChromium.h
index cd2627e..3d7a138 100644
--- a/cc/HeadsUpDisplayLayerChromium.h
+++ b/cc/HeadsUpDisplayLayerChromium.h
@@ -2,37 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef HeadsUpDisplayLayerChromium_h
-#define HeadsUpDisplayLayerChromium_h
-
-#include "base/memory/scoped_ptr.h"
-#include "CCFontAtlas.h"
-#include "IntSize.h"
-#include "LayerChromium.h"
-
-namespace cc {
-
-class HeadsUpDisplayLayerChromium : public LayerChromium {
-public:
- static scoped_refptr<HeadsUpDisplayLayerChromium> create();
-
- virtual void update(CCTextureUpdateQueue&, const CCOcclusionTracker*, CCRenderingStats&) OVERRIDE;
- virtual bool drawsContent() const OVERRIDE;
-
- void setFontAtlas(scoped_ptr<CCFontAtlas>);
-
- virtual scoped_ptr<CCLayerImpl> createCCLayerImpl() OVERRIDE;
- virtual void pushPropertiesTo(CCLayerImpl*) OVERRIDE;
-
-protected:
- HeadsUpDisplayLayerChromium();
-
-private:
- virtual ~HeadsUpDisplayLayerChromium();
-
- scoped_ptr<CCFontAtlas> m_fontAtlas;
-};
-
-} // namespace cc
-
-#endif
+// Temporary forwarding header
+#include "cc/heads_up_display_layer.h"
diff --git a/cc/IOSurfaceLayerChromium.h b/cc/IOSurfaceLayerChromium.h
index f9c4b5f..085ec98 100644
--- a/cc/IOSurfaceLayerChromium.h
+++ b/cc/IOSurfaceLayerChromium.h
@@ -2,37 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-
-#ifndef IOSurfaceLayerChromium_h
-#define IOSurfaceLayerChromium_h
-
-#if USE(ACCELERATED_COMPOSITING)
-
-#include "LayerChromium.h"
-
-namespace cc {
-
-class IOSurfaceLayerChromium : public LayerChromium {
-public:
- static scoped_refptr<IOSurfaceLayerChromium> create();
-
- void setIOSurfaceProperties(uint32_t ioSurfaceId, const IntSize&);
-
- virtual scoped_ptr<CCLayerImpl> createCCLayerImpl() OVERRIDE;
- virtual bool drawsContent() const OVERRIDE;
- virtual void pushPropertiesTo(CCLayerImpl*) OVERRIDE;
-
-protected:
- IOSurfaceLayerChromium();
-
-private:
- virtual ~IOSurfaceLayerChromium();
-
- uint32_t m_ioSurfaceId;
- IntSize m_ioSurfaceSize;
-};
-
-}
-#endif // USE(ACCELERATED_COMPOSITING)
-
-#endif
+// Temporary forwarding header
+#include "cc/io_surface_layer.h"
diff --git a/cc/ImageLayerChromium.h b/cc/ImageLayerChromium.h
index 12ac397..7b7e0c7 100644
--- a/cc/ImageLayerChromium.h
+++ b/cc/ImageLayerChromium.h
@@ -1,48 +1,6 @@
-// Copyright 2010 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-
-#ifndef ImageLayerChromium_h
-#define ImageLayerChromium_h
-
-#if USE(ACCELERATED_COMPOSITING)
-
-#include "ContentLayerChromium.h"
-#include "SkBitmap.h"
-
-namespace cc {
-
-class ImageLayerTextureUpdater;
-
-// A Layer that contains only an Image element.
-class ImageLayerChromium : public TiledLayerChromium {
-public:
- static scoped_refptr<ImageLayerChromium> create();
-
- virtual bool drawsContent() const OVERRIDE;
- virtual void setTexturePriorities(const CCPriorityCalculator&) OVERRIDE;
- virtual void update(CCTextureUpdateQueue&, const CCOcclusionTracker*, CCRenderingStats&) OVERRIDE;
- virtual bool needsContentsScale() const OVERRIDE;
-
- void setBitmap(const SkBitmap& image);
-
-private:
- ImageLayerChromium();
- virtual ~ImageLayerChromium();
-
- void setTilingOption(TilingOption);
-
- virtual LayerTextureUpdater* textureUpdater() const OVERRIDE;
- virtual void createTextureUpdaterIfNeeded() OVERRIDE;
- virtual IntSize contentBounds() const OVERRIDE;
-
- SkBitmap m_bitmap;
-
- RefPtr<ImageLayerTextureUpdater> m_textureUpdater;
-};
-
-}
-#endif // USE(ACCELERATED_COMPOSITING)
-
-#endif
+// Temporary forwarding header
+#include "cc/image_layer.h"
diff --git a/cc/LayerChromium.h b/cc/LayerChromium.h
index a87caa0..ea56428 100644
--- a/cc/LayerChromium.h
+++ b/cc/LayerChromium.h
@@ -1,390 +1,6 @@
-// Copyright 2010 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-
-#ifndef LayerChromium_h
-#define LayerChromium_h
-
-#if USE(ACCELERATED_COMPOSITING)
-
-#include "base/memory/ref_counted.h"
-#include "CCLayerAnimationController.h"
-#include "CCOcclusionTracker.h"
-#include "FloatPoint.h"
-#include "Region.h"
-#include "RenderSurfaceChromium.h"
-#include "SkColor.h"
-#include <public/WebFilterOperations.h>
-#include <public/WebTransformationMatrix.h>
-#include <string>
-#include <vector>
-
-namespace WebKit {
-class WebAnimationDelegate;
-class WebLayerScrollClient;
-}
-
-namespace cc {
-
-class CCActiveAnimation;
-struct CCAnimationEvent;
-class CCLayerAnimationDelegate;
-class CCLayerImpl;
-class CCLayerTreeHost;
-class CCPriorityCalculator;
-class CCTextureUpdateQueue;
-class ScrollbarLayerChromium;
-struct CCAnimationEvent;
-struct CCRenderingStats;
-
-// Base class for composited layers. Special layer types are derived from
-// this class.
-class LayerChromium : public base::RefCounted<LayerChromium>, public CCLayerAnimationControllerClient {
-public:
- typedef std::vector<scoped_refptr<LayerChromium> > LayerList;
-
- static scoped_refptr<LayerChromium> create();
-
- // CCLayerAnimationControllerClient implementation
- virtual int id() const OVERRIDE;
- virtual void setOpacityFromAnimation(float) OVERRIDE;
- virtual float opacity() const OVERRIDE;
- virtual void setTransformFromAnimation(const WebKit::WebTransformationMatrix&) OVERRIDE;
- // A layer's transform operates layer space. That is, entirely in logical,
- // non-page-scaled pixels (that is, they have page zoom baked in, but not page scale).
- // The root layer is a special case -- it operates in physical pixels.
- virtual const WebKit::WebTransformationMatrix& transform() const OVERRIDE;
-
- LayerChromium* rootLayer();
- LayerChromium* parent() const;
- void addChild(scoped_refptr<LayerChromium>);
- void insertChild(scoped_refptr<LayerChromium>, size_t index);
- void replaceChild(LayerChromium* reference, scoped_refptr<LayerChromium> newLayer);
- void removeFromParent();
- void removeAllChildren();
- void setChildren(const LayerList&);
-
- const LayerList& children() const { return m_children; }
-
- void setAnchorPoint(const FloatPoint&);
- FloatPoint anchorPoint() const { return m_anchorPoint; }
-
- void setAnchorPointZ(float);
- float anchorPointZ() const { return m_anchorPointZ; }
-
- void setBackgroundColor(SkColor);
- SkColor backgroundColor() const { return m_backgroundColor; }
-
- // A layer's bounds are in logical, non-page-scaled pixels (however, the
- // root layer's bounds are in physical pixels).
- void setBounds(const IntSize&);
- const IntSize& bounds() const { return m_bounds; }
- virtual IntSize contentBounds() const;
-
- void setMasksToBounds(bool);
- bool masksToBounds() const { return m_masksToBounds; }
-
- void setMaskLayer(LayerChromium*);
- LayerChromium* maskLayer() const { return m_maskLayer.get(); }
-
- virtual void setNeedsDisplayRect(const FloatRect& dirtyRect);
- void setNeedsDisplay() { setNeedsDisplayRect(FloatRect(FloatPoint(), bounds())); }
- virtual bool needsDisplay() const;
-
- void setOpacity(float);
- bool opacityIsAnimating() const;
-
- void setFilters(const WebKit::WebFilterOperations&);
- const WebKit::WebFilterOperations& filters() const { return m_filters; }
-
- // Background filters are filters applied to what is behind this layer, when they are viewed through non-opaque
- // regions in this layer. They are used through the WebLayer interface, and are not exposed to HTML.
- void setBackgroundFilters(const WebKit::WebFilterOperations&);
- const WebKit::WebFilterOperations& backgroundFilters() const { return m_backgroundFilters; }
-
- virtual void setContentsOpaque(bool);
- bool contentsOpaque() const { return m_contentsOpaque; }
-
- void setPosition(const FloatPoint&);
- FloatPoint position() const { return m_position; }
-
- void setIsContainerForFixedPositionLayers(bool);
- bool isContainerForFixedPositionLayers() const { return m_isContainerForFixedPositionLayers; }
-
- void setFixedToContainerLayer(bool);
- bool fixedToContainerLayer() const { return m_fixedToContainerLayer; }
-
- void setSublayerTransform(const WebKit::WebTransformationMatrix&);
- const WebKit::WebTransformationMatrix& sublayerTransform() const { return m_sublayerTransform; }
-
- void setTransform(const WebKit::WebTransformationMatrix&);
- bool transformIsAnimating() const;
-
- const IntRect& visibleContentRect() const { return m_visibleContentRect; }
- void setVisibleContentRect(const IntRect& visibleContentRect) { m_visibleContentRect = visibleContentRect; }
-
- void setScrollPosition(const IntPoint&);
- const IntPoint& scrollPosition() const { return m_scrollPosition; }
-
- void setMaxScrollPosition(const IntSize&);
- const IntSize& maxScrollPosition() const { return m_maxScrollPosition; }
-
- void setScrollable(bool);
- bool scrollable() const { return m_scrollable; }
-
- void setShouldScrollOnMainThread(bool);
- bool shouldScrollOnMainThread() const { return m_shouldScrollOnMainThread; }
-
- void setHaveWheelEventHandlers(bool);
- bool haveWheelEventHandlers() const { return m_haveWheelEventHandlers; }
-
- void setNonFastScrollableRegion(const Region&);
- void setNonFastScrollableRegionChanged() { m_nonFastScrollableRegionChanged = true; }
- const Region& nonFastScrollableRegion() const { return m_nonFastScrollableRegion; }
-
- void setLayerScrollClient(WebKit::WebLayerScrollClient* layerScrollClient) { m_layerScrollClient = layerScrollClient; }
-
- void setDrawCheckerboardForMissingTiles(bool);
- bool drawCheckerboardForMissingTiles() const { return m_drawCheckerboardForMissingTiles; }
-
- bool forceRenderSurface() const { return m_forceRenderSurface; }
- void setForceRenderSurface(bool);
-
- IntSize scrollDelta() const { return IntSize(); }
-
- void setImplTransform(const WebKit::WebTransformationMatrix&);
- const WebKit::WebTransformationMatrix& implTransform() const { return m_implTransform; }
-
- void setDoubleSided(bool);
- bool doubleSided() const { return m_doubleSided; }
-
- void setPreserves3D(bool preserve3D) { m_preserves3D = preserve3D; }
- bool preserves3D() const { return m_preserves3D; }
-
- void setUseParentBackfaceVisibility(bool useParentBackfaceVisibility) { m_useParentBackfaceVisibility = useParentBackfaceVisibility; }
- bool useParentBackfaceVisibility() const { return m_useParentBackfaceVisibility; }
-
- virtual void setUseLCDText(bool);
- bool useLCDText() const { return m_useLCDText; }
-
- virtual void setLayerTreeHost(CCLayerTreeHost*);
-
- bool hasContributingDelegatedRenderPasses() const { return false; }
-
- void setIsDrawable(bool);
-
- void setReplicaLayer(LayerChromium*);
- LayerChromium* replicaLayer() const { return m_replicaLayer.get(); }
-
- bool hasMask() const { return m_maskLayer; }
- bool hasReplica() const { return m_replicaLayer; }
- bool replicaHasMask() const { return m_replicaLayer && (m_maskLayer || m_replicaLayer->m_maskLayer); }
-
- // These methods typically need to be overwritten by derived classes.
- virtual bool drawsContent() const;
- virtual void update(CCTextureUpdateQueue&, const CCOcclusionTracker*, CCRenderingStats&) { }
- virtual bool needMoreUpdates();
- virtual void setIsMask(bool) { }
- virtual void bindContentsTexture() { }
- virtual bool needsContentsScale() const;
-
- void setDebugBorderColor(SkColor);
- void setDebugBorderWidth(float);
- void setDebugName(const std::string&);
-
- virtual void pushPropertiesTo(CCLayerImpl*);
-
- void clearRenderSurface() { m_renderSurface.reset(); }
- RenderSurfaceChromium* renderSurface() const { return m_renderSurface.get(); }
- void createRenderSurface();
-
- float drawOpacity() const { return m_drawOpacity; }
- void setDrawOpacity(float opacity) { m_drawOpacity = opacity; }
-
- bool drawOpacityIsAnimating() const { return m_drawOpacityIsAnimating; }
- void setDrawOpacityIsAnimating(bool drawOpacityIsAnimating) { m_drawOpacityIsAnimating = drawOpacityIsAnimating; }
-
- LayerChromium* renderTarget() const { ASSERT(!m_renderTarget || m_renderTarget->renderSurface()); return m_renderTarget; }
- void setRenderTarget(LayerChromium* target) { m_renderTarget = target; }
-
- bool drawTransformIsAnimating() const { return m_drawTransformIsAnimating; }
- void setDrawTransformIsAnimating(bool animating) { m_drawTransformIsAnimating = animating; }
- bool screenSpaceTransformIsAnimating() const { return m_screenSpaceTransformIsAnimating; }
- void setScreenSpaceTransformIsAnimating(bool animating) { m_screenSpaceTransformIsAnimating = animating; }
-
- // This moves from layer space, with origin in the center to target space with origin in the top left.
- // That is, it converts from logical, non-page-scaled, to target pixels (and if the target is the
- // root render surface, then this converts to physical pixels).
- const WebKit::WebTransformationMatrix& drawTransform() const { return m_drawTransform; }
- void setDrawTransform(const WebKit::WebTransformationMatrix& matrix) { m_drawTransform = matrix; }
- // This moves from content space, with origin the top left to screen space with origin in the top left.
- // It converts logical, non-page-scaled pixels to physical pixels.
- const WebKit::WebTransformationMatrix& screenSpaceTransform() const { return m_screenSpaceTransform; }
- void setScreenSpaceTransform(const WebKit::WebTransformationMatrix& matrix) { m_screenSpaceTransform = matrix; }
- const IntRect& drawableContentRect() const { return m_drawableContentRect; }
- void setDrawableContentRect(const IntRect& rect) { m_drawableContentRect = rect; }
- // The contentsScale converts from logical, non-page-scaled pixels to target pixels.
- // The contentsScale is 1 for the root layer as it is already in physical pixels.
- float contentsScale() const { return m_contentsScale; }
- void setContentsScale(float);
-
- // When true, the layer's contents are not scaled by the current page scale factor.
- // setBoundsContainPageScale recursively sets the value on all child layers.
- void setBoundsContainPageScale(bool);
- bool boundsContainPageScale() const { return m_boundsContainPageScale; }
-
- // Returns true if any of the layer's descendants has content to draw.
- bool descendantDrawsContent();
-
- CCLayerTreeHost* layerTreeHost() const { return m_layerTreeHost; }
-
- // Set the priority of all desired textures in this layer.
- virtual void setTexturePriorities(const CCPriorityCalculator&) { }
-
- bool addAnimation(scoped_ptr<CCActiveAnimation>);
- void pauseAnimation(int animationId, double timeOffset);
- void removeAnimation(int animationId);
-
- void suspendAnimations(double monotonicTime);
- void resumeAnimations(double monotonicTime);
-
- CCLayerAnimationController* layerAnimationController() { return m_layerAnimationController.get(); }
- void setLayerAnimationController(scoped_ptr<CCLayerAnimationController>);
- scoped_ptr<CCLayerAnimationController> releaseLayerAnimationController();
-
- void setLayerAnimationDelegate(WebKit::WebAnimationDelegate* layerAnimationDelegate) { m_layerAnimationDelegate = layerAnimationDelegate; }
-
- bool hasActiveAnimation() const;
-
- virtual void notifyAnimationStarted(const CCAnimationEvent&, double wallClockTime);
- virtual void notifyAnimationFinished(double wallClockTime);
-
- virtual Region visibleContentOpaqueRegion() const;
-
- virtual ScrollbarLayerChromium* toScrollbarLayerChromium();
-
-protected:
- friend class CCLayerImpl;
- friend class TreeSynchronizer;
- virtual ~LayerChromium();
-
- LayerChromium();
-
- void setNeedsCommit();
-
- IntRect layerRectToContentRect(const WebKit::WebRect& layerRect);
-
- // This flag is set when layer need repainting/updating.
- bool m_needsDisplay;
-
- // Tracks whether this layer may have changed stacking order with its siblings.
- bool m_stackingOrderChanged;
-
- // The update rect is the region of the compositor resource that was actually updated by the compositor.
- // For layers that may do updating outside the compositor's control (i.e. plugin layers), this information
- // is not available and the update rect will remain empty.
- // Note this rect is in layer space (not content space).
- FloatRect m_updateRect;
-
- scoped_refptr<LayerChromium> m_maskLayer;
-
- // Constructs a CCLayerImpl of the correct runtime type for this LayerChromium type.
- virtual scoped_ptr<CCLayerImpl> createCCLayerImpl();
- int m_layerId;
-
-private:
- friend class base::RefCounted<LayerChromium>;
-
- void setParent(LayerChromium*);
- bool hasAncestor(LayerChromium*) const;
- bool descendantIsFixedToContainerLayer() const;
-
- size_t numChildren() const { return m_children.size(); }
-
- // Returns the index of the child or -1 if not found.
- int indexOfChild(const LayerChromium*);
-
- // This should only be called from removeFromParent.
- void removeChild(LayerChromium*);
-
- LayerList m_children;
- LayerChromium* m_parent;
-
- // LayerChromium instances have a weak pointer to their CCLayerTreeHost.
- // This pointer value is nil when a LayerChromium is not in a tree and is
- // updated via setLayerTreeHost() if a layer moves between trees.
- CCLayerTreeHost* m_layerTreeHost;
-
- scoped_ptr<CCLayerAnimationController> m_layerAnimationController;
-
- // Layer properties.
- IntSize m_bounds;
-
- // Uses layer's content space.
- IntRect m_visibleContentRect;
-
- IntPoint m_scrollPosition;
- IntSize m_maxScrollPosition;
- bool m_scrollable;
- bool m_shouldScrollOnMainThread;
- bool m_haveWheelEventHandlers;
- Region m_nonFastScrollableRegion;
- bool m_nonFastScrollableRegionChanged;
- FloatPoint m_position;
- FloatPoint m_anchorPoint;
- SkColor m_backgroundColor;
- SkColor m_debugBorderColor;
- float m_debugBorderWidth;
- std::string m_debugName;
- float m_opacity;
- WebKit::WebFilterOperations m_filters;
- WebKit::WebFilterOperations m_backgroundFilters;
- float m_anchorPointZ;
- bool m_isContainerForFixedPositionLayers;
- bool m_fixedToContainerLayer;
- bool m_isDrawable;
- bool m_masksToBounds;
- bool m_contentsOpaque;
- bool m_doubleSided;
- bool m_useLCDText;
- bool m_preserves3D;
- bool m_useParentBackfaceVisibility;
- bool m_drawCheckerboardForMissingTiles;
- bool m_forceRenderSurface;
-
- WebKit::WebTransformationMatrix m_transform;
- WebKit::WebTransformationMatrix m_sublayerTransform;
-
- // Replica layer used for reflections.
- scoped_refptr<LayerChromium> m_replicaLayer;
-
- // Transient properties.
- scoped_ptr<RenderSurfaceChromium> m_renderSurface;
- float m_drawOpacity;
- bool m_drawOpacityIsAnimating;
-
- LayerChromium* m_renderTarget;
-
- WebKit::WebTransformationMatrix m_drawTransform;
- WebKit::WebTransformationMatrix m_screenSpaceTransform;
- bool m_drawTransformIsAnimating;
- bool m_screenSpaceTransformIsAnimating;
-
- // Uses target surface space.
- IntRect m_drawableContentRect;
- float m_contentsScale;
- bool m_boundsContainPageScale;
-
- WebKit::WebTransformationMatrix m_implTransform;
-
- WebKit::WebAnimationDelegate* m_layerAnimationDelegate;
- WebKit::WebLayerScrollClient* m_layerScrollClient;
-};
-
-void sortLayers(std::vector<scoped_refptr<LayerChromium> >::iterator, std::vector<scoped_refptr<LayerChromium> >::iterator, void*);
-
-}
-#endif // USE(ACCELERATED_COMPOSITING)
-
-#endif
+// Temporary forwarding header
+#include "cc/layer.h"
diff --git a/cc/LayerPainterChromium.h b/cc/LayerPainterChromium.h
index d552382..67987d9 100644
--- a/cc/LayerPainterChromium.h
+++ b/cc/LayerPainterChromium.h
@@ -1,26 +1,6 @@
-// Copyright 2011 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-
-#ifndef LayerPainterChromium_h
-#define LayerPainterChromium_h
-
-#if USE(ACCELERATED_COMPOSITING)
-
-class SkCanvas;
-
-namespace cc {
-
-class FloatRect;
-class IntRect;
-
-class LayerPainterChromium {
-public:
- virtual ~LayerPainterChromium() { }
- virtual void paint(SkCanvas*, const IntRect& contentRect, FloatRect& opaque) = 0;
-};
-
-} // namespace cc
-#endif // USE(ACCELERATED_COMPOSITING)
-#endif // LayerPainterChromium_h
+// Temporary forwarding header
+#include "cc/layer_painter.h"
diff --git a/cc/LayerTextureSubImage.h b/cc/LayerTextureSubImage.h
index 2c6cc14..3efbf6a 100644
--- a/cc/LayerTextureSubImage.h
+++ b/cc/LayerTextureSubImage.h
@@ -1,46 +1,6 @@
-// Copyright 2011 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-
-#ifndef LayerTextureSubImage_h
-#define LayerTextureSubImage_h
-
-#if USE(ACCELERATED_COMPOSITING)
-
-#include "GraphicsTypes3D.h"
-#include "IntRect.h"
-#include "IntSize.h"
-#include <wtf/OwnArrayPtr.h>
-
-namespace WebKit {
-class WebGraphicsContext3D;
-}
-
-namespace cc {
-
-class LayerTextureSubImage {
-public:
- explicit LayerTextureSubImage(bool useMapSubForUpload);
- ~LayerTextureSubImage();
-
- void upload(const uint8_t* image, const IntRect& imageRect,
- const IntRect& sourceRect, const IntSize& destOffset,
- GC3Denum format, WebKit::WebGraphicsContext3D*);
-
-private:
- void uploadWithTexSubImage(const uint8_t* image, const IntRect& imageRect,
- const IntRect& sourceRect, const IntSize& destOffset,
- GC3Denum format, WebKit::WebGraphicsContext3D*);
- void uploadWithMapTexSubImage(const uint8_t* image, const IntRect& imageRect,
- const IntRect& sourceRect, const IntSize& destOffset,
- GC3Denum format, WebKit::WebGraphicsContext3D*);
-
- bool m_useMapTexSubImage;
- size_t m_subImageSize;
- OwnArrayPtr<uint8_t> m_subImage;
-};
-
-} // namespace cc
-#endif // USE(ACCELERATED_COMPOSITING)
-#endif // LayerTextureSubImage_h
+// Temporary forwarding header
+#include "cc/layer_texture_sub_image.h"
diff --git a/cc/LayerTextureUpdater.h b/cc/LayerTextureUpdater.h
index 89fc520..74bd00e 100644
--- a/cc/LayerTextureUpdater.h
+++ b/cc/LayerTextureUpdater.h
@@ -1,69 +1,6 @@
-// Copyright 2011 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-
-#ifndef LayerTextureUpdater_h
-#define LayerTextureUpdater_h
-
-#if USE(ACCELERATED_COMPOSITING)
-
-#include "CCPrioritizedTexture.h"
-#include "GraphicsTypes3D.h"
-#include <wtf/RefCounted.h>
-
-namespace cc {
-
-class IntRect;
-class IntSize;
-class TextureManager;
-struct CCRenderingStats;
-
-class LayerTextureUpdater : public RefCounted<LayerTextureUpdater> {
-public:
- // Allows texture uploaders to store per-tile resources.
- class Texture {
- public:
- virtual ~Texture();
-
- CCPrioritizedTexture* texture() { return m_texture.get(); }
- void swapTextureWith(scoped_ptr<CCPrioritizedTexture>& texture) { m_texture.swap(texture); }
- virtual void prepareRect(const IntRect& /* sourceRect */, CCRenderingStats&) { }
- virtual void updateRect(CCResourceProvider*, const IntRect& sourceRect, const IntSize& destOffset) = 0;
- virtual bool backingResourceWasEvicted() const;
- protected:
- explicit Texture(scoped_ptr<CCPrioritizedTexture> texture);
-
- private:
- scoped_ptr<CCPrioritizedTexture> m_texture;
- };
-
- LayerTextureUpdater()
- {
- turnOffVerifier(); // In the component build we don't have WTF threading initialized in this DLL so the thread verifier explodes.
- }
-
- virtual ~LayerTextureUpdater() { }
-
- enum SampledTexelFormat {
- SampledTexelFormatRGBA,
- SampledTexelFormatBGRA,
- SampledTexelFormatInvalid,
- };
- virtual PassOwnPtr<Texture> createTexture(CCPrioritizedTextureManager*) = 0;
- // Returns the format of the texel uploaded by this interface.
- // This format should not be confused by texture internal format.
- // This format specifies the component order in the sampled texel.
- // If the format is TexelFormatBGRA, vec4.x is blue and vec4.z is red.
- virtual SampledTexelFormat sampledTexelFormat(GC3Denum textureFormat) = 0;
- // The |resultingOpaqueRect| gives back a region of the layer that was painted opaque. If the layer is marked opaque in the updater,
- // then this region should be ignored in preference for the entire layer's area.
- virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpaqueRect, CCRenderingStats&) { }
-
- // Set true by the layer when it is known that the entire output is going to be opaque.
- virtual void setOpaque(bool) { }
-};
-
-} // namespace cc
-#endif // USE(ACCELERATED_COMPOSITING)
-#endif // LayerTextureUpdater_h
+// Temporary forwarding header
+#include "cc/layer_texture_updater.h"
diff --git a/cc/PlatformColor.h b/cc/PlatformColor.h
index 61ffd31..24690aa 100644
--- a/cc/PlatformColor.h
+++ b/cc/PlatformColor.h
@@ -1,58 +1,6 @@
-// Copyright 2011 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef PlatformColor_h
-#define PlatformColor_h
-
-#include "Extensions3D.h"
-#include "GraphicsContext3D.h"
-#include "SkTypes.h"
-#include <public/WebGraphicsContext3D.h>
-
-namespace cc {
-
-class PlatformColor {
-public:
- static GraphicsContext3D::SourceDataFormat format()
- {
- return SK_B32_SHIFT ? GraphicsContext3D::SourceFormatRGBA8 : GraphicsContext3D::SourceFormatBGRA8;
- }
-
- // Returns the most efficient texture format for this platform.
- static GC3Denum bestTextureFormat(WebKit::WebGraphicsContext3D* context, bool supportsBGRA8888)
- {
- GC3Denum textureFormat = GraphicsContext3D::RGBA;
- switch (format()) {
- case GraphicsContext3D::SourceFormatRGBA8:
- break;
- case GraphicsContext3D::SourceFormatBGRA8:
- if (supportsBGRA8888)
- textureFormat = Extensions3D::BGRA_EXT;
- break;
- default:
- ASSERT_NOT_REACHED();
- break;
- }
- return textureFormat;
- }
-
- // Return true if the given texture format has the same component order
- // as the color on this platform.
- static bool sameComponentOrder(GC3Denum textureFormat)
- {
- switch (format()) {
- case GraphicsContext3D::SourceFormatRGBA8:
- return textureFormat == GraphicsContext3D::RGBA;
- case GraphicsContext3D::SourceFormatBGRA8:
- return textureFormat == Extensions3D::BGRA_EXT;
- default:
- ASSERT_NOT_REACHED();
- return false;
- }
- }
-};
-
-} // namespace cc
-
-#endif
+// Temporary forwarding header
+#include "cc/platform_color.h"
diff --git a/cc/ProgramBinding.h b/cc/ProgramBinding.h
index 9f0d067..f44ed18 100644
--- a/cc/ProgramBinding.h
+++ b/cc/ProgramBinding.h
@@ -1,84 +1,6 @@
-// Copyright 2011 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef ProgramBinding_h
-#define ProgramBinding_h
-
-#if USE(ACCELERATED_COMPOSITING)
-
-#include <string>
-
-namespace WebKit {
-class WebGraphicsContext3D;
-}
-
-namespace cc {
-
-class ProgramBindingBase {
-public:
- ProgramBindingBase();
- ~ProgramBindingBase();
-
- void init(WebKit::WebGraphicsContext3D*, const std::string& vertexShader, const std::string& fragmentShader);
- void link(WebKit::WebGraphicsContext3D*);
- void cleanup(WebKit::WebGraphicsContext3D*);
-
- unsigned program() const { ASSERT(m_initialized); return m_program; }
- bool initialized() const { return m_initialized; }
-
-protected:
-
- unsigned loadShader(WebKit::WebGraphicsContext3D*, unsigned type, const std::string& shaderSource);
- unsigned createShaderProgram(WebKit::WebGraphicsContext3D*, unsigned vertexShader, unsigned fragmentShader);
- void cleanupShaders(WebKit::WebGraphicsContext3D*);
-
- unsigned m_program;
- unsigned m_vertexShaderId;
- unsigned m_fragmentShaderId;
- bool m_initialized;
-};
-
-template<class VertexShader, class FragmentShader>
-class ProgramBinding : public ProgramBindingBase {
-public:
- explicit ProgramBinding(WebKit::WebGraphicsContext3D* context)
- {
- ProgramBindingBase::init(context, m_vertexShader.getShaderString(), m_fragmentShader.getShaderString());
- }
-
- void initialize(WebKit::WebGraphicsContext3D* context, bool usingBindUniform)
- {
- ASSERT(context);
- ASSERT(m_program);
- ASSERT(!m_initialized);
-
- // Need to bind uniforms before linking
- if (!usingBindUniform)
- link(context);
-
- int baseUniformIndex = 0;
- m_vertexShader.init(context, m_program, usingBindUniform, &baseUniformIndex);
- m_fragmentShader.init(context, m_program, usingBindUniform, &baseUniformIndex);
-
- // Link after binding uniforms
- if (usingBindUniform)
- link(context);
-
- m_initialized = true;
- }
-
- const VertexShader& vertexShader() const { return m_vertexShader; }
- const FragmentShader& fragmentShader() const { return m_fragmentShader; }
-
-private:
-
- VertexShader m_vertexShader;
- FragmentShader m_fragmentShader;
-};
-
-} // namespace cc
-
-#endif // USE(ACCELERATED_COMPOSITING)
-
-#endif
+// Temporary forwarding header
+#include "cc/program_binding.h"
diff --git a/cc/RateLimiter.h b/cc/RateLimiter.h
index 7b48d74..90c7f54 100644
--- a/cc/RateLimiter.h
+++ b/cc/RateLimiter.h
@@ -1,53 +1,6 @@
-// Copyright 2011 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef RateLimiter_h
-#define RateLimiter_h
-
-#if USE(ACCELERATED_COMPOSITING)
-
-#include "base/memory/ref_counted.h"
-
-namespace WebKit {
-class WebGraphicsContext3D;
-}
-
-namespace cc {
-
-class RateLimiterClient {
-public:
- virtual void rateLimit() = 0;
-};
-
-// A RateLimiter can be used to make sure that a single context does not dominate all execution time.
-// To use, construct a RateLimiter class around the context and call start() whenever calls are made on the
-// context outside of normal flow control. RateLimiter will block if the context is too far ahead of the
-// compositor.
-class RateLimiter : public base::RefCounted<RateLimiter> {
-public:
- static scoped_refptr<RateLimiter> create(WebKit::WebGraphicsContext3D*, RateLimiterClient*);
-
- void start();
-
- // Context and client will not be accessed after stop().
- void stop();
-
-private:
- RateLimiter(WebKit::WebGraphicsContext3D*, RateLimiterClient*);
- ~RateLimiter();
- friend class base::RefCounted<RateLimiter>;
-
- class Task;
- friend class Task;
- void rateLimitContext();
-
- WebKit::WebGraphicsContext3D* m_context;
- bool m_active;
- RateLimiterClient *m_client;
-};
-
-}
-#endif // USE(ACCELERATED_COMPOSITING)
-
-#endif
+// Temporary forwarding header
+#include "cc/rate_limiter.h"
diff --git a/cc/RenderSurfaceChromium.h b/cc/RenderSurfaceChromium.h
index 67ed626..a7a9147 100644
--- a/cc/RenderSurfaceChromium.h
+++ b/cc/RenderSurfaceChromium.h
@@ -1,107 +1,6 @@
-// Copyright 2010 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-
-#ifndef RenderSurfaceChromium_h
-#define RenderSurfaceChromium_h
-
-#if USE(ACCELERATED_COMPOSITING)
-
-#include "base/basictypes.h"
-#include "base/memory/ref_counted.h"
-#include "FloatRect.h"
-#include "IntRect.h"
-#include <public/WebTransformationMatrix.h>
-#include <vector>
-
-namespace cc {
-
-class LayerChromium;
-
-class RenderSurfaceChromium {
-public:
- explicit RenderSurfaceChromium(LayerChromium*);
- ~RenderSurfaceChromium();
-
- // Returns the rect that encloses the RenderSurface including any reflection.
- FloatRect drawableContentRect() const;
-
- const IntRect& contentRect() const { return m_contentRect; }
- void setContentRect(const IntRect& contentRect) { m_contentRect = contentRect; }
-
- float drawOpacity() const { return m_drawOpacity; }
- void setDrawOpacity(float drawOpacity) { m_drawOpacity = drawOpacity; }
-
- bool drawOpacityIsAnimating() const { return m_drawOpacityIsAnimating; }
- void setDrawOpacityIsAnimating(bool drawOpacityIsAnimating) { m_drawOpacityIsAnimating = drawOpacityIsAnimating; }
-
- // This goes from content space with the origin in the center of the rect being transformed to the target space with the origin in the top left of the
- // rect being transformed. Position the rect so that the origin is in the center of it before applying this transform.
- const WebKit::WebTransformationMatrix& drawTransform() const { return m_drawTransform; }
- void setDrawTransform(const WebKit::WebTransformationMatrix& drawTransform) { m_drawTransform = drawTransform; }
-
- const WebKit::WebTransformationMatrix& screenSpaceTransform() const { return m_screenSpaceTransform; }
- void setScreenSpaceTransform(const WebKit::WebTransformationMatrix& screenSpaceTransform) { m_screenSpaceTransform = screenSpaceTransform; }
-
- const WebKit::WebTransformationMatrix& replicaDrawTransform() const { return m_replicaDrawTransform; }
- void setReplicaDrawTransform(const WebKit::WebTransformationMatrix& replicaDrawTransform) { m_replicaDrawTransform = replicaDrawTransform; }
-
- const WebKit::WebTransformationMatrix& replicaScreenSpaceTransform() const { return m_replicaScreenSpaceTransform; }
- void setReplicaScreenSpaceTransform(const WebKit::WebTransformationMatrix& replicaScreenSpaceTransform) { m_replicaScreenSpaceTransform = replicaScreenSpaceTransform; }
-
- bool targetSurfaceTransformsAreAnimating() const { return m_targetSurfaceTransformsAreAnimating; }
- void setTargetSurfaceTransformsAreAnimating(bool animating) { m_targetSurfaceTransformsAreAnimating = animating; }
- bool screenSpaceTransformsAreAnimating() const { return m_screenSpaceTransformsAreAnimating; }
- void setScreenSpaceTransformsAreAnimating(bool animating) { m_screenSpaceTransformsAreAnimating = animating; }
-
- const IntRect& clipRect() const { return m_clipRect; }
- void setClipRect(const IntRect& clipRect) { m_clipRect = clipRect; }
-
- typedef std::vector<scoped_refptr<LayerChromium> > LayerList;
- LayerList& layerList() { return m_layerList; }
- // A no-op since DelegatedRendererLayers on the main thread don't have any
- // RenderPasses so they can't contribute to a surface.
- void addContributingDelegatedRenderPassLayer(LayerChromium*) { }
- void clearLayerLists() { m_layerList.clear(); }
-
- void setNearestAncestorThatMovesPixels(RenderSurfaceChromium* surface) { m_nearestAncestorThatMovesPixels = surface; }
- const RenderSurfaceChromium* nearestAncestorThatMovesPixels() const { return m_nearestAncestorThatMovesPixels; }
-
-private:
- friend struct CCLayerIteratorActions;
-
- LayerChromium* m_owningLayer;
-
- // Uses this surface's space.
- IntRect m_contentRect;
-
- float m_drawOpacity;
- bool m_drawOpacityIsAnimating;
- WebKit::WebTransformationMatrix m_drawTransform;
- WebKit::WebTransformationMatrix m_screenSpaceTransform;
- WebKit::WebTransformationMatrix m_replicaDrawTransform;
- WebKit::WebTransformationMatrix m_replicaScreenSpaceTransform;
- bool m_targetSurfaceTransformsAreAnimating;
- bool m_screenSpaceTransformsAreAnimating;
-
- // Uses the space of the surface's target surface.
- IntRect m_clipRect;
-
- LayerList m_layerList;
-
- // The nearest ancestor target surface that will contain the contents of this surface, and that is going
- // to move pixels within the surface (such as with a blur). This can point to itself.
- RenderSurfaceChromium* m_nearestAncestorThatMovesPixels;
-
- // For CCLayerIteratorActions
- int m_targetRenderSurfaceLayerIndexHistory;
- int m_currentLayerIndexHistory;
-
- DISALLOW_COPY_AND_ASSIGN(RenderSurfaceChromium);
-};
-
-}
-#endif // USE(ACCELERATED_COMPOSITING)
-
-#endif
+// Temporary forwarding header
+#include "cc/render_surface.h"
diff --git a/cc/ScrollbarLayerChromium.h b/cc/ScrollbarLayerChromium.h
index 5c7cc5c..1e7384a 100644
--- a/cc/ScrollbarLayerChromium.h
+++ b/cc/ScrollbarLayerChromium.h
@@ -2,69 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-
-#ifndef ScrollbarLayerChromium_h
-#define ScrollbarLayerChromium_h
-
-#if USE(ACCELERATED_COMPOSITING)
-
-#include "LayerChromium.h"
-#include "caching_bitmap_canvas_layer_texture_updater.h"
-#include <public/WebScrollbar.h>
-#include <public/WebScrollbarThemeGeometry.h>
-#include <public/WebScrollbarThemePainter.h>
-
-namespace cc {
-
-class Scrollbar;
-class ScrollbarThemeComposite;
-class CCTextureUpdateQueue;
-
-class ScrollbarLayerChromium : public LayerChromium {
-public:
- virtual scoped_ptr<CCLayerImpl> createCCLayerImpl() OVERRIDE;
-
- static scoped_refptr<ScrollbarLayerChromium> create(PassOwnPtr<WebKit::WebScrollbar>, WebKit::WebScrollbarThemePainter, PassOwnPtr<WebKit::WebScrollbarThemeGeometry>, int scrollLayerId);
-
- // LayerChromium interface
- virtual bool needsContentsScale() const OVERRIDE;
- virtual IntSize contentBounds() const OVERRIDE;
- virtual void setTexturePriorities(const CCPriorityCalculator&) OVERRIDE;
- virtual void update(CCTextureUpdateQueue&, const CCOcclusionTracker*, CCRenderingStats&) OVERRIDE;
- virtual void setLayerTreeHost(CCLayerTreeHost*) OVERRIDE;
- virtual void pushPropertiesTo(CCLayerImpl*) OVERRIDE;
-
- int scrollLayerId() const { return m_scrollLayerId; }
- void setScrollLayerId(int id) { m_scrollLayerId = id; }
-
- virtual ScrollbarLayerChromium* toScrollbarLayerChromium() OVERRIDE;
-
-protected:
- ScrollbarLayerChromium(PassOwnPtr<WebKit::WebScrollbar>, WebKit::WebScrollbarThemePainter, PassOwnPtr<WebKit::WebScrollbarThemeGeometry>, int scrollLayerId);
- virtual ~ScrollbarLayerChromium();
-
-private:
- void updatePart(CachingBitmapCanvasLayerTextureUpdater*, LayerTextureUpdater::Texture*, const IntRect&, CCTextureUpdateQueue&, CCRenderingStats&);
- void createTextureUpdaterIfNeeded();
-
- OwnPtr<WebKit::WebScrollbar> m_scrollbar;
- WebKit::WebScrollbarThemePainter m_painter;
- OwnPtr<WebKit::WebScrollbarThemeGeometry> m_geometry;
- int m_scrollLayerId;
-
- GC3Denum m_textureFormat;
-
- RefPtr<CachingBitmapCanvasLayerTextureUpdater> m_backTrackUpdater;
- RefPtr<CachingBitmapCanvasLayerTextureUpdater> m_foreTrackUpdater;
- RefPtr<CachingBitmapCanvasLayerTextureUpdater> m_thumbUpdater;
-
- // All the parts of the scrollbar except the thumb
- OwnPtr<LayerTextureUpdater::Texture> m_backTrack;
- OwnPtr<LayerTextureUpdater::Texture> m_foreTrack;
- OwnPtr<LayerTextureUpdater::Texture> m_thumb;
-};
-
-}
-#endif // USE(ACCELERATED_COMPOSITING)
-
-#endif
+// Temporary forwarding header
+#include "cc/scrollbar_layer.h"
diff --git a/cc/ShaderChromium.h b/cc/ShaderChromium.h
index 2518382..5170597 100644
--- a/cc/ShaderChromium.h
+++ b/cc/ShaderChromium.h
@@ -1,353 +1,6 @@
-// Copyright 2011 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef ShaderChromium_h
-#define ShaderChromium_h
-
-#if USE(ACCELERATED_COMPOSITING)
-
-#include "SkColorPriv.h"
-#include <string>
-
-namespace WebKit {
-class WebGraphicsContext3D;
-}
-
-namespace cc {
-
-class VertexShaderPosTex {
-public:
- VertexShaderPosTex();
-
- void init(WebKit::WebGraphicsContext3D*, unsigned program, bool usingBindUniform, int* baseUniformIndex);
- std::string getShaderString() const;
-
- int matrixLocation() const { return m_matrixLocation; }
-
-private:
- int m_matrixLocation;
-};
-
-class VertexShaderPosTexYUVStretch {
-public:
- VertexShaderPosTexYUVStretch();
-
- void init(WebKit::WebGraphicsContext3D*, unsigned program, bool usingBindUniform, int* baseUniformIndex);
- std::string getShaderString() const;
-
- int matrixLocation() const { return m_matrixLocation; }
- int yWidthScaleFactorLocation() const { return m_yWidthScaleFactorLocation; }
- int uvWidthScaleFactorLocation() const { return m_uvWidthScaleFactorLocation; }
-
-private:
- int m_matrixLocation;
- int m_yWidthScaleFactorLocation;
- int m_uvWidthScaleFactorLocation;
-};
-
-class VertexShaderPos {
-public:
- VertexShaderPos();
-
- void init(WebKit::WebGraphicsContext3D*, unsigned program, bool usingBindUniform, int* baseUniformIndex);
- std::string getShaderString() const;
-
- int matrixLocation() const { return m_matrixLocation; }
-
-private:
- int m_matrixLocation;
-};
-
-class VertexShaderPosTexIdentity {
-public:
- void init(WebKit::WebGraphicsContext3D*, unsigned program, bool usingBindUniform, int* baseUniformIndex) { }
- std::string getShaderString() const;
-};
-
-class VertexShaderPosTexTransform {
-public:
- VertexShaderPosTexTransform();
-
- void init(WebKit::WebGraphicsContext3D*, unsigned program, bool usingBindUniform, int* baseUniformIndex);
- std::string getShaderString() const;
-
- int matrixLocation() const { return m_matrixLocation; }
- int texTransformLocation() const { return m_texTransformLocation; }
-
-private:
- int m_matrixLocation;
- int m_texTransformLocation;
-};
-
-class VertexShaderQuad {
-public:
- VertexShaderQuad();
-
- void init(WebKit::WebGraphicsContext3D*, unsigned program, bool usingBindUniform, int* baseUniformIndex);
- std::string getShaderString() const;
-
- int matrixLocation() const { return m_matrixLocation; }
- int pointLocation() const { return m_pointLocation; }
-
-private:
- int m_matrixLocation;
- int m_pointLocation;
-};
-
-class VertexShaderTile {
-public:
- VertexShaderTile();
-
- void init(WebKit::WebGraphicsContext3D*, unsigned program, bool usingBindUniform, int* baseUniformIndex);
- std::string getShaderString() const;
-
- int matrixLocation() const { return m_matrixLocation; }
- int pointLocation() const { return m_pointLocation; }
- int vertexTexTransformLocation() const { return m_vertexTexTransformLocation; }
-
-private:
- int m_matrixLocation;
- int m_pointLocation;
- int m_vertexTexTransformLocation;
-};
-
-class VertexShaderVideoTransform {
-public:
- VertexShaderVideoTransform();
-
- bool init(WebKit::WebGraphicsContext3D*, unsigned program, bool usingBindUniform, int* baseUniformIndex);
- std::string getShaderString() const;
-
- int matrixLocation() const { return m_matrixLocation; }
- int texMatrixLocation() const { return m_texMatrixLocation; }
-
-private:
- int m_matrixLocation;
- int m_texMatrixLocation;
-};
-
-class FragmentTexAlphaBinding {
-public:
- FragmentTexAlphaBinding();
-
- void init(WebKit::WebGraphicsContext3D*, unsigned program, bool usingBindUniform, int* baseUniformIndex);
- int alphaLocation() const { return m_alphaLocation; }
- int edgeLocation() const { return -1; }
- int fragmentTexTransformLocation() const { return -1; }
- int samplerLocation() const { return m_samplerLocation; }
-
-private:
- int m_samplerLocation;
- int m_alphaLocation;
-};
-
-class FragmentTexOpaqueBinding {
-public:
- FragmentTexOpaqueBinding();
-
- void init(WebKit::WebGraphicsContext3D*, unsigned program, bool usingBindUniform, int* baseUniformIndex);
- int alphaLocation() const { return -1; }
- int edgeLocation() const { return -1; }
- int fragmentTexTransformLocation() const { return -1; }
- int samplerLocation() const { return m_samplerLocation; }
-
-private:
- int m_samplerLocation;
-};
-
-class FragmentShaderRGBATexFlipAlpha : public FragmentTexAlphaBinding {
-public:
- std::string getShaderString() const;
-};
-
-class FragmentShaderRGBATexAlpha : public FragmentTexAlphaBinding {
-public:
- std::string getShaderString() const;
-};
-
-class FragmentShaderRGBATexRectFlipAlpha : public FragmentTexAlphaBinding {
-public:
- std::string getShaderString() const;
-};
-
-class FragmentShaderRGBATexRectAlpha : public FragmentTexAlphaBinding {
-public:
- std::string getShaderString() const;
-};
-
-class FragmentShaderRGBATexOpaque : public FragmentTexOpaqueBinding {
-public:
- std::string getShaderString() const;
-};
-
-class FragmentShaderRGBATex : public FragmentTexOpaqueBinding {
-public:
- std::string getShaderString() const;
-};
-
-// Swizzles the red and blue component of sampled texel with alpha.
-class FragmentShaderRGBATexSwizzleAlpha : public FragmentTexAlphaBinding {
-public:
- std::string getShaderString() const;
-};
-
-// Swizzles the red and blue component of sampled texel without alpha.
-class FragmentShaderRGBATexSwizzleOpaque : public FragmentTexOpaqueBinding {
-public:
- std::string getShaderString() const;
-};
-
-// Fragment shader for external textures.
-class FragmentShaderOESImageExternal : public FragmentTexAlphaBinding {
-public:
- std::string getShaderString() const;
- bool init(WebKit::WebGraphicsContext3D*, unsigned program, bool usingBindUniform, int* baseUniformIndex);
-private:
- int m_samplerLocation;
-};
-
-class FragmentShaderRGBATexAlphaAA {
-public:
- FragmentShaderRGBATexAlphaAA();
-
- void init(WebKit::WebGraphicsContext3D*, unsigned program, bool usingBindUniform, int* baseUniformIndex);
- std::string getShaderString() const;
-
- int alphaLocation() const { return m_alphaLocation; }
- int samplerLocation() const { return m_samplerLocation; }
- int edgeLocation() const { return m_edgeLocation; }
-
-private:
- int m_samplerLocation;
- int m_alphaLocation;
- int m_edgeLocation;
-};
-
-class FragmentTexClampAlphaAABinding {
-public:
- FragmentTexClampAlphaAABinding();
-
- void init(WebKit::WebGraphicsContext3D*, unsigned program, bool usingBindUniform, int* baseUniformIndex);
- int alphaLocation() const { return m_alphaLocation; }
- int samplerLocation() const { return m_samplerLocation; }
- int fragmentTexTransformLocation() const { return m_fragmentTexTransformLocation; }
- int edgeLocation() const { return m_edgeLocation; }
-
-private:
- int m_samplerLocation;
- int m_alphaLocation;
- int m_fragmentTexTransformLocation;
- int m_edgeLocation;
-};
-
-class FragmentShaderRGBATexClampAlphaAA : public FragmentTexClampAlphaAABinding {
-public:
- std::string getShaderString() const;
-};
-
-// Swizzles the red and blue component of sampled texel.
-class FragmentShaderRGBATexClampSwizzleAlphaAA : public FragmentTexClampAlphaAABinding {
-public:
- std::string getShaderString() const;
-};
-
-class FragmentShaderRGBATexAlphaMask {
-public:
- FragmentShaderRGBATexAlphaMask();
- std::string getShaderString() const;
-
- void init(WebKit::WebGraphicsContext3D*, unsigned program, bool usingBindUniform, int* baseUniformIndex);
- int alphaLocation() const { return m_alphaLocation; }
- int samplerLocation() const { return m_samplerLocation; }
- int maskSamplerLocation() const { return m_maskSamplerLocation; }
- int maskTexCoordScaleLocation() const { return m_maskTexCoordScaleLocation; }
- int maskTexCoordOffsetLocation() const { return m_maskTexCoordOffsetLocation; }
-
-private:
- int m_samplerLocation;
- int m_maskSamplerLocation;
- int m_alphaLocation;
- int m_maskTexCoordScaleLocation;
- int m_maskTexCoordOffsetLocation;
-};
-
-class FragmentShaderRGBATexAlphaMaskAA {
-public:
- FragmentShaderRGBATexAlphaMaskAA();
- std::string getShaderString() const;
-
- void init(WebKit::WebGraphicsContext3D*, unsigned program, bool usingBindUniform, int* baseUniformIndex);
- int alphaLocation() const { return m_alphaLocation; }
- int samplerLocation() const { return m_samplerLocation; }
- int maskSamplerLocation() const { return m_maskSamplerLocation; }
- int edgeLocation() const { return m_edgeLocation; }
- int maskTexCoordScaleLocation() const { return m_maskTexCoordScaleLocation; }
- int maskTexCoordOffsetLocation() const { return m_maskTexCoordOffsetLocation; }
-
-private:
- int m_samplerLocation;
- int m_maskSamplerLocation;
- int m_alphaLocation;
- int m_edgeLocation;
- int m_maskTexCoordScaleLocation;
- int m_maskTexCoordOffsetLocation;
-};
-
-class FragmentShaderYUVVideo {
-public:
- FragmentShaderYUVVideo();
- std::string getShaderString() const;
-
- void init(WebKit::WebGraphicsContext3D*, unsigned program, bool usingBindUniform, int* baseUniformIndex);
-
- int yTextureLocation() const { return m_yTextureLocation; }
- int uTextureLocation() const { return m_uTextureLocation; }
- int vTextureLocation() const { return m_vTextureLocation; }
- int alphaLocation() const { return m_alphaLocation; }
- int ccMatrixLocation() const { return m_ccMatrixLocation; }
- int yuvAdjLocation() const { return m_yuvAdjLocation; }
-
-private:
- int m_yTextureLocation;
- int m_uTextureLocation;
- int m_vTextureLocation;
- int m_alphaLocation;
- int m_ccMatrixLocation;
- int m_yuvAdjLocation;
-};
-
-class FragmentShaderColor {
-public:
- FragmentShaderColor();
- std::string getShaderString() const;
-
- void init(WebKit::WebGraphicsContext3D*, unsigned program, bool usingBindUniform, int* baseUniformIndex);
- int colorLocation() const { return m_colorLocation; }
-
-private:
- int m_colorLocation;
-};
-
-class FragmentShaderCheckerboard {
-public:
- FragmentShaderCheckerboard();
- std::string getShaderString() const;
-
- void init(WebKit::WebGraphicsContext3D*, unsigned program, bool usingBindUniform, int* baseUniformIndex);
- int alphaLocation() const { return m_alphaLocation; }
- int texTransformLocation() const { return m_texTransformLocation; }
- int frequencyLocation() const { return m_frequencyLocation; }
- int colorLocation() const { return m_colorLocation; }
-private:
- int m_alphaLocation;
- int m_texTransformLocation;
- int m_frequencyLocation;
- int m_colorLocation;
-};
-
-} // namespace cc
-
-#endif // USE(ACCELERATED_COMPOSITING)
-
-#endif
+// Temporary forwarding header
+#include "cc/shader.h"
diff --git a/cc/SkPictureCanvasLayerTextureUpdater.h b/cc/SkPictureCanvasLayerTextureUpdater.h
index fd9bb5f..8d3d49e 100644
--- a/cc/SkPictureCanvasLayerTextureUpdater.h
+++ b/cc/SkPictureCanvasLayerTextureUpdater.h
@@ -1,48 +1,6 @@
-// Copyright 2011 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-
-#ifndef SkPictureCanvasLayerTextureUpdater_h
-#define SkPictureCanvasLayerTextureUpdater_h
-
-#if USE(ACCELERATED_COMPOSITING)
-
-#include "CanvasLayerTextureUpdater.h"
-#include "SkPicture.h"
-
-class SkCanvas;
-
-namespace cc {
-
-class LayerPainterChromium;
-
-// This class records the contentRect into an SkPicture. Subclasses, provide
-// different implementations of tile updating based on this recorded picture.
-// The BitmapSkPictureCanvasLayerTextureUpdater and
-// FrameBufferSkPictureCanvasLayerTextureUpdater are two examples of such
-// implementations.
-class SkPictureCanvasLayerTextureUpdater : public CanvasLayerTextureUpdater {
-public:
- virtual ~SkPictureCanvasLayerTextureUpdater();
-
- virtual void setOpaque(bool) OVERRIDE;
-
-protected:
- explicit SkPictureCanvasLayerTextureUpdater(PassOwnPtr<LayerPainterChromium>);
-
- virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpaqueRect, CCRenderingStats&) OVERRIDE;
- void drawPicture(SkCanvas*);
-
- bool layerIsOpaque() const { return m_layerIsOpaque; }
-
-private:
- // Recording canvas.
- SkPicture m_picture;
- // True when it is known that all output pixels will be opaque.
- bool m_layerIsOpaque;
-};
-
-} // namespace cc
-#endif // USE(ACCELERATED_COMPOSITING)
-#endif // SkPictureCanvasLayerTextureUpdater_h
+// Temporary forwarding header
+#include "cc/skpicture_canvas_layer_texture_updater.h"
diff --git a/cc/SolidColorLayerChromium.h b/cc/SolidColorLayerChromium.h
index 9123484..a60d376 100644
--- a/cc/SolidColorLayerChromium.h
+++ b/cc/SolidColorLayerChromium.h
@@ -2,32 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-
-#ifndef SolidColorLayerChromium_h
-#define SolidColorLayerChromium_h
-
-#if USE(ACCELERATED_COMPOSITING)
-
-#include "LayerChromium.h"
-
-namespace cc {
-
-// A Layer that renders a solid color. The color is specified by using
-// setBackgroundColor() on the base class.
-class SolidColorLayerChromium : public LayerChromium {
-public:
- static scoped_refptr<SolidColorLayerChromium> create();
-
- virtual scoped_ptr<CCLayerImpl> createCCLayerImpl() OVERRIDE;
-
-protected:
- SolidColorLayerChromium();
-
-private:
- virtual ~SolidColorLayerChromium();
-};
-
-}
-#endif // USE(ACCELERATED_COMPOSITING)
-
-#endif
+// Temporary forwarding header
+#include "cc/solid_color_layer.h"
diff --git a/cc/TextureCopier.h b/cc/TextureCopier.h
index ba8d7bf..de210fe 100644
--- a/cc/TextureCopier.h
+++ b/cc/TextureCopier.h
@@ -2,69 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef TextureCopier_h
-#define TextureCopier_h
-
-#include "base/basictypes.h"
-#include "GraphicsContext3D.h"
-#include "ProgramBinding.h"
-#include "ShaderChromium.h"
-#include <wtf/OwnPtr.h>
-#include <wtf/PassOwnPtr.h>
-
-namespace WebKit {
-class WebGraphicsContext3D;
-}
-
-namespace cc {
-class IntSize;
-
-class TextureCopier {
-public:
- struct Parameters {
- unsigned sourceTexture;
- unsigned destTexture;
- IntSize size;
- };
- // Copy the base level contents of |sourceTexture| to |destTexture|. Both texture objects
- // must be complete and have a base level of |size| dimensions. The color formats do not need
- // to match, but |destTexture| must have a renderable format.
- virtual void copyTexture(Parameters) = 0;
- virtual void flush() = 0;
-
- virtual ~TextureCopier() { }
-};
-
-#if USE(ACCELERATED_COMPOSITING)
-
-class AcceleratedTextureCopier : public TextureCopier {
-public:
- static PassOwnPtr<AcceleratedTextureCopier> create(WebKit::WebGraphicsContext3D* context, bool usingBindUniforms)
- {
- return adoptPtr(new AcceleratedTextureCopier(context, usingBindUniforms));
- }
- virtual ~AcceleratedTextureCopier();
-
- virtual void copyTexture(Parameters) OVERRIDE;
- virtual void flush() OVERRIDE;
-
-protected:
- AcceleratedTextureCopier(WebKit::WebGraphicsContext3D*, bool usingBindUniforms);
-
-private:
- typedef ProgramBinding<VertexShaderPosTexIdentity, FragmentShaderRGBATex> BlitProgram;
-
- WebKit::WebGraphicsContext3D* m_context;
- Platform3DObject m_fbo;
- Platform3DObject m_positionBuffer;
- OwnPtr<BlitProgram> m_blitProgram;
- bool m_usingBindUniforms;
-
- DISALLOW_COPY_AND_ASSIGN(AcceleratedTextureCopier);
-};
-
-#endif // USE(ACCELERATED_COMPOSITING)
-
-}
-
-#endif
+// Temporary forwarding header
+#include "cc/texture_copier.h"
diff --git a/cc/TextureLayerChromium.h b/cc/TextureLayerChromium.h
index 124f845..620c2d5 100644
--- a/cc/TextureLayerChromium.h
+++ b/cc/TextureLayerChromium.h
@@ -1,77 +1,6 @@
-// Copyright 2010 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef TextureLayerChromium_h
-#define TextureLayerChromium_h
-
-#if USE(ACCELERATED_COMPOSITING)
-
-#include "LayerChromium.h"
-
-namespace WebKit {
-class WebGraphicsContext3D;
-}
-
-namespace cc {
-
-class TextureLayerChromiumClient;
-
-// A Layer containing a the rendered output of a plugin instance.
-class TextureLayerChromium : public LayerChromium {
-public:
- // If this texture layer requires special preparation logic for each frame driven by
- // the compositor, pass in a non-nil client. Pass in a nil client pointer if texture updates
- // are driven by an external process.
- static scoped_refptr<TextureLayerChromium> create(TextureLayerChromiumClient*);
-
- void clearClient() { m_client = 0; }
-
- virtual scoped_ptr<CCLayerImpl> createCCLayerImpl() OVERRIDE;
-
- // Sets whether this texture should be Y-flipped at draw time. Defaults to true.
- void setFlipped(bool);
-
- // Sets a UV transform to be used at draw time. Defaults to (0, 0, 1, 1).
- void setUVRect(const FloatRect&);
-
- // Sets whether the alpha channel is premultiplied or unpremultiplied. Defaults to true.
- void setPremultipliedAlpha(bool);
-
- // Sets whether this context should rate limit on damage to prevent too many frames from
- // being queued up before the compositor gets a chance to run. Requires a non-nil client.
- // Defaults to false.
- void setRateLimitContext(bool);
-
- // Code path for plugins which supply their own texture ID.
- void setTextureId(unsigned);
-
- void willModifyTexture();
-
- virtual void setNeedsDisplayRect(const FloatRect&) OVERRIDE;
-
- virtual void setLayerTreeHost(CCLayerTreeHost*) OVERRIDE;
- virtual bool drawsContent() const OVERRIDE;
- virtual void update(CCTextureUpdateQueue&, const CCOcclusionTracker*, CCRenderingStats&) OVERRIDE;
- virtual void pushPropertiesTo(CCLayerImpl*) OVERRIDE;
-
-protected:
- explicit TextureLayerChromium(TextureLayerChromiumClient*);
- virtual ~TextureLayerChromium();
-
-private:
- TextureLayerChromiumClient* m_client;
-
- bool m_flipped;
- FloatRect m_uvRect;
- bool m_premultipliedAlpha;
- bool m_rateLimitContext;
- bool m_contextLost;
-
- unsigned m_textureId;
-};
-
-}
-#endif // USE(ACCELERATED_COMPOSITING)
-
-#endif
+// Temporary forwarding header
+#include "cc/texture_layer.h"
diff --git a/cc/TextureLayerChromiumClient.h b/cc/TextureLayerChromiumClient.h
index 4edbe9f..bec4fa5 100644
--- a/cc/TextureLayerChromiumClient.h
+++ b/cc/TextureLayerChromiumClient.h
@@ -2,30 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef TextureLayerChromiumClient_h
-#define TextureLayerChromiumClient_h
-
-namespace WebKit {
-class WebGraphicsContext3D;
-}
-
-namespace cc {
-class CCTextureUpdateQueue;
-
-class TextureLayerChromiumClient {
-public:
- // Called to prepare this layer's texture for compositing. The client may queue a texture
- // upload or copy on the CCTextureUpdateQueue.
- // Returns the texture ID to be used for compositing.
- virtual unsigned prepareTexture(CCTextureUpdateQueue&) = 0;
-
- // Returns the context that is providing the texture. Used for rate limiting and detecting lost context.
- virtual WebKit::WebGraphicsContext3D* context() = 0;
-
-protected:
- virtual ~TextureLayerChromiumClient() { }
-};
-
-}
-
-#endif // TextureLayerChromiumClient_h
+// Temporary forwarding header
+#include "cc/texture_layer_client.h"
diff --git a/cc/TextureUploader.h b/cc/TextureUploader.h
index 5505204..0cf73f7 100644
--- a/cc/TextureUploader.h
+++ b/cc/TextureUploader.h
@@ -2,31 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef TextureUploader_h
-#define TextureUploader_h
-
-#include "LayerTextureUpdater.h"
-
-namespace cc {
-
-class TextureUploader {
-public:
- struct Parameters {
- LayerTextureUpdater::Texture* texture;
- IntRect sourceRect;
- IntSize destOffset;
- };
-
- virtual ~TextureUploader() { }
-
- virtual size_t numBlockingUploads() = 0;
- virtual void markPendingUploadsAsNonBlocking() = 0;
-
- // Returns our throughput on the GPU process
- virtual double estimatedTexturesPerSecond() = 0;
- virtual void uploadTexture(CCResourceProvider*, Parameters) = 0;
-};
-
-}
-
-#endif
+// Temporary forwarding header
+#include "cc/texture_uploader.h"
diff --git a/cc/ThrottledTextureUploader.h b/cc/ThrottledTextureUploader.h
index f517401..f839d24 100644
--- a/cc/ThrottledTextureUploader.h
+++ b/cc/ThrottledTextureUploader.h
@@ -2,75 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef ThrottledTextureUploader_h
-#define ThrottledTextureUploader_h
-
-#include "TextureUploader.h"
-
-#include "base/basictypes.h"
-#include <deque>
-#include <wtf/Deque.h>
-
-namespace WebKit {
-class WebGraphicsContext3D;
-}
-
-namespace cc {
-
-class ThrottledTextureUploader : public TextureUploader {
-public:
- static PassOwnPtr<ThrottledTextureUploader> create(WebKit::WebGraphicsContext3D* context)
- {
- return adoptPtr(new ThrottledTextureUploader(context));
- }
- virtual ~ThrottledTextureUploader();
-
- virtual size_t numBlockingUploads() OVERRIDE;
- virtual void markPendingUploadsAsNonBlocking() OVERRIDE;
- virtual double estimatedTexturesPerSecond() OVERRIDE;
- virtual void uploadTexture(CCResourceProvider*, Parameters) OVERRIDE;
-
-private:
- class Query {
- public:
- static PassOwnPtr<Query> create(WebKit::WebGraphicsContext3D* context) { return adoptPtr(new Query(context)); }
-
- virtual ~Query();
-
- void begin();
- void end();
- bool isPending();
- void wait();
- unsigned value();
- size_t texturesUploaded();
- void markAsNonBlocking();
- bool isNonBlocking();
-
- private:
- explicit Query(WebKit::WebGraphicsContext3D*);
-
- WebKit::WebGraphicsContext3D* m_context;
- unsigned m_queryId;
- unsigned m_value;
- bool m_hasValue;
- bool m_isNonBlocking;
- };
-
- ThrottledTextureUploader(WebKit::WebGraphicsContext3D*);
-
- void beginQuery();
- void endQuery();
- void processQueries();
-
- WebKit::WebGraphicsContext3D* m_context;
- Deque<OwnPtr<Query> > m_pendingQueries;
- Deque<OwnPtr<Query> > m_availableQueries;
- std::deque<double> m_texturesPerSecondHistory;
- size_t m_numBlockingTextureUploads;
-
- DISALLOW_COPY_AND_ASSIGN(ThrottledTextureUploader);
-};
-
-}
-
-#endif
+// Temporary forwarding header
+#include "cc/throttled_texture_uploader.h"
diff --git a/cc/TiledLayerChromium.h b/cc/TiledLayerChromium.h
index 3c27382..cdf7868 100644
--- a/cc/TiledLayerChromium.h
+++ b/cc/TiledLayerChromium.h
@@ -1,105 +1,6 @@
-// Copyright 2011 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef TiledLayerChromium_h
-#define TiledLayerChromium_h
-
-#if USE(ACCELERATED_COMPOSITING)
-
-#include "CCLayerTilingData.h"
-#include "LayerChromium.h"
-#include "LayerTextureUpdater.h"
-
-namespace cc {
-class UpdatableTile;
-
-class TiledLayerChromium : public LayerChromium {
-public:
- enum TilingOption { AlwaysTile, NeverTile, AutoTile };
-
- virtual void setIsMask(bool) OVERRIDE;
-
- virtual void pushPropertiesTo(CCLayerImpl*) OVERRIDE;
-
- virtual bool drawsContent() const OVERRIDE;
- virtual bool needsContentsScale() const OVERRIDE;
-
- virtual IntSize contentBounds() const OVERRIDE;
-
- virtual void setNeedsDisplayRect(const FloatRect&) OVERRIDE;
-
- virtual void setUseLCDText(bool) OVERRIDE;
-
- virtual void setLayerTreeHost(CCLayerTreeHost*) OVERRIDE;
-
- virtual void setTexturePriorities(const CCPriorityCalculator&) OVERRIDE;
-
- virtual Region visibleContentOpaqueRegion() const OVERRIDE;
-
- virtual void update(CCTextureUpdateQueue&, const CCOcclusionTracker*, CCRenderingStats&) OVERRIDE;
-
-protected:
- TiledLayerChromium();
- virtual ~TiledLayerChromium();
-
- void updateTileSizeAndTilingOption();
- void updateBounds();
-
- // Exposed to subclasses for testing.
- void setTileSize(const IntSize&);
- void setTextureFormat(GC3Denum textureFormat) { m_textureFormat = textureFormat; }
- void setBorderTexelOption(CCLayerTilingData::BorderTexelOption);
- void setSampledTexelFormat(LayerTextureUpdater::SampledTexelFormat sampledTexelFormat) { m_sampledTexelFormat = sampledTexelFormat; }
- size_t numPaintedTiles() { return m_tiler->tiles().size(); }
-
- virtual LayerTextureUpdater* textureUpdater() const = 0;
- virtual void createTextureUpdaterIfNeeded() = 0;
-
- // Set invalidations to be potentially repainted during update().
- void invalidateContentRect(const IntRect& contentRect);
-
- // Reset state on tiles that will be used for updating the layer.
- void resetUpdateState();
-
- // After preparing an update, returns true if more painting is needed.
- bool needsIdlePaint();
- IntRect idlePaintRect();
-
- bool skipsDraw() const { return m_skipsDraw; }
-
- // Virtual for testing
- virtual CCPrioritizedTextureManager* textureManager() const;
-
-private:
- virtual scoped_ptr<CCLayerImpl> createCCLayerImpl() OVERRIDE;
-
- void createTilerIfNeeded();
- void setTilingOption(TilingOption);
-
- bool tileOnlyNeedsPartialUpdate(UpdatableTile*);
- bool tileNeedsBufferedUpdate(UpdatableTile*);
-
- void markOcclusionsAndRequestTextures(int left, int top, int right, int bottom, const CCOcclusionTracker*);
-
- bool updateTiles(int left, int top, int right, int bottom, CCTextureUpdateQueue&, const CCOcclusionTracker*, CCRenderingStats&, bool& didPaint);
- bool haveTexturesForTiles(int left, int top, int right, int bottom, bool ignoreOcclusions);
- IntRect markTilesForUpdate(int left, int top, int right, int bottom, bool ignoreOcclusions);
- void updateTileTextures(const IntRect& paintRect, int left, int top, int right, int bottom, CCTextureUpdateQueue&, const CCOcclusionTracker*, CCRenderingStats&);
-
- UpdatableTile* tileAt(int, int) const;
- UpdatableTile* createTile(int, int);
-
- GC3Denum m_textureFormat;
- bool m_skipsDraw;
- bool m_failedUpdate;
- LayerTextureUpdater::SampledTexelFormat m_sampledTexelFormat;
-
- TilingOption m_tilingOption;
- OwnPtr<CCLayerTilingData> m_tiler;
-};
-
-}
-#endif // USE(ACCELERATED_COMPOSITING)
-
-#endif
+// Temporary forwarding header
+#include "cc/tiled_layer.h"
diff --git a/cc/TreeSynchronizer.h b/cc/TreeSynchronizer.h
index 2609841..f6e56c1 100644
--- a/cc/TreeSynchronizer.h
+++ b/cc/TreeSynchronizer.h
@@ -1,41 +1,6 @@
-// Copyright 2011 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef TreeSynchronizer_h
-#define TreeSynchronizer_h
-
-#include "base/basictypes.h"
-#include "base/memory/scoped_ptr.h"
-#include "cc/scoped_ptr_hash_map.h"
-
-namespace cc {
-
-class CCLayerImpl;
-class CCLayerTreeHostImpl;
-class LayerChromium;
-
-class TreeSynchronizer {
-public:
- // Accepts a LayerChromium tree and returns a reference to a CCLayerImpl tree that duplicates the structure
- // of the LayerChromium tree, reusing the CCLayerImpls in the tree provided by oldCCLayerImplRoot if possible.
- static scoped_ptr<CCLayerImpl> synchronizeTrees(LayerChromium* layerRoot, scoped_ptr<CCLayerImpl> oldCCLayerImplRoot, CCLayerTreeHostImpl*);
-
-private:
- TreeSynchronizer(); // Not instantiable.
-
- typedef ScopedPtrHashMap<int, CCLayerImpl> ScopedPtrCCLayerImplMap;
- typedef base::hash_map<int, CCLayerImpl*> RawPtrCCLayerImplMap;
-
- // Declared as static member functions so they can access functions on LayerChromium as a friend class.
- static scoped_ptr<CCLayerImpl> reuseOrCreateCCLayerImpl(RawPtrCCLayerImplMap& newLayers, ScopedPtrCCLayerImplMap& oldLayers, LayerChromium*);
- static void collectExistingCCLayerImplRecursive(ScopedPtrCCLayerImplMap& oldLayers, scoped_ptr<CCLayerImpl>);
- static scoped_ptr<CCLayerImpl> synchronizeTreeRecursive(RawPtrCCLayerImplMap& newLayers, ScopedPtrCCLayerImplMap& oldLayers, LayerChromium*, CCLayerTreeHostImpl*);
- static void updateScrollbarLayerPointersRecursive(const RawPtrCCLayerImplMap& newLayers, LayerChromium*);
-
- DISALLOW_COPY_AND_ASSIGN(TreeSynchronizer);
-};
-
-} // namespace cc
-
-#endif // TreeSynchronizer_h
+// Temporary forwarding header
+#include "cc/tree_synchronizer.h"
diff --git a/cc/UnthrottledTextureUploader.h b/cc/UnthrottledTextureUploader.h
index bc0822a..6df0878 100644
--- a/cc/UnthrottledTextureUploader.h
+++ b/cc/UnthrottledTextureUploader.h
@@ -2,35 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef UnthrottledTextureUploader_h
-#define UnthrottledTextureUploader_h
-
-#include "base/basictypes.h"
-#include "CCResourceProvider.h"
-#include "TextureUploader.h"
-
-namespace cc {
-
-class UnthrottledTextureUploader : public TextureUploader {
-public:
- static PassOwnPtr<UnthrottledTextureUploader> create()
- {
- return adoptPtr(new UnthrottledTextureUploader());
- }
- virtual ~UnthrottledTextureUploader() { }
-
- virtual size_t numBlockingUploads() OVERRIDE;
- virtual void markPendingUploadsAsNonBlocking() OVERRIDE;
- virtual double estimatedTexturesPerSecond() OVERRIDE;
- virtual void uploadTexture(CCResourceProvider* resourceProvider, Parameters upload) OVERRIDE;
-
-protected:
- UnthrottledTextureUploader() { }
-
-private:
- DISALLOW_COPY_AND_ASSIGN(UnthrottledTextureUploader);
-};
-
-}
-
-#endif
+// Temporary forwarding header
+#include "cc/unthrottled_texture_uploader.h"
diff --git a/cc/VideoLayerChromium.h b/cc/VideoLayerChromium.h
index 92b5e13..2d2179e 100644
--- a/cc/VideoLayerChromium.h
+++ b/cc/VideoLayerChromium.h
@@ -1,39 +1,6 @@
-// Copyright 2010 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-
-#ifndef VideoLayerChromium_h
-#define VideoLayerChromium_h
-
-#if USE(ACCELERATED_COMPOSITING)
-
-#include "LayerChromium.h"
-
-namespace WebKit {
-class WebVideoFrameProvider;
-}
-
-namespace cc {
-
-class CCVideoLayerImpl;
-
-// A Layer that contains a Video element.
-class VideoLayerChromium : public LayerChromium {
-public:
- static scoped_refptr<VideoLayerChromium> create(WebKit::WebVideoFrameProvider*);
-
- virtual scoped_ptr<CCLayerImpl> createCCLayerImpl() OVERRIDE;
-
-private:
- explicit VideoLayerChromium(WebKit::WebVideoFrameProvider*);
- virtual ~VideoLayerChromium();
-
- // This pointer is only for passing to CCVideoLayerImpl's constructor. It should never be dereferenced by this class.
- WebKit::WebVideoFrameProvider* m_provider;
-};
-
-}
-#endif // USE(ACCELERATED_COMPOSITING)
-
-#endif
+// Temporary forwarding header
+#include "cc/video_layer.h"
diff --git a/cc/CCActiveAnimation.cpp b/cc/active_animation.cc
index b1817d1..b1817d1 100644
--- a/cc/CCActiveAnimation.cpp
+++ b/cc/active_animation.cc
diff --git a/cc/active_animation.h b/cc/active_animation.h
index 638cbb2..b8d3607 100644
--- a/cc/active_animation.h
+++ b/cc/active_animation.h
@@ -1,3 +1,161 @@
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCActiveAnimation_h
+#define CCActiveAnimation_h
+
+#include "base/basictypes.h"
+#include "base/memory/scoped_ptr.h"
+
+namespace cc {
+
+class CCAnimationCurve;
+
+// A CCActiveAnimation, contains all the state required to play a CCAnimationCurve.
+// Specifically, the affected property, the run state (paused, finished, etc.),
+// loop count, last pause time, and the total time spent paused.
+class CCActiveAnimation {
+public:
+ // Animations begin in one of the 'waiting' states. Animations waiting for the next tick
+ // will start the next time the controller animates. Animations waiting for target
+ // availibility will run as soon as their target property is free (and all the animations
+ // animating with it are also able to run). Animations waiting for their start time to
+ // come have be scheduled to run at a particular point in time. When this time arrives,
+ // the controller will move the animations into the Running state. Running animations
+ // may toggle between Running and Paused, and may be stopped by moving into either the
+ // Aborted or Finished states. A Finished animation was allowed to run to completion, but
+ // an Aborted animation was not.
+ enum RunState {
+ WaitingForNextTick = 0,
+ WaitingForTargetAvailability,
+ WaitingForStartTime,
+ WaitingForDeletion,
+ Running,
+ Paused,
+ Finished,
+ Aborted,
+ // This sentinel must be last.
+ RunStateEnumSize
+ };
+
+ enum TargetProperty {
+ Transform = 0,
+ Opacity,
+ // This sentinel must be last.
+ TargetPropertyEnumSize
+ };
+
+ static scoped_ptr<CCActiveAnimation> create(scoped_ptr<CCAnimationCurve>, int animationId, int groupId, TargetProperty);
+
+ virtual ~CCActiveAnimation();
+
+ int id() const { return m_id; }
+ int group() const { return m_group; }
+ TargetProperty targetProperty() const { return m_targetProperty; }
+
+ RunState runState() const { return m_runState; }
+ void setRunState(RunState, double monotonicTime);
+
+ // This is the number of times that the animation will play. If this
+ // value is zero the animation will not play. If it is negative, then
+ // the animation will loop indefinitely.
+ int iterations() const { return m_iterations; }
+ void setIterations(int n) { m_iterations = n; }
+
+ double startTime() const { return m_startTime; }
+ void setStartTime(double monotonicTime) { m_startTime = monotonicTime; }
+ bool hasSetStartTime() const { return m_startTime; }
+
+ double timeOffset() const { return m_timeOffset; }
+ void setTimeOffset(double monotonicTime) { m_timeOffset = monotonicTime; }
+
+ void suspend(double monotonicTime);
+ void resume(double monotonicTime);
+
+ // If alternatesDirection is true, on odd numbered iterations we reverse the curve.
+ bool alternatesDirection() const { return m_alternatesDirection; }
+ void setAlternatesDirection(bool alternates) { m_alternatesDirection = alternates; }
+
+ bool isFinishedAt(double monotonicTime) const;
+ bool isFinished() const { return m_runState == Finished
+ || m_runState == Aborted
+ || m_runState == WaitingForDeletion; }
+
+ CCAnimationCurve* curve() { return m_curve.get(); }
+ const CCAnimationCurve* curve() const { return m_curve.get(); }
+
+ // If this is true, even if the animation is running, it will not be tickable until
+ // it is given a start time. This is true for animations running on the main thread.
+ bool needsSynchronizedStartTime() const { return m_needsSynchronizedStartTime; }
+ void setNeedsSynchronizedStartTime(bool needsSynchronizedStartTime) { m_needsSynchronizedStartTime = needsSynchronizedStartTime; }
+
+ // Takes the given absolute time, and using the start time and the number
+ // of iterations, returns the relative time in the current iteration.
+ double trimTimeToCurrentIteration(double monotonicTime) const;
+
+ enum InstanceType {
+ ControllingInstance = 0,
+ NonControllingInstance
+ };
+
+ scoped_ptr<CCActiveAnimation> clone(InstanceType) const;
+ scoped_ptr<CCActiveAnimation> cloneAndInitialize(InstanceType, RunState initialRunState, double startTime) const;
+ bool isControllingInstance() const { return m_isControllingInstance; }
+
+ void pushPropertiesTo(CCActiveAnimation*) const;
+
+private:
+ CCActiveAnimation(scoped_ptr<CCAnimationCurve>, int animationId, int groupId, TargetProperty);
+
+ scoped_ptr<CCAnimationCurve> m_curve;
+
+ // IDs are not necessarily unique.
+ int m_id;
+
+ // Animations that must be run together are called 'grouped' and have the same group id
+ // Grouped animations are guaranteed to start at the same time and no other animations
+ // may animate any of the group's target properties until all animations in the
+ // group have finished animating. Note: an active animation's group id and target
+ // property uniquely identify that animation.
+ int m_group;
+
+ TargetProperty m_targetProperty;
+ RunState m_runState;
+ int m_iterations;
+ double m_startTime;
+ bool m_alternatesDirection;
+
+ // The time offset effectively pushes the start of the animation back in time. This is
+ // used for resuming paused animations -- an animation is added with a non-zero time
+ // offset, causing the animation to skip ahead to the desired point in time.
+ double m_timeOffset;
+
+ bool m_needsSynchronizedStartTime;
+
+ // When an animation is suspended, it behaves as if it is paused and it also ignores
+ // all run state changes until it is resumed. This is used for testing purposes.
+ bool m_suspended;
+
+ // These are used in trimTimeToCurrentIteration to account for time
+ // spent while paused. This is not included in AnimationState since it
+ // there is absolutely no need for clients of this controller to know
+ // about these values.
+ double m_pauseTime;
+ double m_totalPausedTime;
+
+ // Animations lead dual lives. An active animation will be conceptually owned by
+ // two controllers, one on the impl thread and one on the main. In reality, there
+ // will be two separate CCActiveAnimation instances for the same animation. They
+ // will have the same group id and the same target property (these two values
+ // uniquely identify an animation). The instance on the impl thread is the instance
+ // that ultimately controls the values of the animating layer and so we will refer
+ // to it as the 'controlling instance'.
+ bool m_isControllingInstance;
+
+ DISALLOW_COPY_AND_ASSIGN(CCActiveAnimation);
+};
+
+} // namespace cc
+
+#endif // CCActiveAnimation_h
diff --git a/cc/CCAnimationCurve.cpp b/cc/animation_curve.cc
index 7cd0158..7cd0158 100644
--- a/cc/CCAnimationCurve.cpp
+++ b/cc/animation_curve.cc
diff --git a/cc/animation_curve.h b/cc/animation_curve.h
index 638cbb2..7ed6e7a 100644
--- a/cc/animation_curve.h
+++ b/cc/animation_curve.h
@@ -1,3 +1,56 @@
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCAnimationCurve_h
+#define CCAnimationCurve_h
+
+#include "base/memory/scoped_ptr.h"
+#include <public/WebTransformationMatrix.h>
+
+namespace cc {
+
+class CCFloatAnimationCurve;
+class CCTransformAnimationCurve;
+class IntSize;
+class TransformOperations;
+
+// An animation curve is a function that returns a value given a time.
+// There are currently only two types of curve, float and transform.
+class CCAnimationCurve {
+public:
+ enum Type { Float, Transform };
+
+ virtual ~CCAnimationCurve() { }
+
+ virtual double duration() const = 0;
+ virtual Type type() const = 0;
+ virtual scoped_ptr<CCAnimationCurve> clone() const = 0;
+
+ const CCFloatAnimationCurve* toFloatAnimationCurve() const;
+ const CCTransformAnimationCurve* toTransformAnimationCurve() const;
+};
+
+class CCFloatAnimationCurve : public CCAnimationCurve {
+public:
+ virtual ~CCFloatAnimationCurve() { }
+
+ virtual float getValue(double t) const = 0;
+
+ // Partial CCAnimation implementation.
+ virtual Type type() const OVERRIDE;
+};
+
+class CCTransformAnimationCurve : public CCAnimationCurve {
+public:
+ virtual ~CCTransformAnimationCurve() { }
+
+ virtual WebKit::WebTransformationMatrix getValue(double t) const = 0;
+
+ // Partial CCAnimation implementation.
+ virtual Type type() const OVERRIDE;
+};
+
+} // namespace cc
+
+#endif // CCAnimation_h
diff --git a/cc/animation_events.h b/cc/animation_events.h
index 638cbb2..5e86ef7 100644
--- a/cc/animation_events.h
+++ b/cc/animation_events.h
@@ -1,3 +1,37 @@
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCAnimationEvents_h
+#define CCAnimationEvents_h
+
+#include <vector>
+
+#include "CCActiveAnimation.h"
+
+namespace cc {
+
+struct CCAnimationEvent {
+ enum Type { Started, Finished };
+
+ CCAnimationEvent(Type type, int layerId, int groupId, CCActiveAnimation::TargetProperty targetProperty, double monotonicTime)
+ : type(type)
+ , layerId(layerId)
+ , groupId(groupId)
+ , targetProperty(targetProperty)
+ , monotonicTime(monotonicTime)
+ {
+ }
+
+ Type type;
+ int layerId;
+ int groupId;
+ CCActiveAnimation::TargetProperty targetProperty;
+ double monotonicTime;
+};
+
+typedef std::vector<CCAnimationEvent> CCAnimationEventsVector;
+
+} // namespace cc
+
+#endif // CCAnimationEvents_h
diff --git a/cc/append_quads_data.h b/cc/append_quads_data.h
index 638cbb2..b086de0 100644
--- a/cc/append_quads_data.h
+++ b/cc/append_quads_data.h
@@ -1,3 +1,36 @@
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCAppendQuadsData_h
+#define CCAppendQuadsData_h
+
+#include "CCRenderPass.h"
+
+namespace cc {
+
+struct CCAppendQuadsData {
+ CCAppendQuadsData()
+ : hadOcclusionFromOutsideTargetSurface(false)
+ , hadMissingTiles(false)
+ , renderPassId(0, 0)
+ {
+ }
+
+ explicit CCAppendQuadsData(CCRenderPass::Id renderPassId)
+ : hadOcclusionFromOutsideTargetSurface(false)
+ , hadMissingTiles(false)
+ , renderPassId(renderPassId)
+ {
+ }
+
+ // Set by the QuadCuller.
+ bool hadOcclusionFromOutsideTargetSurface;
+ // Set by the layer appending quads.
+ bool hadMissingTiles;
+ // Given to the layer appending quads.
+ const CCRenderPass::Id renderPassId;
+};
+
+}
+#endif // CCCCAppendQuadsData_h
diff --git a/cc/BitmapCanvasLayerTextureUpdater.cpp b/cc/bitmap_canvas_layer_texture_updater.cc
index 3231b7d..3231b7d 100644
--- a/cc/BitmapCanvasLayerTextureUpdater.cpp
+++ b/cc/bitmap_canvas_layer_texture_updater.cc
diff --git a/cc/bitmap_canvas_layer_texture_updater.h b/cc/bitmap_canvas_layer_texture_updater.h
index 638cbb2..8cf4e25 100644
--- a/cc/bitmap_canvas_layer_texture_updater.h
+++ b/cc/bitmap_canvas_layer_texture_updater.h
@@ -1,3 +1,57 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+
+#ifndef BitmapCanvasLayerTextureUpdater_h
+#define BitmapCanvasLayerTextureUpdater_h
+
+#if USE(ACCELERATED_COMPOSITING)
+
+#include "CanvasLayerTextureUpdater.h"
+
+class SkCanvas;
+
+namespace cc {
+
+class LayerPainterChromium;
+
+// This class rasterizes the contentRect into a skia bitmap canvas. It then updates
+// textures by copying from the canvas into the texture, using MapSubImage if
+// possible.
+class BitmapCanvasLayerTextureUpdater : public CanvasLayerTextureUpdater {
+public:
+ class Texture : public LayerTextureUpdater::Texture {
+ public:
+ Texture(BitmapCanvasLayerTextureUpdater*, scoped_ptr<CCPrioritizedTexture>);
+ virtual ~Texture();
+
+ virtual void updateRect(CCResourceProvider*, const IntRect& sourceRect, const IntSize& destOffset) OVERRIDE;
+
+ private:
+ BitmapCanvasLayerTextureUpdater* textureUpdater() { return m_textureUpdater; }
+
+ BitmapCanvasLayerTextureUpdater* m_textureUpdater;
+ };
+
+ static PassRefPtr<BitmapCanvasLayerTextureUpdater> create(PassOwnPtr<LayerPainterChromium>);
+ virtual ~BitmapCanvasLayerTextureUpdater();
+
+ virtual PassOwnPtr<LayerTextureUpdater::Texture> createTexture(CCPrioritizedTextureManager*) OVERRIDE;
+ virtual SampledTexelFormat sampledTexelFormat(GC3Denum textureFormat) OVERRIDE;
+ virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpaqueRect, CCRenderingStats&) OVERRIDE;
+ void updateTextureRect(CCResourceProvider*, CCPrioritizedTexture*, const IntRect& sourceRect, const IntSize& destOffset);
+
+ virtual void setOpaque(bool) OVERRIDE;
+
+protected:
+ explicit BitmapCanvasLayerTextureUpdater(PassOwnPtr<LayerPainterChromium>);
+
+ OwnPtr<SkCanvas> m_canvas;
+ IntSize m_canvasSize;
+ bool m_opaque;
+};
+
+} // namespace cc
+#endif // USE(ACCELERATED_COMPOSITING)
+#endif // BitmapCanvasLayerTextureUpdater_h
diff --git a/cc/BitmapSkPictureCanvasLayerTextureUpdater.cpp b/cc/bitmap_skpicture_canvas_layer_texture_updater.cc
index 93c8483..93c8483 100644
--- a/cc/BitmapSkPictureCanvasLayerTextureUpdater.cpp
+++ b/cc/bitmap_skpicture_canvas_layer_texture_updater.cc
diff --git a/cc/bitmap_skpicture_canvas_layer_texture_updater.h b/cc/bitmap_skpicture_canvas_layer_texture_updater.h
index 638cbb2..140f9be 100644
--- a/cc/bitmap_skpicture_canvas_layer_texture_updater.h
+++ b/cc/bitmap_skpicture_canvas_layer_texture_updater.h
@@ -1,3 +1,45 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+
+#ifndef BitmapSkPictureCanvasLayerTextureUpdater_h
+#define BitmapSkPictureCanvasLayerTextureUpdater_h
+
+#if USE(ACCELERATED_COMPOSITING)
+#include "SkBitmap.h"
+#include "SkPictureCanvasLayerTextureUpdater.h"
+
+namespace cc {
+
+// This class records the contentRect into an SkPicture, then software rasterizes
+// the SkPicture into bitmaps for each tile. This implements CCSettings::perTilePainting.
+class BitmapSkPictureCanvasLayerTextureUpdater : public SkPictureCanvasLayerTextureUpdater {
+public:
+ class Texture : public CanvasLayerTextureUpdater::Texture {
+ public:
+ Texture(BitmapSkPictureCanvasLayerTextureUpdater*, scoped_ptr<CCPrioritizedTexture>);
+
+ virtual void prepareRect(const IntRect& sourceRect, CCRenderingStats&) OVERRIDE;
+ virtual void updateRect(CCResourceProvider*, const IntRect& sourceRect, const IntSize& destOffset) OVERRIDE;
+
+ private:
+ BitmapSkPictureCanvasLayerTextureUpdater* textureUpdater() { return m_textureUpdater; }
+
+ SkBitmap m_bitmap;
+ BitmapSkPictureCanvasLayerTextureUpdater* m_textureUpdater;
+ };
+
+ static PassRefPtr<BitmapSkPictureCanvasLayerTextureUpdater> create(PassOwnPtr<LayerPainterChromium>);
+ virtual ~BitmapSkPictureCanvasLayerTextureUpdater();
+
+ virtual PassOwnPtr<LayerTextureUpdater::Texture> createTexture(CCPrioritizedTextureManager*) OVERRIDE;
+ virtual SampledTexelFormat sampledTexelFormat(GC3Denum textureFormat) OVERRIDE;
+ void paintContentsRect(SkCanvas*, const IntRect& sourceRect, CCRenderingStats&);
+
+private:
+ explicit BitmapSkPictureCanvasLayerTextureUpdater(PassOwnPtr<LayerPainterChromium>);
+};
+} // namespace cc
+#endif // USE(ACCELERATED_COMPOSITING)
+#endif // BitmapSkPictureCanvasLayerTextureUpdater_h
diff --git a/cc/CanvasLayerTextureUpdater.cpp b/cc/canvas_layer_texture_updater.cc
index eae5d16a..eae5d16a 100644
--- a/cc/CanvasLayerTextureUpdater.cpp
+++ b/cc/canvas_layer_texture_updater.cc
diff --git a/cc/canvas_layer_texture_updater.h b/cc/canvas_layer_texture_updater.h
index 638cbb2..c8bb9b0 100644
--- a/cc/canvas_layer_texture_updater.h
+++ b/cc/canvas_layer_texture_updater.h
@@ -1,3 +1,39 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+
+#ifndef CanvasLayerTextureUpdater_h
+#define CanvasLayerTextureUpdater_h
+
+#if USE(ACCELERATED_COMPOSITING)
+
+#include "LayerTextureUpdater.h"
+
+class SkCanvas;
+
+namespace cc {
+
+class LayerPainterChromium;
+
+// Base class for BitmapCanvasLayerTextureUpdater and
+// SkPictureCanvasLayerTextureUpdater that reduces code duplication between
+// their respective paintContents implementations.
+class CanvasLayerTextureUpdater : public LayerTextureUpdater {
+public:
+ virtual ~CanvasLayerTextureUpdater();
+
+protected:
+ explicit CanvasLayerTextureUpdater(PassOwnPtr<LayerPainterChromium>);
+
+ void paintContents(SkCanvas*, const IntRect& contentRect, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpaqueRect, CCRenderingStats&);
+ const IntRect& contentRect() const { return m_contentRect; }
+
+private:
+ IntRect m_contentRect;
+ OwnPtr<LayerPainterChromium> m_painter;
+};
+
+} // namespace cc
+#endif // USE(ACCELERATED_COMPOSITING)
+#endif // CanvasLayerTextureUpdater_h
diff --git a/cc/cc.gyp b/cc/cc.gyp
index 264021e..be5b960 100644
--- a/cc/cc.gyp
+++ b/cc/cc.gyp
@@ -11,220 +11,220 @@
'own_ptr_vector.h',
'scoped_ptr_hash_map.h',
'scoped_ptr_vector.h',
- 'BitmapCanvasLayerTextureUpdater.cpp',
+ 'bitmap_canvas_layer_texture_updater.cc',
'BitmapCanvasLayerTextureUpdater.h',
- 'BitmapSkPictureCanvasLayerTextureUpdater.cpp',
+ 'bitmap_skpicture_canvas_layer_texture_updater.cc',
'BitmapSkPictureCanvasLayerTextureUpdater.h',
'caching_bitmap_canvas_layer_texture_updater.cc',
'caching_bitmap_canvas_layer_texture_updater.h',
- 'CCActiveAnimation.cpp',
+ 'active_animation.cc',
'CCActiveAnimation.h',
'CCAppendQuadsData.h',
- 'CCAnimationCurve.cpp',
+ 'animation_curve.cc',
'CCAnimationCurve.h',
'CCAnimationEvents.h',
- 'CCCheckerboardDrawQuad.cpp',
+ 'checkerboard_draw_quad.cc',
'CCCheckerboardDrawQuad.h',
'CCCompletionEvent.h',
- 'CCDamageTracker.cpp',
+ 'damage_tracker.cc',
'CCDamageTracker.h',
- 'CCDebugBorderDrawQuad.cpp',
+ 'debug_border_draw_quad.cc',
'CCDebugBorderDrawQuad.h',
- 'CCDebugRectHistory.cpp',
+ 'debug_rect_history.cc',
'CCDebugRectHistory.h',
- 'CCDelayBasedTimeSource.cpp',
+ 'delay_based_time_source.cc',
'CCDelayBasedTimeSource.h',
- 'CCDelegatedRendererLayerImpl.cpp',
+ 'delegated_renderer_layer_impl.cc',
'CCDelegatedRendererLayerImpl.h',
- 'CCDirectRenderer.cpp',
+ 'direct_renderer.cc',
'CCDirectRenderer.h',
- 'CCDrawQuad.cpp',
+ 'draw_quad.cc',
'CCDrawQuad.h',
- 'CCFontAtlas.cpp',
+ 'font_atlas.cc',
'CCFontAtlas.h',
- 'CCFrameRateController.cpp',
+ 'frame_rate_controller.cc',
'CCFrameRateController.h',
- 'CCFrameRateCounter.cpp',
+ 'frame_rate_counter.cc',
'CCFrameRateCounter.h',
'CCGraphicsContext.h',
- 'CCHeadsUpDisplayLayerImpl.cpp',
+ 'heads_up_display_layer_impl.cc',
'CCHeadsUpDisplayLayerImpl.h',
- 'CCIOSurfaceDrawQuad.cpp',
+ 'io_surface_draw_quad.cc',
'CCIOSurfaceDrawQuad.h',
- 'CCIOSurfaceLayerImpl.cpp',
+ 'io_surface_layer_impl.cc',
'CCIOSurfaceLayerImpl.h',
'CCInputHandler.h',
- 'CCKeyframedAnimationCurve.cpp',
+ 'keyframed_animation_curve.cc',
'CCKeyframedAnimationCurve.h',
- 'CCLayerAnimationController.cpp',
+ 'layer_animation_controller.cc',
'CCLayerAnimationController.h',
- 'CCLayerImpl.cpp',
+ 'layer_impl.cc',
'CCLayerImpl.h',
- 'CCLayerIterator.cpp',
+ 'layer_iterator.cc',
'CCLayerIterator.h',
- 'CCLayerQuad.cpp',
+ 'layer_quad.cc',
'CCLayerQuad.h',
- 'CCLayerSorter.cpp',
+ 'layer_sorter.cc',
'CCLayerSorter.h',
- 'CCLayerTilingData.cpp',
+ 'layer_tiling_data.cc',
'CCLayerTilingData.h',
- 'CCLayerTreeHost.cpp',
+ 'layer_tree_host.cc',
'CCLayerTreeHost.h',
'CCLayerTreeHostClient.h',
- 'CCLayerTreeHostCommon.cpp',
+ 'layer_tree_host_common.cc',
'CCLayerTreeHostCommon.h',
- 'CCLayerTreeHostImpl.cpp',
+ 'layer_tree_host_impl.cc',
'CCLayerTreeHostImpl.h',
- 'CCMathUtil.cpp',
+ 'math_util.cc',
'CCMathUtil.h',
- 'CCOcclusionTracker.cpp',
+ 'occlusion_tracker.cc',
'CCOcclusionTracker.h',
- 'CCOverdrawMetrics.cpp',
+ 'overdraw_metrics.cc',
'CCOverdrawMetrics.h',
- 'CCPageScaleAnimation.cpp',
+ 'page_scale_animation.cc',
'CCPageScaleAnimation.h',
- 'CCPrioritizedTexture.cpp',
+ 'prioritized_texture.cc',
'CCPrioritizedTexture.h',
- 'CCPrioritizedTextureManager.cpp',
+ 'prioritized_texture_manager.cc',
'CCPrioritizedTextureManager.h',
- 'CCPriorityCalculator.cpp',
+ 'priority_calculator.cc',
'CCPriorityCalculator.h',
- 'CCProxy.cpp',
+ 'proxy.cc',
'CCProxy.h',
- 'CCQuadCuller.cpp',
+ 'quad_culler.cc',
'CCQuadCuller.h',
'CCQuadSink.h',
- 'CCRenderPass.cpp',
+ 'render_pass.cc',
'CCRenderPass.h',
- 'CCRenderPassDrawQuad.cpp',
+ 'render_pass_draw_quad.cc',
'CCRenderPassDrawQuad.h',
'CCRenderPassSink.h',
- 'CCRenderSurface.cpp',
+ 'render_surface_impl.cc',
'CCRenderSurface.h',
- 'CCRenderSurfaceFilters.cpp',
+ 'render_surface_filters.cc',
'CCRenderSurfaceFilters.h',
- 'CCRenderer.cpp',
+ 'renderer.cc',
'CCRenderer.h',
- 'CCRendererGL.cpp',
+ 'gl_renderer.cc',
'CCRendererGL.h',
- 'CCRendererSoftware.cpp',
+ 'software_renderer.cc',
'CCRendererSoftware.h',
'CCRenderingStats.h',
- 'CCResourceProvider.cpp',
+ 'resource_provider.cc',
'CCResourceProvider.h',
- 'CCScheduler.cpp',
+ 'scheduler.cc',
'CCScheduler.h',
- 'CCSchedulerStateMachine.cpp',
+ 'scheduler_state_machine.cc',
'CCSchedulerStateMachine.h',
- 'CCScopedTexture.cpp',
+ 'scoped_texture.cc',
'CCScopedTexture.h',
- 'CCScopedThreadProxy.cpp',
+ 'scoped_thread_proxy.cc',
'CCScopedThreadProxy.h',
- 'CCScrollbarAnimationController.cpp',
+ 'scrollbar_animation_controller.cc',
'CCScrollbarAnimationController.h',
- 'CCScrollbarAnimationControllerLinearFade.cpp',
+ 'scrollbar_animation_controller_linear_fade.cc',
'CCScrollbarAnimationControllerLinearFade.h',
- 'CCScrollbarLayerImpl.cpp',
+ 'scrollbar_layer_impl.cc',
'CCScrollbarLayerImpl.h',
- 'CCScrollbarGeometryFixedThumb.cpp',
+ 'scrollbar_geometry_fixed_thumb.cc',
'CCScrollbarGeometryFixedThumb.h',
- 'CCScrollbarGeometryStub.cpp',
+ 'scrollbar_geometry_stub.cc',
'CCScrollbarGeometryStub.h',
- 'CCSettings.cpp',
+ 'settings.cc',
'CCSettings.h',
- 'CCSharedQuadState.cpp',
+ 'shared_quad_state.cc',
'CCSharedQuadState.h',
- 'CCSingleThreadProxy.cpp',
+ 'single_thread_proxy.cc',
'CCSingleThreadProxy.h',
- 'CCSolidColorDrawQuad.cpp',
+ 'solid_color_draw_quad.cc',
'CCSolidColorDrawQuad.h',
- 'CCSolidColorLayerImpl.cpp',
+ 'solid_color_layer_impl.cc',
'CCSolidColorLayerImpl.h',
- 'CCStreamVideoDrawQuad.cpp',
+ 'stream_video_draw_quad.cc',
'CCStreamVideoDrawQuad.h',
- 'CCTexture.cpp',
+ 'texture.cc',
'CCTexture.h',
- 'CCTextureDrawQuad.cpp',
+ 'texture_draw_quad.cc',
'CCTextureDrawQuad.h',
- 'CCTextureLayerImpl.cpp',
+ 'texture_layer_impl.cc',
'CCTextureLayerImpl.h',
- 'CCTextureUpdateController.cpp',
+ 'texture_update_controller.cc',
'CCTextureUpdateController.h',
- 'CCTextureUpdateQueue.cpp',
+ 'texture_update_queue.cc',
'CCTextureUpdateQueue.h',
'CCThread.h',
- 'CCThreadProxy.cpp',
+ 'thread_proxy.cc',
'CCThreadProxy.h',
'CCThreadTask.h',
- 'CCTileDrawQuad.cpp',
+ 'tile_draw_quad.cc',
'CCTileDrawQuad.h',
- 'CCTiledLayerImpl.cpp',
+ 'tiled_layer_impl.cc',
'CCTiledLayerImpl.h',
'CCTimeSource.h',
- 'CCTimer.cpp',
+ 'timer.cc',
'CCTimer.h',
- 'CCTimingFunction.cpp',
+ 'timing_function.cc',
'CCTimingFunction.h',
- 'CCVideoLayerImpl.cpp',
+ 'video_layer_impl.cc',
'CCVideoLayerImpl.h',
- 'CCYUVVideoDrawQuad.cpp',
+ 'yuv_video_draw_quad.cc',
'CCYUVVideoDrawQuad.h',
- 'CanvasLayerTextureUpdater.cpp',
+ 'canvas_layer_texture_updater.cc',
'CanvasLayerTextureUpdater.h',
- 'ContentLayerChromium.cpp',
+ 'content_layer.cc',
'ContentLayerChromium.h',
'ContentLayerChromiumClient.h',
- 'DelegatedRendererLayerChromium.cpp',
+ 'delegated_renderer_layer.cc',
'DelegatedRendererLayerChromium.h',
- 'FrameBufferSkPictureCanvasLayerTextureUpdater.cpp',
+ 'frame_buffer_skpicture_canvas_layer_texture_updater.cc',
'FrameBufferSkPictureCanvasLayerTextureUpdater.h',
- 'GeometryBinding.cpp',
+ 'geometry_binding.cc',
'GeometryBinding.h',
- 'HeadsUpDisplayLayerChromium.cpp',
+ 'heads_up_display_layer.cc',
'HeadsUpDisplayLayerChromium.h',
- 'IOSurfaceLayerChromium.cpp',
+ 'io_surface_layer.cc',
'IOSurfaceLayerChromium.h',
- 'ImageLayerChromium.cpp',
+ 'image_layer.cc',
'ImageLayerChromium.h',
- 'LayerChromium.cpp',
+ 'layer.cc',
'LayerChromium.h',
'LayerPainterChromium.h',
- 'LayerTextureSubImage.cpp',
+ 'layer_texture_sub_image.cc',
'LayerTextureSubImage.h',
- 'LayerTextureUpdater.cpp',
+ 'layer_texture_updater.cc',
'LayerTextureUpdater.h',
'PlatformColor.h',
- 'ProgramBinding.cpp',
+ 'program_binding.cc',
'ProgramBinding.h',
- 'RateLimiter.cpp',
+ 'rate_limiter.cc',
'RateLimiter.h',
- 'RenderSurfaceChromium.cpp',
+ 'render_surface.cc',
'RenderSurfaceChromium.h',
- 'ScrollbarLayerChromium.cpp',
+ 'scrollbar_layer.cc',
'ScrollbarLayerChromium.h',
- 'ShaderChromium.cpp',
+ 'shader.cc',
'ShaderChromium.h',
- 'SkPictureCanvasLayerTextureUpdater.cpp',
+ 'skpicture_canvas_layer_texture_updater.cc',
'SkPictureCanvasLayerTextureUpdater.h',
- 'SolidColorLayerChromium.cpp',
+ 'solid_color_layer.cc',
'SolidColorLayerChromium.h',
'switches.cc',
'switches.h',
- 'TextureCopier.cpp',
+ 'texture_copier.cc',
'TextureCopier.h',
- 'TextureLayerChromium.cpp',
+ 'texture_layer.cc',
'TextureLayerChromium.h',
'TextureLayerChromiumClient.h',
'TextureUploader.h',
- 'ThrottledTextureUploader.cpp',
+ 'throttled_texture_uploader.cc',
'ThrottledTextureUploader.h',
- 'UnthrottledTextureUploader.cpp',
+ 'unthrottled_texture_uploader.cc',
'UnthrottledTextureUploader.h',
- 'TiledLayerChromium.cpp',
+ 'tiled_layer.cc',
'TiledLayerChromium.h',
- 'TreeSynchronizer.cpp',
+ 'tree_synchronizer.cc',
'TreeSynchronizer.h',
- 'VideoLayerChromium.cpp',
+ 'video_layer.cc',
'VideoLayerChromium.h',
'bitmap_canvas_layer_texture_updater.h',
diff --git a/cc/CCCheckerboardDrawQuad.cpp b/cc/checkerboard_draw_quad.cc
index f1b34a3..f1b34a3 100644
--- a/cc/CCCheckerboardDrawQuad.cpp
+++ b/cc/checkerboard_draw_quad.cc
diff --git a/cc/checkerboard_draw_quad.h b/cc/checkerboard_draw_quad.h
index 638cbb2..1ef147f 100644
--- a/cc/checkerboard_draw_quad.h
+++ b/cc/checkerboard_draw_quad.h
@@ -1,3 +1,33 @@
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCCheckerboardDrawQuad_h
+#define CCCheckerboardDrawQuad_h
+
+#include "CCDrawQuad.h"
+#include "base/memory/scoped_ptr.h"
+#include "SkColor.h"
+
+namespace cc {
+
+#pragma pack(push, 4)
+
+class CCCheckerboardDrawQuad : public CCDrawQuad {
+public:
+ static scoped_ptr<CCCheckerboardDrawQuad> create(const CCSharedQuadState*, const IntRect&, SkColor);
+
+ SkColor color() const { return m_color; };
+
+ static const CCCheckerboardDrawQuad* materialCast(const CCDrawQuad*);
+private:
+ CCCheckerboardDrawQuad(const CCSharedQuadState*, const IntRect&, SkColor);
+
+ SkColor m_color;
+};
+
+#pragma pack(pop)
+
+}
+
+#endif
diff --git a/cc/completion_event.h b/cc/completion_event.h
index 638cbb2..462e4ba 100644
--- a/cc/completion_event.h
+++ b/cc/completion_event.h
@@ -1,3 +1,62 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCCompletionEvent_h
+#define CCCompletionEvent_h
+
+#include "base/synchronization/waitable_event.h"
+
+namespace cc {
+
+// Used for making blocking calls from one thread to another. Use only when
+// absolutely certain that doing-so will not lead to a deadlock.
+//
+// It is safe to destroy this object as soon as wait() returns.
+class CCCompletionEvent {
+public:
+ CCCompletionEvent()
+ : m_event(false /* manual_reset */, false /* initially_signaled */)
+ {
+#ifndef NDEBUG
+ m_waited = false;
+ m_signaled = false;
+#endif
+ }
+
+ ~CCCompletionEvent()
+ {
+ ASSERT(m_waited);
+ ASSERT(m_signaled);
+ }
+
+ void wait()
+ {
+ ASSERT(!m_waited);
+#ifndef NDEBUG
+ m_waited = true;
+#endif
+ m_event.Wait();
+ }
+
+ void signal()
+ {
+ ASSERT(!m_signaled);
+#ifndef NDEBUG
+ m_signaled = true;
+#endif
+ m_event.Signal();
+ }
+
+private:
+ base::WaitableEvent m_event;
+#ifndef NDEBUG
+ // Used to assert that wait() and signal() are each called exactly once.
+ bool m_waited;
+ bool m_signaled;
+#endif
+};
+
+}
+
+#endif
diff --git a/cc/ContentLayerChromium.cpp b/cc/content_layer.cc
index ee8277b..ee8277b 100644
--- a/cc/ContentLayerChromium.cpp
+++ b/cc/content_layer.cc
diff --git a/cc/content_layer.h b/cc/content_layer.h
index 638cbb2..b8ac462 100644
--- a/cc/content_layer.h
+++ b/cc/content_layer.h
@@ -1,3 +1,67 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+
+#ifndef ContentLayerChromium_h
+#define ContentLayerChromium_h
+
+#if USE(ACCELERATED_COMPOSITING)
+
+#include "base/basictypes.h"
+#include "LayerPainterChromium.h"
+#include "TiledLayerChromium.h"
+
+class SkCanvas;
+
+namespace cc {
+
+class ContentLayerChromiumClient;
+class FloatRect;
+class IntRect;
+class LayerTextureUpdater;
+
+class ContentLayerPainter : public LayerPainterChromium {
+public:
+ static PassOwnPtr<ContentLayerPainter> create(ContentLayerChromiumClient*);
+
+ virtual void paint(SkCanvas*, const IntRect& contentRect, FloatRect& opaque) OVERRIDE;
+
+private:
+ explicit ContentLayerPainter(ContentLayerChromiumClient*);
+
+ ContentLayerChromiumClient* m_client;
+
+ DISALLOW_COPY_AND_ASSIGN(ContentLayerPainter);
+};
+
+// A layer that renders its contents into an SkCanvas.
+class ContentLayerChromium : public TiledLayerChromium {
+public:
+ static scoped_refptr<ContentLayerChromium> create(ContentLayerChromiumClient*);
+
+ void clearClient() { m_client = 0; }
+
+ virtual bool drawsContent() const OVERRIDE;
+ virtual void setTexturePriorities(const CCPriorityCalculator&) OVERRIDE;
+ virtual void update(CCTextureUpdateQueue&, const CCOcclusionTracker*, CCRenderingStats&) OVERRIDE;
+ virtual bool needMoreUpdates() OVERRIDE;
+
+ virtual void setContentsOpaque(bool) OVERRIDE;
+
+protected:
+ explicit ContentLayerChromium(ContentLayerChromiumClient*);
+ virtual ~ContentLayerChromium();
+
+private:
+ virtual LayerTextureUpdater* textureUpdater() const OVERRIDE;
+ virtual void createTextureUpdaterIfNeeded() OVERRIDE;
+
+ ContentLayerChromiumClient* m_client;
+ RefPtr<LayerTextureUpdater> m_textureUpdater;
+};
+
+}
+#endif // USE(ACCELERATED_COMPOSITING)
+
+#endif
diff --git a/cc/content_layer_client.h b/cc/content_layer_client.h
index 638cbb2..54a9267 100644
--- a/cc/content_layer_client.h
+++ b/cc/content_layer_client.h
@@ -1,3 +1,24 @@
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef ContentLayerChromiumClient_h
+#define ContentLayerChromiumClient_h
+
+class SkCanvas;
+
+namespace cc {
+class FloatRect;
+class IntRect;
+
+class ContentLayerChromiumClient {
+public:
+ virtual void paintContents(SkCanvas*, const IntRect& clip, FloatRect& opaque) = 0;
+
+protected:
+ virtual ~ContentLayerChromiumClient() { }
+};
+
+}
+
+#endif // ContentLayerChromiumClient_h
diff --git a/cc/CCDamageTracker.cpp b/cc/damage_tracker.cc
index bd1c31f..bd1c31f 100644
--- a/cc/CCDamageTracker.cpp
+++ b/cc/damage_tracker.cc
diff --git a/cc/damage_tracker.h b/cc/damage_tracker.h
index 638cbb2..c7550a2 100644
--- a/cc/damage_tracker.h
+++ b/cc/damage_tracker.h
@@ -1,3 +1,63 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCDamageTracker_h
+#define CCDamageTracker_h
+
+#include "base/memory/scoped_ptr.h"
+#include "FloatRect.h"
+#include <vector>
+#include <wtf/HashMap.h>
+#include <wtf/Vector.h>
+
+namespace WebKit {
+class WebFilterOperations;
+}
+
+namespace cc {
+
+class CCLayerImpl;
+class CCRenderSurface;
+
+// Computes the region where pixels have actually changed on a RenderSurface. This region is used
+// to scissor what is actually drawn to the screen to save GPU computation and bandwidth.
+class CCDamageTracker {
+public:
+ static scoped_ptr<CCDamageTracker> create();
+ ~CCDamageTracker();
+
+ void didDrawDamagedArea() { m_currentDamageRect = FloatRect(); }
+ void forceFullDamageNextUpdate() { m_forceFullDamageNextUpdate = true; }
+ void updateDamageTrackingState(const std::vector<CCLayerImpl*>& layerList, int targetSurfaceLayerID, bool targetSurfacePropertyChangedOnlyFromDescendant, const IntRect& targetSurfaceContentRect, CCLayerImpl* targetSurfaceMaskLayer, const WebKit::WebFilterOperations&);
+
+ const FloatRect& currentDamageRect() { return m_currentDamageRect; }
+
+private:
+ CCDamageTracker();
+
+ FloatRect trackDamageFromActiveLayers(const std::vector<CCLayerImpl*>& layerList, int targetSurfaceLayerID);
+ FloatRect trackDamageFromSurfaceMask(CCLayerImpl* targetSurfaceMaskLayer);
+ FloatRect trackDamageFromLeftoverRects();
+
+ FloatRect removeRectFromCurrentFrame(int layerID, bool& layerIsNew);
+ void saveRectForNextFrame(int layerID, const FloatRect& targetSpaceRect);
+
+ // These helper functions are used only in trackDamageFromActiveLayers().
+ void extendDamageForLayer(CCLayerImpl*, FloatRect& targetDamageRect);
+ void extendDamageForRenderSurface(CCLayerImpl*, FloatRect& targetDamageRect);
+
+ // To correctly track exposed regions, two hashtables of rects are maintained.
+ // The "current" map is used to compute exposed regions of the current frame, while
+ // the "next" map is used to collect layer rects that are used in the next frame.
+ typedef HashMap<int, FloatRect> RectMap;
+ scoped_ptr<RectMap> m_currentRectHistory;
+ scoped_ptr<RectMap> m_nextRectHistory;
+
+ FloatRect m_currentDamageRect;
+ bool m_forceFullDamageNextUpdate;
+};
+
+} // namespace cc
+
+#endif // CCDamageTracker_h
diff --git a/cc/CCDebugBorderDrawQuad.cpp b/cc/debug_border_draw_quad.cc
index aabf9e2..aabf9e2 100644
--- a/cc/CCDebugBorderDrawQuad.cpp
+++ b/cc/debug_border_draw_quad.cc
diff --git a/cc/debug_border_draw_quad.h b/cc/debug_border_draw_quad.h
index 638cbb2..fbba1c6 100644
--- a/cc/debug_border_draw_quad.h
+++ b/cc/debug_border_draw_quad.h
@@ -1,3 +1,35 @@
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCDebugBorderDrawQuad_h
+#define CCDebugBorderDrawQuad_h
+
+#include "CCDrawQuad.h"
+#include "SkColor.h"
+#include "base/memory/scoped_ptr.h"
+
+namespace cc {
+
+#pragma pack(push, 4)
+
+class CCDebugBorderDrawQuad : public CCDrawQuad {
+public:
+ static scoped_ptr<CCDebugBorderDrawQuad> create(const CCSharedQuadState*, const IntRect&, SkColor, int width);
+
+ SkColor color() const { return m_color; };
+ int width() const { return m_width; }
+
+ static const CCDebugBorderDrawQuad* materialCast(const CCDrawQuad*);
+private:
+ CCDebugBorderDrawQuad(const CCSharedQuadState*, const IntRect&, SkColor, int width);
+
+ SkColor m_color;
+ int m_width;
+};
+
+#pragma pack(pop)
+
+}
+
+#endif
diff --git a/cc/CCDebugRectHistory.cpp b/cc/debug_rect_history.cc
index 7f3c2ea..7f3c2ea 100644
--- a/cc/CCDebugRectHistory.cpp
+++ b/cc/debug_rect_history.cc
diff --git a/cc/debug_rect_history.h b/cc/debug_rect_history.h
index 638cbb2..1b03f34 100644
--- a/cc/debug_rect_history.h
+++ b/cc/debug_rect_history.h
@@ -1,3 +1,87 @@
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCDebugRectHistory_h
+#define CCDebugRectHistory_h
+
+#if USE(ACCELERATED_COMPOSITING)
+
+#include "base/basictypes.h"
+#include "FloatRect.h"
+#include "IntRect.h"
+#include <wtf/PassOwnPtr.h>
+#include <wtf/Vector.h>
+#include <vector>
+
+namespace cc {
+
+class CCLayerImpl;
+struct CCLayerTreeSettings;
+
+// There are currently six types of debug rects:
+//
+// - Paint rects (update rects): regions of a layer that needed to be re-uploaded to the
+// texture resource; in most cases implying that they had to be repainted, too.
+//
+// - Property-changed rects: enclosing bounds of layers that cause changes to the screen
+// even if the layer did not change internally. (For example, if the layer's opacity or
+// position changes.)
+//
+// - Surface damage rects: the aggregate damage on a target surface that is caused by all
+// layers and surfaces that contribute to it. This includes (1) paint rects, (2) property-
+// changed rects, and (3) newly exposed areas.
+//
+// - Screen space rects: this is the region the contents occupy in screen space.
+//
+// - Replica screen space rects: this is the region the replica's contents occupy in screen space.
+//
+// - Occluding rects: these are the regions that contribute to the occluded region.
+//
+enum DebugRectType { PaintRectType, PropertyChangedRectType, SurfaceDamageRectType, ScreenSpaceRectType, ReplicaScreenSpaceRectType, OccludingRectType };
+
+struct CCDebugRect {
+ CCDebugRect(DebugRectType newType, FloatRect newRect)
+ : type(newType)
+ , rect(newRect) { }
+
+ DebugRectType type;
+ FloatRect rect;
+};
+
+// This class maintains a history of rects of various types that can be used
+// for debugging purposes. The overhead of collecting rects is performed only if
+// the appropriate CCLayerTreeSettings are enabled.
+class CCDebugRectHistory {
+public:
+ static PassOwnPtr<CCDebugRectHistory> create()
+ {
+ return adoptPtr(new CCDebugRectHistory());
+ }
+
+ ~CCDebugRectHistory();
+
+ // Note: Saving debug rects must happen before layers' change tracking is reset.
+ void saveDebugRectsForCurrentFrame(CCLayerImpl* rootLayer, const std::vector<CCLayerImpl*>& renderSurfaceLayerList, const Vector<IntRect>& occludingScreenSpaceRects, const CCLayerTreeSettings&);
+
+ const Vector<CCDebugRect>& debugRects() { return m_debugRects; }
+
+private:
+ CCDebugRectHistory();
+
+ void savePaintRects(CCLayerImpl*);
+ void savePropertyChangedRects(const std::vector<CCLayerImpl*>& renderSurfaceLayerList);
+ void saveSurfaceDamageRects(const std::vector<CCLayerImpl* >& renderSurfaceLayerList);
+ void saveScreenSpaceRects(const std::vector<CCLayerImpl* >& renderSurfaceLayerList);
+ void saveOccludingRects(const Vector<IntRect>& occludingScreenSpaceRects);
+
+ Vector<CCDebugRect> m_debugRects;
+
+ DISALLOW_COPY_AND_ASSIGN(CCDebugRectHistory);
+};
+
+} // namespace cc
+
+#endif // USE(ACCELERATED_COMPOSITING)
+
+#endif
diff --git a/cc/CCDelayBasedTimeSource.cpp b/cc/delay_based_time_source.cc
index 6e34a07..6e34a07 100644
--- a/cc/CCDelayBasedTimeSource.cpp
+++ b/cc/delay_based_time_source.cc
diff --git a/cc/delay_based_time_source.h b/cc/delay_based_time_source.h
index 638cbb2..bf183f7 100644
--- a/cc/delay_based_time_source.h
+++ b/cc/delay_based_time_source.h
@@ -1,3 +1,79 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCDelayBasedTimeSource_h
+#define CCDelayBasedTimeSource_h
+
+#include "CCTimeSource.h"
+#include "CCTimer.h"
+#include <wtf/PassRefPtr.h>
+
+namespace cc {
+
+class CCThread;
+
+// This timer implements a time source that achieves the specified interval
+// in face of millisecond-precision delayed callbacks and random queueing delays.
+class CCDelayBasedTimeSource : public CCTimeSource, CCTimerClient {
+public:
+ static PassRefPtr<CCDelayBasedTimeSource> create(base::TimeDelta interval, CCThread*);
+
+ virtual ~CCDelayBasedTimeSource();
+
+ virtual void setClient(CCTimeSourceClient* client) OVERRIDE;
+
+ // CCTimeSource implementation
+ virtual void setTimebaseAndInterval(base::TimeTicks timebase, base::TimeDelta interval) OVERRIDE;
+
+ virtual void setActive(bool) OVERRIDE;
+ virtual bool active() const OVERRIDE;
+
+ // Get the last and next tick times. nextTimeTime() returns null when
+ // inactive.
+ virtual base::TimeTicks lastTickTime() OVERRIDE;
+ virtual base::TimeTicks nextTickTime() OVERRIDE;
+
+ // CCTimerClient implementation.
+ virtual void onTimerFired() OVERRIDE;
+
+ // Virtual for testing.
+ virtual base::TimeTicks now() const;
+
+protected:
+ CCDelayBasedTimeSource(base::TimeDelta interval, CCThread*);
+ base::TimeTicks nextTickTarget(base::TimeTicks now);
+ void postNextTickTask(base::TimeTicks now);
+
+ enum State {
+ STATE_INACTIVE,
+ STATE_STARTING,
+ STATE_ACTIVE,
+ };
+
+ struct Parameters {
+ Parameters(base::TimeDelta interval, base::TimeTicks tickTarget)
+ : interval(interval), tickTarget(tickTarget)
+ { }
+ base::TimeDelta interval;
+ base::TimeTicks tickTarget;
+ };
+
+ CCTimeSourceClient* m_client;
+ bool m_hasTickTarget;
+ base::TimeTicks m_lastTickTime;
+
+ // m_currentParameters should only be written by postNextTickTask.
+ // m_nextParameters will take effect on the next call to postNextTickTask.
+ // Maintaining a pending set of parameters allows nextTickTime() to always
+ // reflect the actual time we expect onTimerFired to be called.
+ Parameters m_currentParameters;
+ Parameters m_nextParameters;
+
+ State m_state;
+ CCThread* m_thread;
+ CCTimer m_timer;
+};
+
+}
+#endif // CCDelayBasedTimeSource_h
diff --git a/cc/DelegatedRendererLayerChromium.cpp b/cc/delegated_renderer_layer.cc
index 721630d..721630d 100644
--- a/cc/DelegatedRendererLayerChromium.cpp
+++ b/cc/delegated_renderer_layer.cc
diff --git a/cc/delegated_renderer_layer.h b/cc/delegated_renderer_layer.h
index 638cbb2..c7f8d2c 100644
--- a/cc/delegated_renderer_layer.h
+++ b/cc/delegated_renderer_layer.h
@@ -1,3 +1,26 @@
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef DelegatedRendererLayerChromium_h
+#define DelegatedRendererLayerChromium_h
+
+#include "LayerChromium.h"
+
+namespace cc {
+
+class DelegatedRendererLayerChromium : public LayerChromium {
+public:
+ static scoped_refptr<DelegatedRendererLayerChromium> create();
+
+ virtual scoped_ptr<CCLayerImpl> createCCLayerImpl() OVERRIDE;
+
+protected:
+ DelegatedRendererLayerChromium();
+
+private:
+ virtual ~DelegatedRendererLayerChromium();
+};
+
+}
+#endif
diff --git a/cc/CCDelegatedRendererLayerImpl.cpp b/cc/delegated_renderer_layer_impl.cc
index 02d5698..02d5698 100644
--- a/cc/CCDelegatedRendererLayerImpl.cpp
+++ b/cc/delegated_renderer_layer_impl.cc
diff --git a/cc/delegated_renderer_layer_impl.h b/cc/delegated_renderer_layer_impl.h
index 638cbb2..4ed842e 100644
--- a/cc/delegated_renderer_layer_impl.h
+++ b/cc/delegated_renderer_layer_impl.h
@@ -1,3 +1,50 @@
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCDelegatedRendererLayerImpl_h
+#define CCDelegatedRendererLayerImpl_h
+
+#include "CCLayerImpl.h"
+#include "cc/scoped_ptr_vector.h"
+
+namespace cc {
+
+class CCDelegatedRendererLayerImpl : public CCLayerImpl {
+public:
+ static scoped_ptr<CCDelegatedRendererLayerImpl> create(int id) { return make_scoped_ptr(new CCDelegatedRendererLayerImpl(id)); }
+ virtual ~CCDelegatedRendererLayerImpl();
+
+ virtual bool descendantDrawsContent() OVERRIDE;
+ virtual bool hasContributingDelegatedRenderPasses() const OVERRIDE;
+
+ // This gives ownership of the RenderPasses to the layer.
+ void setRenderPasses(ScopedPtrVector<CCRenderPass>&);
+ void clearRenderPasses();
+
+ virtual void didLoseContext() OVERRIDE;
+
+ virtual CCRenderPass::Id firstContributingRenderPassId() const OVERRIDE;
+ virtual CCRenderPass::Id nextContributingRenderPassId(CCRenderPass::Id) const OVERRIDE;
+
+ void appendContributingRenderPasses(CCRenderPassSink&);
+ virtual void appendQuads(CCQuadSink&, CCAppendQuadsData&) OVERRIDE;
+
+private:
+ explicit CCDelegatedRendererLayerImpl(int);
+
+ CCRenderPass::Id convertDelegatedRenderPassId(CCRenderPass::Id delegatedRenderPassId) const;
+
+ void appendRenderPassQuads(CCQuadSink&, CCAppendQuadsData&, CCRenderPass* fromDelegatedRenderPass) const;
+
+ PassOwnPtr<CCDrawQuad> createCopyOfQuad(const CCDrawQuad*);
+
+ virtual const char* layerTypeAsString() const OVERRIDE;
+
+ ScopedPtrVector<CCRenderPass> m_renderPassesInDrawOrder;
+ base::hash_map<CCRenderPass::Id, int> m_renderPassesIndexById;
+};
+
+}
+
+#endif // CCDelegatedRendererLayerImpl_h
diff --git a/cc/CCDirectRenderer.cpp b/cc/direct_renderer.cc
index 23fa1d3..23fa1d3 100644
--- a/cc/CCDirectRenderer.cpp
+++ b/cc/direct_renderer.cc
diff --git a/cc/direct_renderer.h b/cc/direct_renderer.h
index 638cbb2..73e6dc6 100644
--- a/cc/direct_renderer.h
+++ b/cc/direct_renderer.h
@@ -1,3 +1,105 @@
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCDirectRenderer_h
+#define CCDirectRenderer_h
+
+#include "base/basictypes.h"
+#include "CCRenderer.h"
+#include "CCResourceProvider.h"
+#include "CCScopedTexture.h"
+
+namespace cc {
+
+class CCResourceProvider;
+
+// This is the base class for code shared between the GL and software
+// renderer implementations. "Direct" refers to the fact that it does not
+// delegate rendering to another compositor.
+class CCDirectRenderer : public CCRenderer {
+public:
+ virtual ~CCDirectRenderer();
+
+ CCResourceProvider* resourceProvider() const { return m_resourceProvider; }
+
+ virtual void decideRenderPassAllocationsForFrame(const CCRenderPassList& renderPassesInDrawOrder) OVERRIDE;
+ virtual bool haveCachedResourcesForRenderPassId(CCRenderPass::Id) const OVERRIDE;
+ virtual void drawFrame(const CCRenderPassList& renderPassesInDrawOrder, const CCRenderPassIdHashMap& renderPassesById) OVERRIDE;
+
+protected:
+ CCDirectRenderer(CCRendererClient* client, CCResourceProvider* resourceProvider);
+
+ struct DrawingFrame {
+ DrawingFrame();
+ ~DrawingFrame();
+
+ const CCRenderPassIdHashMap* renderPassesById;
+ const CCRenderPass* rootRenderPass;
+ const CCRenderPass* currentRenderPass;
+ const CCScopedTexture* currentTexture;
+
+ FloatRect rootDamageRect;
+
+ WebKit::WebTransformationMatrix projectionMatrix;
+ WebKit::WebTransformationMatrix windowMatrix;
+ bool flippedY;
+ FloatRect scissorRectInRenderPassSpace;
+ };
+
+ class CachedTexture : public CCScopedTexture {
+ public:
+ static scoped_ptr<CachedTexture> create(CCResourceProvider* resourceProvider) {
+ return make_scoped_ptr(new CachedTexture(resourceProvider));
+ }
+ virtual ~CachedTexture() {}
+
+ bool isComplete() const { return m_isComplete; }
+ void setIsComplete(bool isComplete) { m_isComplete = isComplete; }
+
+ protected:
+ explicit CachedTexture(CCResourceProvider* resourceProvider)
+ : CCScopedTexture(resourceProvider)
+ , m_isComplete(false)
+ {
+ }
+
+ private:
+ bool m_isComplete;
+
+ DISALLOW_COPY_AND_ASSIGN(CachedTexture);
+ };
+
+ static FloatRect quadVertexRect();
+ static void quadRectTransform(WebKit::WebTransformationMatrix* quadRectTransform, const WebKit::WebTransformationMatrix& quadTransform, const FloatRect& quadRect);
+ static void initializeMatrices(DrawingFrame&, const IntRect& drawRect, bool flipY);
+ static IntRect moveScissorToWindowSpace(const DrawingFrame&, FloatRect scissorRect);
+
+ bool haveCachedResources(CCRenderPass::Id) const;
+ static IntSize renderPassTextureSize(const CCRenderPass*);
+ static GC3Denum renderPassTextureFormat(const CCRenderPass*);
+
+ void drawRenderPass(DrawingFrame&, const CCRenderPass*);
+ bool useRenderPass(DrawingFrame&, const CCRenderPass*);
+
+ virtual void bindFramebufferToOutputSurface(DrawingFrame&) = 0;
+ virtual bool bindFramebufferToTexture(DrawingFrame&, const CCScopedTexture*, const IntRect& framebufferRect) = 0;
+ virtual void setDrawViewportSize(const IntSize&) = 0;
+ virtual void enableScissorTestRect(const IntRect& scissorRect) = 0;
+ virtual void disableScissorTest() = 0;
+ virtual void clearFramebuffer(DrawingFrame&) = 0;
+ virtual void drawQuad(DrawingFrame&, const CCDrawQuad*) = 0;
+ virtual void beginDrawingFrame(DrawingFrame&) = 0;
+ virtual void finishDrawingFrame(DrawingFrame&) = 0;
+ virtual bool flippedFramebuffer() const = 0;
+
+ ScopedPtrHashMap<CCRenderPass::Id, CachedTexture> m_renderPassTextures;
+ CCResourceProvider* m_resourceProvider;
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(CCDirectRenderer);
+};
+
+} // namespace cc
+
+#endif // CCDirectRenderer_h
diff --git a/cc/CCDrawQuad.cpp b/cc/draw_quad.cc
index b88eac6..b88eac6 100644
--- a/cc/CCDrawQuad.cpp
+++ b/cc/draw_quad.cc
diff --git a/cc/draw_quad.h b/cc/draw_quad.h
index 638cbb2..05a6906 100644
--- a/cc/draw_quad.h
+++ b/cc/draw_quad.h
@@ -1,3 +1,96 @@
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCDrawQuad_h
+#define CCDrawQuad_h
+
+#include "CCSharedQuadState.h"
+
+namespace cc {
+
+// WARNING! All CCXYZDrawQuad classes must remain PODs (plain old data).
+// They are intended to be "serializable" by copying their raw bytes, so they
+// must not contain any non-bit-copyable member variables!
+//
+// Furthermore, the class members need to be packed so they are aligned
+// properly and don't have paddings/gaps, otherwise memory check tools
+// like Valgrind will complain about uninitialized memory usage when
+// transferring these classes over the wire.
+#pragma pack(push, 4)
+
+// CCDrawQuad is a bag of data used for drawing a quad. Because different
+// materials need different bits of per-quad data to render, classes that derive
+// from CCDrawQuad store additional data in their derived instance. The Material
+// enum is used to "safely" downcast to the derived class.
+class CCDrawQuad {
+public:
+ enum Material {
+ Invalid,
+ Checkerboard,
+ DebugBorder,
+ IOSurfaceContent,
+ RenderPass,
+ TextureContent,
+ SolidColor,
+ TiledContent,
+ YUVVideoContent,
+ StreamVideoContent,
+ };
+
+ IntRect quadRect() const { return m_quadRect; }
+ const WebKit::WebTransformationMatrix& quadTransform() const { return m_sharedQuadState->quadTransform; }
+ IntRect visibleContentRect() const { return m_sharedQuadState->visibleContentRect; }
+ IntRect clippedRectInTarget() const { return m_sharedQuadState->clippedRectInTarget; }
+ float opacity() const { return m_sharedQuadState->opacity; }
+ // For the purposes of blending, what part of the contents of this quad are opaque?
+ IntRect opaqueRect() const;
+ bool needsBlending() const { return m_needsBlending || !opaqueRect().contains(m_quadVisibleRect); }
+
+ // Allows changing the rect that gets drawn to make it smaller. Parameter passed
+ // in will be clipped to quadRect().
+ void setQuadVisibleRect(const IntRect&);
+ IntRect quadVisibleRect() const { return m_quadVisibleRect; }
+ bool isDebugQuad() const { return m_material == DebugBorder; }
+
+ Material material() const { return m_material; }
+
+ // Returns transfer size of this object based on the derived class (by
+ // looking at the material type).
+ unsigned size() const;
+
+ scoped_ptr<CCDrawQuad> copy(const CCSharedQuadState* copiedSharedQuadState) const;
+
+ const CCSharedQuadState* sharedQuadState() const { return m_sharedQuadState; }
+ int sharedQuadStateId() const { return m_sharedQuadStateId; }
+ void setSharedQuadState(const CCSharedQuadState*);
+
+protected:
+ CCDrawQuad(const CCSharedQuadState*, Material, const IntRect&);
+
+ // Stores state common to a large bundle of quads; kept separate for memory
+ // efficiency. There is special treatment to reconstruct these pointers
+ // during serialization.
+ const CCSharedQuadState* m_sharedQuadState;
+ int m_sharedQuadStateId;
+
+ Material m_material;
+ IntRect m_quadRect;
+ IntRect m_quadVisibleRect;
+
+ // By default, the shared quad state determines whether or not this quad is
+ // opaque or needs blending. Derived classes can override with these
+ // variables.
+ bool m_quadOpaque;
+ bool m_needsBlending;
+
+ // Be default, this rect is empty. It is used when the shared quad state and above
+ // variables determine that the quad is not fully opaque but may be partially opaque.
+ IntRect m_opaqueRect;
+};
+
+#pragma pack(pop)
+
+}
+
+#endif
diff --git a/cc/CCFontAtlas.cpp b/cc/font_atlas.cc
index 8be8b63..8be8b63 100644
--- a/cc/CCFontAtlas.cpp
+++ b/cc/font_atlas.cc
diff --git a/cc/font_atlas.h b/cc/font_atlas.h
index 638cbb2..2881ee9 100644
--- a/cc/font_atlas.h
+++ b/cc/font_atlas.h
@@ -1,3 +1,70 @@
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCFontAtlas_h
+#define CCFontAtlas_h
+
+#if USE(ACCELERATED_COMPOSITING)
+
+#include <string>
+
+#include "base/basictypes.h"
+#include "base/memory/scoped_ptr.h"
+#include "IntRect.h"
+#include "SkBitmap.h"
+
+class SkCanvas;
+
+namespace gfx {
+class Point;
+}
+
+namespace cc {
+
+class Color;
+class FontDescription;
+class GraphicsContext;
+class IntSize;
+
+// This class provides basic ability to draw text onto the heads-up display.
+class CCFontAtlas {
+public:
+ static scoped_ptr<CCFontAtlas> create(SkBitmap bitmap, IntRect asciiToRectTable[128], int fontHeight)
+ {
+ return make_scoped_ptr(new CCFontAtlas(bitmap, asciiToRectTable, fontHeight));
+ }
+ ~CCFontAtlas();
+
+ // Draws multiple lines of text where each line of text is separated by '\n'.
+ // - Correct glyphs will be drawn for ASCII codes in the range 32-127; any characters
+ // outside that range will be displayed as a default rectangle glyph.
+ // - IntSize clip is used to avoid wasting time drawing things that are outside the
+ // target canvas bounds.
+ // - Should only be called only on the impl thread.
+ void drawText(SkCanvas*, const SkPaint&, const std::string& text, const gfx::Point& destPosition, const IntSize& clip) const;
+
+ // Draws the entire atlas at the specified position, just for debugging purposes.
+ void drawDebugAtlas(SkCanvas*, const gfx::Point& destPosition) const;
+
+private:
+ CCFontAtlas(SkBitmap, IntRect asciiToRectTable[128], int fontHeight);
+
+ void drawOneLineOfTextInternal(SkCanvas*, const SkPaint&, const std::string&, const gfx::Point& destPosition) const;
+
+ // The actual texture atlas containing all the pre-rendered glyphs.
+ SkBitmap m_atlas;
+
+ // The look-up tables mapping ascii characters to their IntRect locations on the atlas.
+ IntRect m_asciiToRectTable[128];
+
+ int m_fontHeight;
+
+ DISALLOW_COPY_AND_ASSIGN(CCFontAtlas);
+};
+
+} // namespace cc
+
+#endif // USE(ACCELERATED_COMPOSITING)
+
+#endif
diff --git a/cc/FrameBufferSkPictureCanvasLayerTextureUpdater.cpp b/cc/frame_buffer_skpicture_canvas_layer_texture_updater.cc
index adfcd07..adfcd07 100644
--- a/cc/FrameBufferSkPictureCanvasLayerTextureUpdater.cpp
+++ b/cc/frame_buffer_skpicture_canvas_layer_texture_updater.cc
diff --git a/cc/frame_buffer_skpicture_canvas_layer_texture_updater.h b/cc/frame_buffer_skpicture_canvas_layer_texture_updater.h
index 638cbb2..79093f2 100644
--- a/cc/frame_buffer_skpicture_canvas_layer_texture_updater.h
+++ b/cc/frame_buffer_skpicture_canvas_layer_texture_updater.h
@@ -1,3 +1,52 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+
+#ifndef FrameBufferSkPictureCanvasLayerTextureUpdater_h
+#define FrameBufferSkPictureCanvasLayerTextureUpdater_h
+
+#if USE(ACCELERATED_COMPOSITING)
+
+#include "SkPictureCanvasLayerTextureUpdater.h"
+
+class GrContext;
+
+namespace WebKit {
+class WebGraphicsContext3D;
+class WebSharedGraphicsContext3D;
+}
+
+namespace cc {
+
+// This class records the contentRect into an SkPicture, then uses accelerated
+// drawing to update the texture. The accelerated drawing goes to an
+// intermediate framebuffer and then is copied to the destination texture once done.
+class FrameBufferSkPictureCanvasLayerTextureUpdater : public SkPictureCanvasLayerTextureUpdater {
+public:
+ class Texture : public LayerTextureUpdater::Texture {
+ public:
+ Texture(FrameBufferSkPictureCanvasLayerTextureUpdater*, scoped_ptr<CCPrioritizedTexture>);
+ virtual ~Texture();
+
+ virtual void updateRect(CCResourceProvider*, const IntRect& sourceRect, const IntSize& destOffset) OVERRIDE;
+
+ private:
+ FrameBufferSkPictureCanvasLayerTextureUpdater* textureUpdater() { return m_textureUpdater; }
+
+ FrameBufferSkPictureCanvasLayerTextureUpdater* m_textureUpdater;
+ };
+
+ static PassRefPtr<FrameBufferSkPictureCanvasLayerTextureUpdater> create(PassOwnPtr<LayerPainterChromium>);
+ virtual ~FrameBufferSkPictureCanvasLayerTextureUpdater();
+
+ virtual PassOwnPtr<LayerTextureUpdater::Texture> createTexture(CCPrioritizedTextureManager*) OVERRIDE;
+ virtual SampledTexelFormat sampledTexelFormat(GC3Denum textureFormat) OVERRIDE;
+ void updateTextureRect(WebKit::WebGraphicsContext3D*, GrContext*, CCResourceProvider*, CCPrioritizedTexture*, const IntRect& sourceRect, const IntSize& destOffset);
+
+private:
+ explicit FrameBufferSkPictureCanvasLayerTextureUpdater(PassOwnPtr<LayerPainterChromium>);
+};
+} // namespace cc
+#endif // USE(ACCELERATED_COMPOSITING)
+#endif // FrameBufferSkPictureCanvasLayerTextureUpdater_h
diff --git a/cc/CCFrameRateController.cpp b/cc/frame_rate_controller.cc
index c996ebd..c996ebd 100644
--- a/cc/CCFrameRateController.cpp
+++ b/cc/frame_rate_controller.cc
diff --git a/cc/frame_rate_controller.h b/cc/frame_rate_controller.h
index 638cbb2..2aeeae1 100644
--- a/cc/frame_rate_controller.h
+++ b/cc/frame_rate_controller.h
@@ -1,3 +1,82 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCFrameRateController_h
+#define CCFrameRateController_h
+
+#include "base/memory/scoped_ptr.h"
+#include "base/time.h"
+#include "CCTimer.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
+
+namespace cc {
+
+class CCThread;
+class CCTimeSource;
+
+class CCFrameRateControllerClient {
+public:
+ // Throttled is true when we have a maximum number of frames pending.
+ virtual void vsyncTick(bool throttled) = 0;
+
+protected:
+ virtual ~CCFrameRateControllerClient() {}
+};
+
+class CCFrameRateControllerTimeSourceAdapter;
+
+class CCFrameRateController : public CCTimerClient {
+public:
+ explicit CCFrameRateController(PassRefPtr<CCTimeSource>);
+ // Alternate form of CCFrameRateController with unthrottled frame-rate.
+ explicit CCFrameRateController(CCThread*);
+ virtual ~CCFrameRateController();
+
+ void setClient(CCFrameRateControllerClient* client) { m_client = client; }
+
+ void setActive(bool);
+
+ // Use the following methods to adjust target frame rate.
+ //
+ // Multiple frames can be in-progress, but for every didBeginFrame, a
+ // didFinishFrame should be posted.
+ //
+ // If the rendering pipeline crashes, call didAbortAllPendingFrames.
+ void didBeginFrame();
+ void didFinishFrame();
+ void didAbortAllPendingFrames();
+ void setMaxFramesPending(int); // 0 for unlimited.
+
+ // This returns null for unthrottled frame-rate.
+ base::TimeTicks nextTickTime();
+
+ void setTimebaseAndInterval(base::TimeTicks timebase, base::TimeDelta interval);
+ void setSwapBuffersCompleteSupported(bool);
+
+protected:
+ friend class CCFrameRateControllerTimeSourceAdapter;
+ void onTimerTick();
+
+ void postManualTick();
+
+ // CCTimerClient implementation (used for unthrottled frame-rate).
+ virtual void onTimerFired() OVERRIDE;
+
+ CCFrameRateControllerClient* m_client;
+ int m_numFramesPending;
+ int m_maxFramesPending;
+ RefPtr<CCTimeSource> m_timeSource;
+ scoped_ptr<CCFrameRateControllerTimeSourceAdapter> m_timeSourceClientAdapter;
+ bool m_active;
+ bool m_swapBuffersCompleteSupported;
+
+ // Members for unthrottled frame-rate.
+ bool m_isTimeSourceThrottling;
+ scoped_ptr<CCTimer> m_manualTicker;
+};
+
+} // namespace cc
+
+#endif // CCFrameRateController_h
diff --git a/cc/CCFrameRateCounter.cpp b/cc/frame_rate_counter.cc
index 80074ed..80074ed 100644
--- a/cc/CCFrameRateCounter.cpp
+++ b/cc/frame_rate_counter.cc
diff --git a/cc/frame_rate_counter.h b/cc/frame_rate_counter.h
index 638cbb2..76b4224 100644
--- a/cc/frame_rate_counter.h
+++ b/cc/frame_rate_counter.h
@@ -1,3 +1,72 @@
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCFrameRateCounter_h
+#define CCFrameRateCounter_h
+
+#if USE(ACCELERATED_COMPOSITING)
+
+#include "base/basictypes.h"
+#include <wtf/PassOwnPtr.h>
+
+namespace cc {
+
+// This class maintains a history of timestamps, and provides functionality to
+// intelligently compute average frames per second (and standard deviation).
+class CCFrameRateCounter {
+public:
+ static PassOwnPtr<CCFrameRateCounter> create()
+ {
+ return adoptPtr(new CCFrameRateCounter());
+ }
+
+ void markBeginningOfFrame(double timestamp);
+ void markEndOfFrame();
+ int currentFrameNumber() const { return m_currentFrameNumber; }
+ void getAverageFPSAndStandardDeviation(double& averageFPS, double& standardDeviation) const;
+ int timeStampHistorySize() const { return kTimeStampHistorySize; }
+
+ // n = 0 returns the oldest frame retained in the history,
+ // while n = timeStampHistorySize() - 1 returns the timestamp most recent frame.
+ double timeStampOfRecentFrame(int /* n */);
+
+ // This is a heuristic that can be used to ignore frames in a reasonable way. Returns
+ // true if the given frame interval is too fast or too slow, based on constant thresholds.
+ bool isBadFrameInterval(double intervalBetweenConsecutiveFrames) const;
+
+ int droppedFrameCount() const { return m_droppedFrameCount; }
+
+private:
+ CCFrameRateCounter();
+
+ double frameInterval(int frameNumber) const;
+ int frameIndex(int frameNumber) const;
+ bool isBadFrame(int frameNumber) const;
+
+ // Two thresholds (measured in seconds) that describe what is considered to be a "no-op frame" that should not be counted.
+ // - if the frame is too fast, then given our compositor implementation, the frame probably was a no-op and did not draw.
+ // - if the frame is too slow, then there is probably not animating content, so we should not pollute the average.
+ static const double kFrameTooFast;
+ static const double kFrameTooSlow;
+
+ // If a frame takes longer than this threshold (measured in seconds) then we
+ // (naively) assume that it missed a screen refresh; that is, we dropped a frame.
+ // FIXME: Determine this threshold based on monitor refresh rate, crbug.com/138642.
+ static const double kDroppedFrameTime;
+
+ static const int kTimeStampHistorySize = 120;
+
+ int m_currentFrameNumber;
+ double m_timeStampHistory[kTimeStampHistorySize];
+
+ int m_droppedFrameCount;
+
+ DISALLOW_COPY_AND_ASSIGN(CCFrameRateCounter);
+};
+
+} // namespace cc
+
+#endif // USE(ACCELERATED_COMPOSITING)
+
+#endif
diff --git a/cc/GeometryBinding.cpp b/cc/geometry_binding.cc
index bac1059..bac1059 100644
--- a/cc/GeometryBinding.cpp
+++ b/cc/geometry_binding.cc
diff --git a/cc/geometry_binding.h b/cc/geometry_binding.h
index 638cbb2..f0b6e72 100644
--- a/cc/geometry_binding.h
+++ b/cc/geometry_binding.h
@@ -1,3 +1,48 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef GeometryBinding_h
+#define GeometryBinding_h
+
+#include "FloatRect.h"
+
+#if USE(ACCELERATED_COMPOSITING)
+
+namespace WebKit {
+class WebGraphicsContext3D;
+}
+
+namespace cc {
+
+class GeometryBinding {
+public:
+ GeometryBinding(WebKit::WebGraphicsContext3D*, const FloatRect& quadVertexRect);
+ ~GeometryBinding();
+
+ bool initialized() const { return m_initialized; }
+
+ WebKit::WebGraphicsContext3D* context() const { return m_context; }
+ unsigned quadVerticesVbo() const { return m_quadVerticesVbo; }
+ unsigned quadElementsVbo() const { return m_quadElementsVbo; }
+
+ void prepareForDraw();
+
+ // All layer shaders share the same attribute locations for the vertex
+ // positions and texture coordinates. This allows switching shaders without
+ // rebinding attribute arrays.
+ static int positionAttribLocation() { return 0; }
+ static int texCoordAttribLocation() { return 1; }
+
+private:
+ WebKit::WebGraphicsContext3D* m_context;
+ unsigned m_quadVerticesVbo;
+ unsigned m_quadElementsVbo;
+ bool m_initialized;
+};
+
+} // namespace cc
+
+#endif // USE(ACCELERATED_COMPOSITING)
+
+#endif
diff --git a/cc/CCRendererGL.cpp b/cc/gl_renderer.cc
index f28cc50..f28cc50 100644
--- a/cc/CCRendererGL.cpp
+++ b/cc/gl_renderer.cc
diff --git a/cc/gl_renderer.h b/cc/gl_renderer.h
index 638cbb2..a5f2c4f 100644
--- a/cc/gl_renderer.h
+++ b/cc/gl_renderer.h
@@ -1,3 +1,240 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+
+#ifndef CCRendererGL_h
+#define CCRendererGL_h
+
+#if USE(ACCELERATED_COMPOSITING)
+
+#include "base/basictypes.h"
+#include "CCCheckerboardDrawQuad.h"
+#include "CCDebugBorderDrawQuad.h"
+#include "CCDirectRenderer.h"
+#include "CCIOSurfaceDrawQuad.h"
+#include "CCRenderPassDrawQuad.h"
+#include "CCRenderer.h"
+#include "CCSolidColorDrawQuad.h"
+#include "CCStreamVideoDrawQuad.h"
+#include "CCTextureDrawQuad.h"
+#include "CCTileDrawQuad.h"
+#include "CCYUVVideoDrawQuad.h"
+#include "Extensions3DChromium.h"
+#include <wtf/PassOwnPtr.h>
+
+namespace WebKit {
+class WebGraphicsContext3D;
+}
+
+namespace cc {
+
+class CCScopedTexture;
+class GeometryBinding;
+class ScopedEnsureFramebufferAllocation;
+
+// Class that handles drawing of composited render layers using GL.
+class CCRendererGL : public CCDirectRenderer,
+ public WebKit::WebGraphicsContext3D::WebGraphicsSwapBuffersCompleteCallbackCHROMIUM,
+ public WebKit::WebGraphicsContext3D::WebGraphicsMemoryAllocationChangedCallbackCHROMIUM ,
+ public WebKit::WebGraphicsContext3D::WebGraphicsContextLostCallback {
+public:
+ static PassOwnPtr<CCRendererGL> create(CCRendererClient*, CCResourceProvider*);
+
+ virtual ~CCRendererGL();
+
+ virtual const RendererCapabilities& capabilities() const OVERRIDE;
+
+ WebKit::WebGraphicsContext3D* context();
+
+ virtual void viewportChanged() OVERRIDE;
+
+ const FloatQuad& sharedGeometryQuad() const { return m_sharedGeometryQuad; }
+
+ // waits for rendering to finish
+ virtual void finish() OVERRIDE;
+
+ virtual void doNoOp() OVERRIDE;
+ // puts backbuffer onscreen
+ virtual bool swapBuffers() OVERRIDE;
+
+ static void debugGLCall(WebKit::WebGraphicsContext3D*, const char* command, const char* file, int line);
+
+ const GeometryBinding* sharedGeometry() const { return m_sharedGeometry.get(); }
+
+ virtual void getFramebufferPixels(void *pixels, const IntRect&) OVERRIDE;
+ bool getFramebufferTexture(CCScopedTexture*, const IntRect& deviceRect);
+
+ virtual bool isContextLost() OVERRIDE;
+
+ virtual void setVisible(bool) OVERRIDE;
+
+protected:
+ CCRendererGL(CCRendererClient*, CCResourceProvider*);
+
+ bool isFramebufferDiscarded() const { return m_isFramebufferDiscarded; }
+ bool initialize();
+
+ void releaseRenderPassTextures();
+
+ virtual void bindFramebufferToOutputSurface(DrawingFrame&) OVERRIDE;
+ virtual bool bindFramebufferToTexture(DrawingFrame&, const CCScopedTexture*, const IntRect& framebufferRect) OVERRIDE;
+ virtual void setDrawViewportSize(const IntSize&) OVERRIDE;
+ virtual void enableScissorTestRect(const IntRect& scissorRect) OVERRIDE;
+ virtual void disableScissorTest() OVERRIDE;
+ virtual void clearFramebuffer(DrawingFrame&) OVERRIDE;
+ virtual void drawQuad(DrawingFrame&, const CCDrawQuad*) OVERRIDE;
+ virtual void beginDrawingFrame(DrawingFrame&) OVERRIDE;
+ virtual void finishDrawingFrame(DrawingFrame&) OVERRIDE;
+ virtual bool flippedFramebuffer() const OVERRIDE;
+
+private:
+ static void toGLMatrix(float*, const WebKit::WebTransformationMatrix&);
+
+ void drawCheckerboardQuad(const DrawingFrame&, const CCCheckerboardDrawQuad*);
+ void drawDebugBorderQuad(const DrawingFrame&, const CCDebugBorderDrawQuad*);
+ PassOwnPtr<CCScopedTexture> drawBackgroundFilters(DrawingFrame&, const CCRenderPassDrawQuad*, const WebKit::WebFilterOperations&, const WebKit::WebTransformationMatrix& deviceTransform);
+ void drawRenderPassQuad(DrawingFrame&, const CCRenderPassDrawQuad*);
+ void drawSolidColorQuad(const DrawingFrame&, const CCSolidColorDrawQuad*);
+ void drawStreamVideoQuad(const DrawingFrame&, const CCStreamVideoDrawQuad*);
+ void drawTextureQuad(const DrawingFrame&, const CCTextureDrawQuad*);
+ void drawIOSurfaceQuad(const DrawingFrame&, const CCIOSurfaceDrawQuad*);
+ void drawTileQuad(const DrawingFrame&, const CCTileDrawQuad*);
+ void drawYUVVideoQuad(const DrawingFrame&, const CCYUVVideoDrawQuad*);
+
+ void setShaderOpacity(float opacity, int alphaLocation);
+ void setShaderFloatQuad(const FloatQuad&, int quadLocation);
+ void drawQuadGeometry(const DrawingFrame&, const WebKit::WebTransformationMatrix& drawTransform, const FloatRect& quadRect, int matrixLocation);
+
+ void copyTextureToFramebuffer(const DrawingFrame&, int textureId, const IntRect&, const WebKit::WebTransformationMatrix& drawMatrix);
+
+ bool useScopedTexture(DrawingFrame&, const CCScopedTexture*, const IntRect& viewportRect);
+
+ bool makeContextCurrent();
+
+ bool initializeSharedObjects();
+ void cleanupSharedObjects();
+
+ // WebKit::WebGraphicsContext3D::WebGraphicsSwapBuffersCompleteCallbackCHROMIUM implementation.
+ virtual void onSwapBuffersComplete() OVERRIDE;
+
+ // WebKit::WebGraphicsContext3D::WebGraphicsMemoryAllocationChangedCallbackCHROMIUM implementation.
+ virtual void onMemoryAllocationChanged(WebKit::WebGraphicsMemoryAllocation) OVERRIDE;
+ void onMemoryAllocationChangedOnImplThread(WebKit::WebGraphicsMemoryAllocation);
+ void discardFramebuffer();
+ void ensureFramebuffer();
+
+ // WebGraphicsContext3D::WebGraphicsContextLostCallback implementation.
+ virtual void onContextLost() OVERRIDE;
+
+ RendererCapabilities m_capabilities;
+
+ unsigned m_offscreenFramebufferId;
+
+ OwnPtr<GeometryBinding> m_sharedGeometry;
+ FloatQuad m_sharedGeometryQuad;
+
+ // This block of bindings defines all of the programs used by the compositor itself.
+
+ // Tiled layer shaders.
+ typedef ProgramBinding<VertexShaderTile, FragmentShaderRGBATexAlpha> TileProgram;
+ typedef ProgramBinding<VertexShaderTile, FragmentShaderRGBATexClampAlphaAA> TileProgramAA;
+ typedef ProgramBinding<VertexShaderTile, FragmentShaderRGBATexClampSwizzleAlphaAA> TileProgramSwizzleAA;
+ typedef ProgramBinding<VertexShaderTile, FragmentShaderRGBATexOpaque> TileProgramOpaque;
+ typedef ProgramBinding<VertexShaderTile, FragmentShaderRGBATexSwizzleAlpha> TileProgramSwizzle;
+ typedef ProgramBinding<VertexShaderTile, FragmentShaderRGBATexSwizzleOpaque> TileProgramSwizzleOpaque;
+ typedef ProgramBinding<VertexShaderPosTex, FragmentShaderCheckerboard> TileCheckerboardProgram;
+
+ // Render surface shaders.
+ typedef ProgramBinding<VertexShaderPosTex, FragmentShaderRGBATexAlpha> RenderPassProgram;
+ typedef ProgramBinding<VertexShaderPosTex, FragmentShaderRGBATexAlphaMask> RenderPassMaskProgram;
+ typedef ProgramBinding<VertexShaderQuad, FragmentShaderRGBATexAlphaAA> RenderPassProgramAA;
+ typedef ProgramBinding<VertexShaderQuad, FragmentShaderRGBATexAlphaMaskAA> RenderPassMaskProgramAA;
+
+ // Texture shaders.
+ typedef ProgramBinding<VertexShaderPosTexTransform, FragmentShaderRGBATexAlpha> TextureProgram;
+ typedef ProgramBinding<VertexShaderPosTexTransform, FragmentShaderRGBATexFlipAlpha> TextureProgramFlip;
+ typedef ProgramBinding<VertexShaderPosTexTransform, FragmentShaderRGBATexRectAlpha> TextureIOSurfaceProgram;
+
+ // Video shaders.
+ typedef ProgramBinding<VertexShaderVideoTransform, FragmentShaderOESImageExternal> VideoStreamTextureProgram;
+ typedef ProgramBinding<VertexShaderPosTexYUVStretch, FragmentShaderYUVVideo> VideoYUVProgram;
+
+ // Special purpose / effects shaders.
+ typedef ProgramBinding<VertexShaderPos, FragmentShaderColor> SolidColorProgram;
+
+ const TileProgram* tileProgram();
+ const TileProgramOpaque* tileProgramOpaque();
+ const TileProgramAA* tileProgramAA();
+ const TileProgramSwizzle* tileProgramSwizzle();
+ const TileProgramSwizzleOpaque* tileProgramSwizzleOpaque();
+ const TileProgramSwizzleAA* tileProgramSwizzleAA();
+ const TileCheckerboardProgram* tileCheckerboardProgram();
+
+ const RenderPassProgram* renderPassProgram();
+ const RenderPassProgramAA* renderPassProgramAA();
+ const RenderPassMaskProgram* renderPassMaskProgram();
+ const RenderPassMaskProgramAA* renderPassMaskProgramAA();
+
+ const TextureProgram* textureProgram();
+ const TextureProgramFlip* textureProgramFlip();
+ const TextureIOSurfaceProgram* textureIOSurfaceProgram();
+
+ const VideoYUVProgram* videoYUVProgram();
+ const VideoStreamTextureProgram* videoStreamTextureProgram();
+
+ const SolidColorProgram* solidColorProgram();
+
+ OwnPtr<TileProgram> m_tileProgram;
+ OwnPtr<TileProgramOpaque> m_tileProgramOpaque;
+ OwnPtr<TileProgramAA> m_tileProgramAA;
+ OwnPtr<TileProgramSwizzle> m_tileProgramSwizzle;
+ OwnPtr<TileProgramSwizzleOpaque> m_tileProgramSwizzleOpaque;
+ OwnPtr<TileProgramSwizzleAA> m_tileProgramSwizzleAA;
+ OwnPtr<TileCheckerboardProgram> m_tileCheckerboardProgram;
+
+ OwnPtr<RenderPassProgram> m_renderPassProgram;
+ OwnPtr<RenderPassProgramAA> m_renderPassProgramAA;
+ OwnPtr<RenderPassMaskProgram> m_renderPassMaskProgram;
+ OwnPtr<RenderPassMaskProgramAA> m_renderPassMaskProgramAA;
+
+ OwnPtr<TextureProgram> m_textureProgram;
+ OwnPtr<TextureProgramFlip> m_textureProgramFlip;
+ OwnPtr<TextureIOSurfaceProgram> m_textureIOSurfaceProgram;
+
+ OwnPtr<VideoYUVProgram> m_videoYUVProgram;
+ OwnPtr<VideoStreamTextureProgram> m_videoStreamTextureProgram;
+
+ OwnPtr<SolidColorProgram> m_solidColorProgram;
+
+ WebKit::WebGraphicsContext3D* m_context;
+
+ IntRect m_swapBufferRect;
+ bool m_isViewportChanged;
+ bool m_isFramebufferDiscarded;
+ bool m_isUsingBindUniform;
+ bool m_visible;
+
+ OwnPtr<CCResourceProvider::ScopedWriteLockGL> m_currentFramebufferLock;
+
+ DISALLOW_COPY_AND_ASSIGN(CCRendererGL);
+};
+
+
+// Setting DEBUG_GL_CALLS to 1 will call glGetError() after almost every GL
+// call made by the compositor. Useful for debugging rendering issues but
+// will significantly degrade performance.
+#define DEBUG_GL_CALLS 0
+
+#if DEBUG_GL_CALLS && !defined ( NDEBUG )
+#define GLC(context, x) (x, CCRendererGL::debugGLCall(&*context, #x, __FILE__, __LINE__))
+#else
+#define GLC(context, x) (x)
+#endif
+
+
+}
+
+#endif // USE(ACCELERATED_COMPOSITING)
+
+#endif
diff --git a/cc/graphics_context.h b/cc/graphics_context.h
index 638cbb2..6eb5b34 100644
--- a/cc/graphics_context.h
+++ b/cc/graphics_context.h
@@ -1,3 +1,18 @@
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCGraphicsContext_h
+#define CCGraphicsContext_h
+
+#include <public/WebCompositorOutputSurface.h>
+#include <public/WebGraphicsContext3D.h>
+
+namespace cc {
+
+// FIXME: rename fully to CCOutputSurface.
+typedef WebKit::WebCompositorOutputSurface CCGraphicsContext;
+
+} // namespace cc
+
+#endif // CCGraphicsContext_h
diff --git a/cc/HeadsUpDisplayLayerChromium.cpp b/cc/heads_up_display_layer.cc
index 743593c..743593c 100644
--- a/cc/HeadsUpDisplayLayerChromium.cpp
+++ b/cc/heads_up_display_layer.cc
diff --git a/cc/heads_up_display_layer.h b/cc/heads_up_display_layer.h
index 638cbb2..cd2627e 100644
--- a/cc/heads_up_display_layer.h
+++ b/cc/heads_up_display_layer.h
@@ -1,3 +1,38 @@
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef HeadsUpDisplayLayerChromium_h
+#define HeadsUpDisplayLayerChromium_h
+
+#include "base/memory/scoped_ptr.h"
+#include "CCFontAtlas.h"
+#include "IntSize.h"
+#include "LayerChromium.h"
+
+namespace cc {
+
+class HeadsUpDisplayLayerChromium : public LayerChromium {
+public:
+ static scoped_refptr<HeadsUpDisplayLayerChromium> create();
+
+ virtual void update(CCTextureUpdateQueue&, const CCOcclusionTracker*, CCRenderingStats&) OVERRIDE;
+ virtual bool drawsContent() const OVERRIDE;
+
+ void setFontAtlas(scoped_ptr<CCFontAtlas>);
+
+ virtual scoped_ptr<CCLayerImpl> createCCLayerImpl() OVERRIDE;
+ virtual void pushPropertiesTo(CCLayerImpl*) OVERRIDE;
+
+protected:
+ HeadsUpDisplayLayerChromium();
+
+private:
+ virtual ~HeadsUpDisplayLayerChromium();
+
+ scoped_ptr<CCFontAtlas> m_fontAtlas;
+};
+
+} // namespace cc
+
+#endif
diff --git a/cc/CCHeadsUpDisplayLayerImpl.cpp b/cc/heads_up_display_layer_impl.cc
index 58a490e..58a490e 100644
--- a/cc/CCHeadsUpDisplayLayerImpl.cpp
+++ b/cc/heads_up_display_layer_impl.cc
diff --git a/cc/heads_up_display_layer_impl.h b/cc/heads_up_display_layer_impl.h
index 638cbb2..47e7cfe 100644
--- a/cc/heads_up_display_layer_impl.h
+++ b/cc/heads_up_display_layer_impl.h
@@ -1,3 +1,57 @@
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCHeadsUpDisplayLayerImpl_h
+#define CCHeadsUpDisplayLayerImpl_h
+
+#include "base/memory/scoped_ptr.h"
+#include "CCFontAtlas.h"
+#include "CCLayerImpl.h"
+#include "CCScopedTexture.h"
+
+class SkCanvas;
+
+namespace cc {
+
+class CCDebugRectHistory;
+class CCFontAtlas;
+class CCFrameRateCounter;
+
+class CCHeadsUpDisplayLayerImpl : public CCLayerImpl {
+public:
+ static scoped_ptr<CCHeadsUpDisplayLayerImpl> create(int id)
+ {
+ return make_scoped_ptr(new CCHeadsUpDisplayLayerImpl(id));
+ }
+ virtual ~CCHeadsUpDisplayLayerImpl();
+
+ void setFontAtlas(scoped_ptr<CCFontAtlas>);
+
+ virtual void willDraw(CCResourceProvider*) OVERRIDE;
+ virtual void appendQuads(CCQuadSink&, CCAppendQuadsData&) OVERRIDE;
+ void updateHudTexture(CCResourceProvider*);
+ virtual void didDraw(CCResourceProvider*) OVERRIDE;
+
+ virtual void didLoseContext() OVERRIDE;
+
+ virtual bool layerIsAlwaysDamaged() const OVERRIDE;
+
+private:
+ explicit CCHeadsUpDisplayLayerImpl(int);
+
+ virtual const char* layerTypeAsString() const OVERRIDE;
+
+ void drawHudContents(SkCanvas*);
+ void drawFPSCounter(SkCanvas*, CCFrameRateCounter*, int top, int height);
+ void drawFPSCounterText(SkCanvas*, CCFrameRateCounter*, int top, int width, int height);
+ void drawDebugRects(SkCanvas*, CCDebugRectHistory*);
+
+ scoped_ptr<CCFontAtlas> m_fontAtlas;
+ OwnPtr<CCScopedTexture> m_hudTexture;
+ OwnPtr<SkCanvas> m_hudCanvas;
+};
+
+} // namespace cc
+
+#endif // CCHeadsUpDisplayLayerImpl_h
diff --git a/cc/ImageLayerChromium.cpp b/cc/image_layer.cc
index c98796b..c98796b 100644
--- a/cc/ImageLayerChromium.cpp
+++ b/cc/image_layer.cc
diff --git a/cc/image_layer.h b/cc/image_layer.h
index 638cbb2..12ac397 100644
--- a/cc/image_layer.h
+++ b/cc/image_layer.h
@@ -1,3 +1,48 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+
+#ifndef ImageLayerChromium_h
+#define ImageLayerChromium_h
+
+#if USE(ACCELERATED_COMPOSITING)
+
+#include "ContentLayerChromium.h"
+#include "SkBitmap.h"
+
+namespace cc {
+
+class ImageLayerTextureUpdater;
+
+// A Layer that contains only an Image element.
+class ImageLayerChromium : public TiledLayerChromium {
+public:
+ static scoped_refptr<ImageLayerChromium> create();
+
+ virtual bool drawsContent() const OVERRIDE;
+ virtual void setTexturePriorities(const CCPriorityCalculator&) OVERRIDE;
+ virtual void update(CCTextureUpdateQueue&, const CCOcclusionTracker*, CCRenderingStats&) OVERRIDE;
+ virtual bool needsContentsScale() const OVERRIDE;
+
+ void setBitmap(const SkBitmap& image);
+
+private:
+ ImageLayerChromium();
+ virtual ~ImageLayerChromium();
+
+ void setTilingOption(TilingOption);
+
+ virtual LayerTextureUpdater* textureUpdater() const OVERRIDE;
+ virtual void createTextureUpdaterIfNeeded() OVERRIDE;
+ virtual IntSize contentBounds() const OVERRIDE;
+
+ SkBitmap m_bitmap;
+
+ RefPtr<ImageLayerTextureUpdater> m_textureUpdater;
+};
+
+}
+#endif // USE(ACCELERATED_COMPOSITING)
+
+#endif
diff --git a/cc/input_handler.h b/cc/input_handler.h
index 638cbb2..7188cab 100644
--- a/cc/input_handler.h
+++ b/cc/input_handler.h
@@ -1,3 +1,83 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCInputHandler_h
+#define CCInputHandler_h
+
+#include "base/basictypes.h"
+#include <wtf/PassOwnPtr.h>
+
+namespace cc {
+
+class IntPoint;
+class IntSize;
+
+// The CCInputHandler is a way for the embedders to interact with
+// the impl thread side of the compositor implementation.
+//
+// There is one CCInputHandler for every CCLayerTreeHost. It is
+// created on the main thread and used only on the impl thread.
+//
+// The CCInputHandler is constructed with a CCInputHandlerClient, which is the
+// interface by which the handler can manipulate the LayerTree.
+class CCInputHandlerClient {
+public:
+ enum ScrollStatus { ScrollOnMainThread, ScrollStarted, ScrollIgnored };
+ enum ScrollInputType { Gesture, Wheel };
+
+ // Selects a layer to be scrolled at a given point in window coordinates.
+ // Returns ScrollStarted if the layer at the coordinates can be scrolled,
+ // ScrollOnMainThread if the scroll event should instead be delegated to the
+ // main thread, or ScrollIgnored if there is nothing to be scrolled at the
+ // given coordinates.
+ virtual ScrollStatus scrollBegin(const IntPoint&, ScrollInputType) = 0;
+
+ // Scroll the selected layer starting at the given window coordinate. If
+ // there is no room to move the layer in the requested direction, its first
+ // ancestor layer that can be scrolled will be moved instead. Should only be
+ // called if scrollBegin() returned ScrollStarted.
+ virtual void scrollBy(const IntPoint&, const IntSize&) = 0;
+
+ // Stop scrolling the selected layer. Should only be called if scrollBegin()
+ // returned ScrollStarted.
+ virtual void scrollEnd() = 0;
+
+ virtual void pinchGestureBegin() = 0;
+ virtual void pinchGestureUpdate(float magnifyDelta, const IntPoint& anchor) = 0;
+ virtual void pinchGestureEnd() = 0;
+
+ virtual void startPageScaleAnimation(const IntSize& targetPosition,
+ bool anchorPoint,
+ float pageScale,
+ double startTime,
+ double duration) = 0;
+
+ // Request another callback to CCInputHandler::animate().
+ virtual void scheduleAnimation() = 0;
+
+protected:
+ CCInputHandlerClient() { }
+ virtual ~CCInputHandlerClient() { }
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(CCInputHandlerClient);
+};
+
+class CCInputHandler {
+public:
+ virtual ~CCInputHandler() { }
+
+ virtual void bindToClient(CCInputHandlerClient*) = 0;
+ virtual void animate(double monotonicTime) = 0;
+
+protected:
+ CCInputHandler() { }
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(CCInputHandler);
+};
+
+}
+
+#endif
diff --git a/cc/CCIOSurfaceDrawQuad.cpp b/cc/io_surface_draw_quad.cc
index 5d50043..5d50043 100644
--- a/cc/CCIOSurfaceDrawQuad.cpp
+++ b/cc/io_surface_draw_quad.cc
diff --git a/cc/io_surface_draw_quad.h b/cc/io_surface_draw_quad.h
index 638cbb2..bb5b028 100644
--- a/cc/io_surface_draw_quad.h
+++ b/cc/io_surface_draw_quad.h
@@ -1,3 +1,42 @@
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCIOSurfaceDrawQuad_h
+#define CCIOSurfaceDrawQuad_h
+
+#include "CCDrawQuad.h"
+#include "IntSize.h"
+#include "base/memory/scoped_ptr.h"
+
+namespace cc {
+
+#pragma pack(push, 4)
+
+class CCIOSurfaceDrawQuad : public CCDrawQuad {
+public:
+ enum Orientation {
+ Flipped,
+ Unflipped
+ };
+
+ static scoped_ptr<CCIOSurfaceDrawQuad> create(const CCSharedQuadState*, const IntRect&, const IntSize& ioSurfaceSize, unsigned ioSurfaceTextureId, Orientation);
+
+ IntSize ioSurfaceSize() const { return m_ioSurfaceSize; }
+ unsigned ioSurfaceTextureId() const { return m_ioSurfaceTextureId; }
+ Orientation orientation() const { return m_orientation; }
+
+ static const CCIOSurfaceDrawQuad* materialCast(const CCDrawQuad*);
+private:
+ CCIOSurfaceDrawQuad(const CCSharedQuadState*, const IntRect&, const IntSize& ioSurfaceSize, unsigned ioSurfaceTextureId, Orientation);
+
+ IntSize m_ioSurfaceSize;
+ unsigned m_ioSurfaceTextureId;
+ Orientation m_orientation;
+};
+
+#pragma pack(pop)
+
+}
+
+#endif
diff --git a/cc/IOSurfaceLayerChromium.cpp b/cc/io_surface_layer.cc
index fe6d39a..fe6d39a 100644
--- a/cc/IOSurfaceLayerChromium.cpp
+++ b/cc/io_surface_layer.cc
diff --git a/cc/io_surface_layer.h b/cc/io_surface_layer.h
index 638cbb2..f9c4b5f 100644
--- a/cc/io_surface_layer.h
+++ b/cc/io_surface_layer.h
@@ -1,3 +1,38 @@
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+
+#ifndef IOSurfaceLayerChromium_h
+#define IOSurfaceLayerChromium_h
+
+#if USE(ACCELERATED_COMPOSITING)
+
+#include "LayerChromium.h"
+
+namespace cc {
+
+class IOSurfaceLayerChromium : public LayerChromium {
+public:
+ static scoped_refptr<IOSurfaceLayerChromium> create();
+
+ void setIOSurfaceProperties(uint32_t ioSurfaceId, const IntSize&);
+
+ virtual scoped_ptr<CCLayerImpl> createCCLayerImpl() OVERRIDE;
+ virtual bool drawsContent() const OVERRIDE;
+ virtual void pushPropertiesTo(CCLayerImpl*) OVERRIDE;
+
+protected:
+ IOSurfaceLayerChromium();
+
+private:
+ virtual ~IOSurfaceLayerChromium();
+
+ uint32_t m_ioSurfaceId;
+ IntSize m_ioSurfaceSize;
+};
+
+}
+#endif // USE(ACCELERATED_COMPOSITING)
+
+#endif
diff --git a/cc/CCIOSurfaceLayerImpl.cpp b/cc/io_surface_layer_impl.cc
index 689a003..689a003 100644
--- a/cc/CCIOSurfaceLayerImpl.cpp
+++ b/cc/io_surface_layer_impl.cc
diff --git a/cc/io_surface_layer_impl.h b/cc/io_surface_layer_impl.h
index 638cbb2..238e27e 100644
--- a/cc/io_surface_layer_impl.h
+++ b/cc/io_surface_layer_impl.h
@@ -1,3 +1,43 @@
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCIOSurfaceLayerImpl_h
+#define CCIOSurfaceLayerImpl_h
+
+#include "CCLayerImpl.h"
+#include "IntSize.h"
+
+namespace cc {
+
+class CCIOSurfaceLayerImpl : public CCLayerImpl {
+public:
+ static scoped_ptr<CCIOSurfaceLayerImpl> create(int id)
+ {
+ return make_scoped_ptr(new CCIOSurfaceLayerImpl(id));
+ }
+ virtual ~CCIOSurfaceLayerImpl();
+
+ void setIOSurfaceProperties(unsigned ioSurfaceId, const IntSize&);
+
+ virtual void appendQuads(CCQuadSink&, CCAppendQuadsData&) OVERRIDE;
+
+ virtual void willDraw(CCResourceProvider*) OVERRIDE;
+ virtual void didLoseContext() OVERRIDE;
+
+ virtual void dumpLayerProperties(std::string*, int indent) const OVERRIDE;
+
+private:
+ explicit CCIOSurfaceLayerImpl(int);
+
+ virtual const char* layerTypeAsString() const OVERRIDE;
+
+ unsigned m_ioSurfaceId;
+ IntSize m_ioSurfaceSize;
+ bool m_ioSurfaceChanged;
+ unsigned m_ioSurfaceTextureId;
+};
+
+}
+
+#endif // CCIOSurfaceLayerImpl_h
diff --git a/cc/CCKeyframedAnimationCurve.cpp b/cc/keyframed_animation_curve.cc
index a6b368e..a6b368e 100644
--- a/cc/CCKeyframedAnimationCurve.cpp
+++ b/cc/keyframed_animation_curve.cc
diff --git a/cc/keyframed_animation_curve.h b/cc/keyframed_animation_curve.h
index 638cbb2..066e5c6 100644
--- a/cc/keyframed_animation_curve.h
+++ b/cc/keyframed_animation_curve.h
@@ -1,3 +1,109 @@
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCKeyframedAnimationCurve_h
+#define CCKeyframedAnimationCurve_h
+
+#include "CCAnimationCurve.h"
+#include "CCTimingFunction.h"
+#include "scoped_ptr_vector.h"
+#include <public/WebTransformOperations.h>
+
+namespace cc {
+
+class CCKeyframe {
+public:
+ double time() const;
+ const CCTimingFunction* timingFunction() const;
+
+protected:
+ CCKeyframe(double time, scoped_ptr<CCTimingFunction>);
+ virtual ~CCKeyframe();
+
+private:
+ double m_time;
+ scoped_ptr<CCTimingFunction> m_timingFunction;
+};
+
+class CCFloatKeyframe : public CCKeyframe {
+public:
+ static scoped_ptr<CCFloatKeyframe> create(double time, float value, scoped_ptr<CCTimingFunction>);
+ virtual ~CCFloatKeyframe();
+
+ float value() const;
+
+ scoped_ptr<CCFloatKeyframe> clone() const;
+
+private:
+ CCFloatKeyframe(double time, float value, scoped_ptr<CCTimingFunction>);
+
+ float m_value;
+};
+
+class CCTransformKeyframe : public CCKeyframe {
+public:
+ static scoped_ptr<CCTransformKeyframe> create(double time, const WebKit::WebTransformOperations& value, scoped_ptr<CCTimingFunction>);
+ virtual ~CCTransformKeyframe();
+
+ const WebKit::WebTransformOperations& value() const;
+
+ scoped_ptr<CCTransformKeyframe> clone() const;
+
+private:
+ CCTransformKeyframe(double time, const WebKit::WebTransformOperations& value, scoped_ptr<CCTimingFunction>);
+
+ WebKit::WebTransformOperations m_value;
+};
+
+class CCKeyframedFloatAnimationCurve : public CCFloatAnimationCurve {
+public:
+ // It is required that the keyframes be sorted by time.
+ static scoped_ptr<CCKeyframedFloatAnimationCurve> create();
+
+ virtual ~CCKeyframedFloatAnimationCurve();
+
+ void addKeyframe(scoped_ptr<CCFloatKeyframe>);
+
+ // CCAnimationCurve implementation
+ virtual double duration() const OVERRIDE;
+ virtual scoped_ptr<CCAnimationCurve> clone() const OVERRIDE;
+
+ // CCFloatAnimationCurve implementation
+ virtual float getValue(double t) const OVERRIDE;
+
+private:
+ CCKeyframedFloatAnimationCurve();
+
+ // Always sorted in order of increasing time. No two keyframes have the
+ // same time.
+ ScopedPtrVector<CCFloatKeyframe> m_keyframes;
+};
+
+class CCKeyframedTransformAnimationCurve : public CCTransformAnimationCurve {
+public:
+ // It is required that the keyframes be sorted by time.
+ static scoped_ptr<CCKeyframedTransformAnimationCurve> create();
+
+ virtual ~CCKeyframedTransformAnimationCurve();
+
+ void addKeyframe(scoped_ptr<CCTransformKeyframe>);
+
+ // CCAnimationCurve implementation
+ virtual double duration() const OVERRIDE;
+ virtual scoped_ptr<CCAnimationCurve> clone() const OVERRIDE;
+
+ // CCTransformAnimationCurve implementation
+ virtual WebKit::WebTransformationMatrix getValue(double t) const OVERRIDE;
+
+private:
+ CCKeyframedTransformAnimationCurve();
+
+ // Always sorted in order of increasing time. No two keyframes have the
+ // same time.
+ ScopedPtrVector<CCTransformKeyframe> m_keyframes;
+};
+
+} // namespace cc
+
+#endif // CCKeyframedAnimationCurve_h
diff --git a/cc/LayerChromium.cpp b/cc/layer.cc
index dc3bd67..dc3bd67 100644
--- a/cc/LayerChromium.cpp
+++ b/cc/layer.cc
diff --git a/cc/layer.h b/cc/layer.h
index 638cbb2..a87caa0 100644
--- a/cc/layer.h
+++ b/cc/layer.h
@@ -1,3 +1,390 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+
+#ifndef LayerChromium_h
+#define LayerChromium_h
+
+#if USE(ACCELERATED_COMPOSITING)
+
+#include "base/memory/ref_counted.h"
+#include "CCLayerAnimationController.h"
+#include "CCOcclusionTracker.h"
+#include "FloatPoint.h"
+#include "Region.h"
+#include "RenderSurfaceChromium.h"
+#include "SkColor.h"
+#include <public/WebFilterOperations.h>
+#include <public/WebTransformationMatrix.h>
+#include <string>
+#include <vector>
+
+namespace WebKit {
+class WebAnimationDelegate;
+class WebLayerScrollClient;
+}
+
+namespace cc {
+
+class CCActiveAnimation;
+struct CCAnimationEvent;
+class CCLayerAnimationDelegate;
+class CCLayerImpl;
+class CCLayerTreeHost;
+class CCPriorityCalculator;
+class CCTextureUpdateQueue;
+class ScrollbarLayerChromium;
+struct CCAnimationEvent;
+struct CCRenderingStats;
+
+// Base class for composited layers. Special layer types are derived from
+// this class.
+class LayerChromium : public base::RefCounted<LayerChromium>, public CCLayerAnimationControllerClient {
+public:
+ typedef std::vector<scoped_refptr<LayerChromium> > LayerList;
+
+ static scoped_refptr<LayerChromium> create();
+
+ // CCLayerAnimationControllerClient implementation
+ virtual int id() const OVERRIDE;
+ virtual void setOpacityFromAnimation(float) OVERRIDE;
+ virtual float opacity() const OVERRIDE;
+ virtual void setTransformFromAnimation(const WebKit::WebTransformationMatrix&) OVERRIDE;
+ // A layer's transform operates layer space. That is, entirely in logical,
+ // non-page-scaled pixels (that is, they have page zoom baked in, but not page scale).
+ // The root layer is a special case -- it operates in physical pixels.
+ virtual const WebKit::WebTransformationMatrix& transform() const OVERRIDE;
+
+ LayerChromium* rootLayer();
+ LayerChromium* parent() const;
+ void addChild(scoped_refptr<LayerChromium>);
+ void insertChild(scoped_refptr<LayerChromium>, size_t index);
+ void replaceChild(LayerChromium* reference, scoped_refptr<LayerChromium> newLayer);
+ void removeFromParent();
+ void removeAllChildren();
+ void setChildren(const LayerList&);
+
+ const LayerList& children() const { return m_children; }
+
+ void setAnchorPoint(const FloatPoint&);
+ FloatPoint anchorPoint() const { return m_anchorPoint; }
+
+ void setAnchorPointZ(float);
+ float anchorPointZ() const { return m_anchorPointZ; }
+
+ void setBackgroundColor(SkColor);
+ SkColor backgroundColor() const { return m_backgroundColor; }
+
+ // A layer's bounds are in logical, non-page-scaled pixels (however, the
+ // root layer's bounds are in physical pixels).
+ void setBounds(const IntSize&);
+ const IntSize& bounds() const { return m_bounds; }
+ virtual IntSize contentBounds() const;
+
+ void setMasksToBounds(bool);
+ bool masksToBounds() const { return m_masksToBounds; }
+
+ void setMaskLayer(LayerChromium*);
+ LayerChromium* maskLayer() const { return m_maskLayer.get(); }
+
+ virtual void setNeedsDisplayRect(const FloatRect& dirtyRect);
+ void setNeedsDisplay() { setNeedsDisplayRect(FloatRect(FloatPoint(), bounds())); }
+ virtual bool needsDisplay() const;
+
+ void setOpacity(float);
+ bool opacityIsAnimating() const;
+
+ void setFilters(const WebKit::WebFilterOperations&);
+ const WebKit::WebFilterOperations& filters() const { return m_filters; }
+
+ // Background filters are filters applied to what is behind this layer, when they are viewed through non-opaque
+ // regions in this layer. They are used through the WebLayer interface, and are not exposed to HTML.
+ void setBackgroundFilters(const WebKit::WebFilterOperations&);
+ const WebKit::WebFilterOperations& backgroundFilters() const { return m_backgroundFilters; }
+
+ virtual void setContentsOpaque(bool);
+ bool contentsOpaque() const { return m_contentsOpaque; }
+
+ void setPosition(const FloatPoint&);
+ FloatPoint position() const { return m_position; }
+
+ void setIsContainerForFixedPositionLayers(bool);
+ bool isContainerForFixedPositionLayers() const { return m_isContainerForFixedPositionLayers; }
+
+ void setFixedToContainerLayer(bool);
+ bool fixedToContainerLayer() const { return m_fixedToContainerLayer; }
+
+ void setSublayerTransform(const WebKit::WebTransformationMatrix&);
+ const WebKit::WebTransformationMatrix& sublayerTransform() const { return m_sublayerTransform; }
+
+ void setTransform(const WebKit::WebTransformationMatrix&);
+ bool transformIsAnimating() const;
+
+ const IntRect& visibleContentRect() const { return m_visibleContentRect; }
+ void setVisibleContentRect(const IntRect& visibleContentRect) { m_visibleContentRect = visibleContentRect; }
+
+ void setScrollPosition(const IntPoint&);
+ const IntPoint& scrollPosition() const { return m_scrollPosition; }
+
+ void setMaxScrollPosition(const IntSize&);
+ const IntSize& maxScrollPosition() const { return m_maxScrollPosition; }
+
+ void setScrollable(bool);
+ bool scrollable() const { return m_scrollable; }
+
+ void setShouldScrollOnMainThread(bool);
+ bool shouldScrollOnMainThread() const { return m_shouldScrollOnMainThread; }
+
+ void setHaveWheelEventHandlers(bool);
+ bool haveWheelEventHandlers() const { return m_haveWheelEventHandlers; }
+
+ void setNonFastScrollableRegion(const Region&);
+ void setNonFastScrollableRegionChanged() { m_nonFastScrollableRegionChanged = true; }
+ const Region& nonFastScrollableRegion() const { return m_nonFastScrollableRegion; }
+
+ void setLayerScrollClient(WebKit::WebLayerScrollClient* layerScrollClient) { m_layerScrollClient = layerScrollClient; }
+
+ void setDrawCheckerboardForMissingTiles(bool);
+ bool drawCheckerboardForMissingTiles() const { return m_drawCheckerboardForMissingTiles; }
+
+ bool forceRenderSurface() const { return m_forceRenderSurface; }
+ void setForceRenderSurface(bool);
+
+ IntSize scrollDelta() const { return IntSize(); }
+
+ void setImplTransform(const WebKit::WebTransformationMatrix&);
+ const WebKit::WebTransformationMatrix& implTransform() const { return m_implTransform; }
+
+ void setDoubleSided(bool);
+ bool doubleSided() const { return m_doubleSided; }
+
+ void setPreserves3D(bool preserve3D) { m_preserves3D = preserve3D; }
+ bool preserves3D() const { return m_preserves3D; }
+
+ void setUseParentBackfaceVisibility(bool useParentBackfaceVisibility) { m_useParentBackfaceVisibility = useParentBackfaceVisibility; }
+ bool useParentBackfaceVisibility() const { return m_useParentBackfaceVisibility; }
+
+ virtual void setUseLCDText(bool);
+ bool useLCDText() const { return m_useLCDText; }
+
+ virtual void setLayerTreeHost(CCLayerTreeHost*);
+
+ bool hasContributingDelegatedRenderPasses() const { return false; }
+
+ void setIsDrawable(bool);
+
+ void setReplicaLayer(LayerChromium*);
+ LayerChromium* replicaLayer() const { return m_replicaLayer.get(); }
+
+ bool hasMask() const { return m_maskLayer; }
+ bool hasReplica() const { return m_replicaLayer; }
+ bool replicaHasMask() const { return m_replicaLayer && (m_maskLayer || m_replicaLayer->m_maskLayer); }
+
+ // These methods typically need to be overwritten by derived classes.
+ virtual bool drawsContent() const;
+ virtual void update(CCTextureUpdateQueue&, const CCOcclusionTracker*, CCRenderingStats&) { }
+ virtual bool needMoreUpdates();
+ virtual void setIsMask(bool) { }
+ virtual void bindContentsTexture() { }
+ virtual bool needsContentsScale() const;
+
+ void setDebugBorderColor(SkColor);
+ void setDebugBorderWidth(float);
+ void setDebugName(const std::string&);
+
+ virtual void pushPropertiesTo(CCLayerImpl*);
+
+ void clearRenderSurface() { m_renderSurface.reset(); }
+ RenderSurfaceChromium* renderSurface() const { return m_renderSurface.get(); }
+ void createRenderSurface();
+
+ float drawOpacity() const { return m_drawOpacity; }
+ void setDrawOpacity(float opacity) { m_drawOpacity = opacity; }
+
+ bool drawOpacityIsAnimating() const { return m_drawOpacityIsAnimating; }
+ void setDrawOpacityIsAnimating(bool drawOpacityIsAnimating) { m_drawOpacityIsAnimating = drawOpacityIsAnimating; }
+
+ LayerChromium* renderTarget() const { ASSERT(!m_renderTarget || m_renderTarget->renderSurface()); return m_renderTarget; }
+ void setRenderTarget(LayerChromium* target) { m_renderTarget = target; }
+
+ bool drawTransformIsAnimating() const { return m_drawTransformIsAnimating; }
+ void setDrawTransformIsAnimating(bool animating) { m_drawTransformIsAnimating = animating; }
+ bool screenSpaceTransformIsAnimating() const { return m_screenSpaceTransformIsAnimating; }
+ void setScreenSpaceTransformIsAnimating(bool animating) { m_screenSpaceTransformIsAnimating = animating; }
+
+ // This moves from layer space, with origin in the center to target space with origin in the top left.
+ // That is, it converts from logical, non-page-scaled, to target pixels (and if the target is the
+ // root render surface, then this converts to physical pixels).
+ const WebKit::WebTransformationMatrix& drawTransform() const { return m_drawTransform; }
+ void setDrawTransform(const WebKit::WebTransformationMatrix& matrix) { m_drawTransform = matrix; }
+ // This moves from content space, with origin the top left to screen space with origin in the top left.
+ // It converts logical, non-page-scaled pixels to physical pixels.
+ const WebKit::WebTransformationMatrix& screenSpaceTransform() const { return m_screenSpaceTransform; }
+ void setScreenSpaceTransform(const WebKit::WebTransformationMatrix& matrix) { m_screenSpaceTransform = matrix; }
+ const IntRect& drawableContentRect() const { return m_drawableContentRect; }
+ void setDrawableContentRect(const IntRect& rect) { m_drawableContentRect = rect; }
+ // The contentsScale converts from logical, non-page-scaled pixels to target pixels.
+ // The contentsScale is 1 for the root layer as it is already in physical pixels.
+ float contentsScale() const { return m_contentsScale; }
+ void setContentsScale(float);
+
+ // When true, the layer's contents are not scaled by the current page scale factor.
+ // setBoundsContainPageScale recursively sets the value on all child layers.
+ void setBoundsContainPageScale(bool);
+ bool boundsContainPageScale() const { return m_boundsContainPageScale; }
+
+ // Returns true if any of the layer's descendants has content to draw.
+ bool descendantDrawsContent();
+
+ CCLayerTreeHost* layerTreeHost() const { return m_layerTreeHost; }
+
+ // Set the priority of all desired textures in this layer.
+ virtual void setTexturePriorities(const CCPriorityCalculator&) { }
+
+ bool addAnimation(scoped_ptr<CCActiveAnimation>);
+ void pauseAnimation(int animationId, double timeOffset);
+ void removeAnimation(int animationId);
+
+ void suspendAnimations(double monotonicTime);
+ void resumeAnimations(double monotonicTime);
+
+ CCLayerAnimationController* layerAnimationController() { return m_layerAnimationController.get(); }
+ void setLayerAnimationController(scoped_ptr<CCLayerAnimationController>);
+ scoped_ptr<CCLayerAnimationController> releaseLayerAnimationController();
+
+ void setLayerAnimationDelegate(WebKit::WebAnimationDelegate* layerAnimationDelegate) { m_layerAnimationDelegate = layerAnimationDelegate; }
+
+ bool hasActiveAnimation() const;
+
+ virtual void notifyAnimationStarted(const CCAnimationEvent&, double wallClockTime);
+ virtual void notifyAnimationFinished(double wallClockTime);
+
+ virtual Region visibleContentOpaqueRegion() const;
+
+ virtual ScrollbarLayerChromium* toScrollbarLayerChromium();
+
+protected:
+ friend class CCLayerImpl;
+ friend class TreeSynchronizer;
+ virtual ~LayerChromium();
+
+ LayerChromium();
+
+ void setNeedsCommit();
+
+ IntRect layerRectToContentRect(const WebKit::WebRect& layerRect);
+
+ // This flag is set when layer need repainting/updating.
+ bool m_needsDisplay;
+
+ // Tracks whether this layer may have changed stacking order with its siblings.
+ bool m_stackingOrderChanged;
+
+ // The update rect is the region of the compositor resource that was actually updated by the compositor.
+ // For layers that may do updating outside the compositor's control (i.e. plugin layers), this information
+ // is not available and the update rect will remain empty.
+ // Note this rect is in layer space (not content space).
+ FloatRect m_updateRect;
+
+ scoped_refptr<LayerChromium> m_maskLayer;
+
+ // Constructs a CCLayerImpl of the correct runtime type for this LayerChromium type.
+ virtual scoped_ptr<CCLayerImpl> createCCLayerImpl();
+ int m_layerId;
+
+private:
+ friend class base::RefCounted<LayerChromium>;
+
+ void setParent(LayerChromium*);
+ bool hasAncestor(LayerChromium*) const;
+ bool descendantIsFixedToContainerLayer() const;
+
+ size_t numChildren() const { return m_children.size(); }
+
+ // Returns the index of the child or -1 if not found.
+ int indexOfChild(const LayerChromium*);
+
+ // This should only be called from removeFromParent.
+ void removeChild(LayerChromium*);
+
+ LayerList m_children;
+ LayerChromium* m_parent;
+
+ // LayerChromium instances have a weak pointer to their CCLayerTreeHost.
+ // This pointer value is nil when a LayerChromium is not in a tree and is
+ // updated via setLayerTreeHost() if a layer moves between trees.
+ CCLayerTreeHost* m_layerTreeHost;
+
+ scoped_ptr<CCLayerAnimationController> m_layerAnimationController;
+
+ // Layer properties.
+ IntSize m_bounds;
+
+ // Uses layer's content space.
+ IntRect m_visibleContentRect;
+
+ IntPoint m_scrollPosition;
+ IntSize m_maxScrollPosition;
+ bool m_scrollable;
+ bool m_shouldScrollOnMainThread;
+ bool m_haveWheelEventHandlers;
+ Region m_nonFastScrollableRegion;
+ bool m_nonFastScrollableRegionChanged;
+ FloatPoint m_position;
+ FloatPoint m_anchorPoint;
+ SkColor m_backgroundColor;
+ SkColor m_debugBorderColor;
+ float m_debugBorderWidth;
+ std::string m_debugName;
+ float m_opacity;
+ WebKit::WebFilterOperations m_filters;
+ WebKit::WebFilterOperations m_backgroundFilters;
+ float m_anchorPointZ;
+ bool m_isContainerForFixedPositionLayers;
+ bool m_fixedToContainerLayer;
+ bool m_isDrawable;
+ bool m_masksToBounds;
+ bool m_contentsOpaque;
+ bool m_doubleSided;
+ bool m_useLCDText;
+ bool m_preserves3D;
+ bool m_useParentBackfaceVisibility;
+ bool m_drawCheckerboardForMissingTiles;
+ bool m_forceRenderSurface;
+
+ WebKit::WebTransformationMatrix m_transform;
+ WebKit::WebTransformationMatrix m_sublayerTransform;
+
+ // Replica layer used for reflections.
+ scoped_refptr<LayerChromium> m_replicaLayer;
+
+ // Transient properties.
+ scoped_ptr<RenderSurfaceChromium> m_renderSurface;
+ float m_drawOpacity;
+ bool m_drawOpacityIsAnimating;
+
+ LayerChromium* m_renderTarget;
+
+ WebKit::WebTransformationMatrix m_drawTransform;
+ WebKit::WebTransformationMatrix m_screenSpaceTransform;
+ bool m_drawTransformIsAnimating;
+ bool m_screenSpaceTransformIsAnimating;
+
+ // Uses target surface space.
+ IntRect m_drawableContentRect;
+ float m_contentsScale;
+ bool m_boundsContainPageScale;
+
+ WebKit::WebTransformationMatrix m_implTransform;
+
+ WebKit::WebAnimationDelegate* m_layerAnimationDelegate;
+ WebKit::WebLayerScrollClient* m_layerScrollClient;
+};
+
+void sortLayers(std::vector<scoped_refptr<LayerChromium> >::iterator, std::vector<scoped_refptr<LayerChromium> >::iterator, void*);
+
+}
+#endif // USE(ACCELERATED_COMPOSITING)
+
+#endif
diff --git a/cc/CCLayerAnimationController.cpp b/cc/layer_animation_controller.cc
index 2025db8..2025db8 100644
--- a/cc/CCLayerAnimationController.cpp
+++ b/cc/layer_animation_controller.cc
diff --git a/cc/layer_animation_controller.h b/cc/layer_animation_controller.h
index 638cbb2..2fdb91c 100644
--- a/cc/layer_animation_controller.h
+++ b/cc/layer_animation_controller.h
@@ -1,3 +1,112 @@
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCLayerAnimationController_h
+#define CCLayerAnimationController_h
+
+#include "CCAnimationEvents.h"
+
+#include "base/basictypes.h"
+#include "base/hash_tables.h"
+#include "base/memory/scoped_ptr.h"
+#include "cc/scoped_ptr_vector.h"
+
+namespace WebKit {
+class WebTransformationMatrix;
+}
+
+namespace cc {
+
+class Animation;
+class IntSize;
+class KeyframeValueList;
+
+class CCLayerAnimationControllerClient {
+public:
+ virtual ~CCLayerAnimationControllerClient() { }
+
+ virtual int id() const = 0;
+ virtual void setOpacityFromAnimation(float) = 0;
+ virtual float opacity() const = 0;
+ virtual void setTransformFromAnimation(const WebKit::WebTransformationMatrix&) = 0;
+ virtual const WebKit::WebTransformationMatrix& transform() const = 0;
+};
+
+class CCLayerAnimationController {
+public:
+ static scoped_ptr<CCLayerAnimationController> create(CCLayerAnimationControllerClient*);
+
+ virtual ~CCLayerAnimationController();
+
+ // These methods are virtual for testing.
+ virtual void addAnimation(scoped_ptr<CCActiveAnimation>);
+ virtual void pauseAnimation(int animationId, double timeOffset);
+ virtual void removeAnimation(int animationId);
+ virtual void removeAnimation(int animationId, CCActiveAnimation::TargetProperty);
+ virtual void suspendAnimations(double monotonicTime);
+ virtual void resumeAnimations(double monotonicTime);
+
+ // Ensures that the list of active animations on the main thread and the impl thread
+ // are kept in sync. This function does not take ownership of the impl thread controller.
+ virtual void pushAnimationUpdatesTo(CCLayerAnimationController*);
+
+ void animate(double monotonicTime, CCAnimationEventsVector*);
+
+ // Returns the active animation in the given group, animating the given property, if such an
+ // animation exists.
+ CCActiveAnimation* getActiveAnimation(int groupId, CCActiveAnimation::TargetProperty) const;
+
+ // Returns the active animation animating the given property that is either running, or is
+ // next to run, if such an animation exists.
+ CCActiveAnimation* getActiveAnimation(CCActiveAnimation::TargetProperty) const;
+
+ // Returns true if there are any animations that have neither finished nor aborted.
+ bool hasActiveAnimation() const;
+
+ // Returns true if there is an animation currently animating the given property, or
+ // if there is an animation scheduled to animate this property in the future.
+ bool isAnimatingProperty(CCActiveAnimation::TargetProperty) const;
+
+ // This is called in response to an animation being started on the impl thread. This
+ // function updates the corresponding main thread animation's start time.
+ void notifyAnimationStarted(const CCAnimationEvent&);
+
+ // If a sync is forced, then the next time animation updates are pushed to the impl
+ // thread, all animations will be transferred.
+ void setForceSync() { m_forceSync = true; }
+
+ void setClient(CCLayerAnimationControllerClient*);
+
+protected:
+ explicit CCLayerAnimationController(CCLayerAnimationControllerClient*);
+
+private:
+ typedef base::hash_set<int> TargetProperties;
+
+ void pushNewAnimationsToImplThread(CCLayerAnimationController*) const;
+ void removeAnimationsCompletedOnMainThread(CCLayerAnimationController*) const;
+ void pushPropertiesToImplThread(CCLayerAnimationController*) const;
+ void replaceImplThreadAnimations(CCLayerAnimationController*) const;
+
+ void startAnimationsWaitingForNextTick(double monotonicTime, CCAnimationEventsVector*);
+ void startAnimationsWaitingForStartTime(double monotonicTime, CCAnimationEventsVector*);
+ void startAnimationsWaitingForTargetAvailability(double monotonicTime, CCAnimationEventsVector*);
+ void resolveConflicts(double monotonicTime);
+ void markAnimationsForDeletion(double monotonicTime, CCAnimationEventsVector*);
+ void purgeAnimationsMarkedForDeletion();
+
+ void tickAnimations(double monotonicTime);
+
+ // If this is true, we force a sync to the impl thread.
+ bool m_forceSync;
+
+ CCLayerAnimationControllerClient* m_client;
+ ScopedPtrVector<CCActiveAnimation> m_activeAnimations;
+
+ DISALLOW_COPY_AND_ASSIGN(CCLayerAnimationController);
+};
+
+} // namespace cc
+
+#endif // CCLayerAnimationController_h
diff --git a/cc/CCLayerImpl.cpp b/cc/layer_impl.cc
index 16c9356..16c9356 100644
--- a/cc/CCLayerImpl.cpp
+++ b/cc/layer_impl.cc
diff --git a/cc/layer_impl.h b/cc/layer_impl.h
index 638cbb2..e34ccc8 100644
--- a/cc/layer_impl.h
+++ b/cc/layer_impl.h
@@ -1,3 +1,399 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCLayerImpl_h
+#define CCLayerImpl_h
+
+#include "base/memory/scoped_ptr.h"
+#include "cc/scoped_ptr_vector.h"
+#include "CCInputHandler.h"
+#include "CCLayerAnimationController.h"
+#include "CCRenderPass.h"
+#include "CCRenderSurface.h"
+#include "CCResourceProvider.h"
+#include "CCSharedQuadState.h"
+#include "FloatRect.h"
+#include "IntRect.h"
+#include "Region.h"
+#include "SkColor.h"
+#include <public/WebFilterOperations.h>
+#include <public/WebTransformationMatrix.h>
+#include <string>
+#include <wtf/OwnPtr.h>
+
+namespace cc {
+
+class CCLayerSorter;
+class CCLayerTreeHostImpl;
+class CCQuadSink;
+class CCRenderer;
+class CCScrollbarAnimationController;
+class CCScrollbarLayerImpl;
+class LayerChromium;
+
+struct CCAppendQuadsData;
+
+class CCLayerImpl : public CCLayerAnimationControllerClient {
+public:
+ static scoped_ptr<CCLayerImpl> create(int id)
+ {
+ return make_scoped_ptr(new CCLayerImpl(id));
+ }
+
+ virtual ~CCLayerImpl();
+
+ // CCLayerAnimationControllerClient implementation.
+ virtual int id() const OVERRIDE;
+ virtual void setOpacityFromAnimation(float) OVERRIDE;
+ virtual float opacity() const OVERRIDE;
+ virtual void setTransformFromAnimation(const WebKit::WebTransformationMatrix&) OVERRIDE;
+ virtual const WebKit::WebTransformationMatrix& transform() const OVERRIDE;
+
+ // Tree structure.
+ CCLayerImpl* parent() const { return m_parent; }
+ const ScopedPtrVector<CCLayerImpl>& children() const { return m_children; }
+ void addChild(scoped_ptr<CCLayerImpl>);
+ void removeFromParent();
+ void removeAllChildren();
+
+ void setMaskLayer(scoped_ptr<CCLayerImpl>);
+ CCLayerImpl* maskLayer() const { return m_maskLayer.get(); }
+
+ void setReplicaLayer(scoped_ptr<CCLayerImpl>);
+ CCLayerImpl* replicaLayer() const { return m_replicaLayer.get(); }
+
+ bool hasMask() const { return m_maskLayer; }
+ bool hasReplica() const { return m_replicaLayer; }
+ bool replicaHasMask() const { return m_replicaLayer && (m_maskLayer || m_replicaLayer->m_maskLayer); }
+
+ CCLayerTreeHostImpl* layerTreeHostImpl() const { return m_layerTreeHostImpl; }
+ void setLayerTreeHostImpl(CCLayerTreeHostImpl* hostImpl) { m_layerTreeHostImpl = hostImpl; }
+
+ scoped_ptr<CCSharedQuadState> createSharedQuadState() const;
+ // willDraw must be called before appendQuads. If willDraw is called,
+ // didDraw is guaranteed to be called before another willDraw or before
+ // the layer is destroyed. To enforce this, any class that overrides
+ // willDraw/didDraw must call the base class version.
+ virtual void willDraw(CCResourceProvider*);
+ virtual void appendQuads(CCQuadSink&, CCAppendQuadsData&) { }
+ virtual void didDraw(CCResourceProvider*);
+
+ virtual CCResourceProvider::ResourceId contentsResourceId() const;
+
+ virtual bool hasContributingDelegatedRenderPasses() const;
+ virtual CCRenderPass::Id firstContributingRenderPassId() const;
+ virtual CCRenderPass::Id nextContributingRenderPassId(CCRenderPass::Id) const;
+
+ // Returns true if this layer has content to draw.
+ void setDrawsContent(bool);
+ bool drawsContent() const { return m_drawsContent; }
+
+ bool forceRenderSurface() const { return m_forceRenderSurface; }
+ void setForceRenderSurface(bool force) { m_forceRenderSurface = force; }
+
+ // Returns true if any of the layer's descendants has content to draw.
+ virtual bool descendantDrawsContent();
+
+ void setAnchorPoint(const FloatPoint&);
+ const FloatPoint& anchorPoint() const { return m_anchorPoint; }
+
+ void setAnchorPointZ(float);
+ float anchorPointZ() const { return m_anchorPointZ; }
+
+ void setBackgroundColor(SkColor);
+ SkColor backgroundColor() const { return m_backgroundColor; }
+
+ void setFilters(const WebKit::WebFilterOperations&);
+ const WebKit::WebFilterOperations& filters() const { return m_filters; }
+
+ void setBackgroundFilters(const WebKit::WebFilterOperations&);
+ const WebKit::WebFilterOperations& backgroundFilters() const { return m_backgroundFilters; }
+
+ void setMasksToBounds(bool);
+ bool masksToBounds() const { return m_masksToBounds; }
+
+ void setContentsOpaque(bool);
+ bool contentsOpaque() const { return m_contentsOpaque; }
+
+ void setOpacity(float);
+ bool opacityIsAnimating() const;
+
+ void setPosition(const FloatPoint&);
+ const FloatPoint& position() const { return m_position; }
+
+ void setIsContainerForFixedPositionLayers(bool isContainerForFixedPositionLayers) { m_isContainerForFixedPositionLayers = isContainerForFixedPositionLayers; }
+ bool isContainerForFixedPositionLayers() const { return m_isContainerForFixedPositionLayers; }
+
+ void setFixedToContainerLayer(bool fixedToContainerLayer = true) { m_fixedToContainerLayer = fixedToContainerLayer;}
+ bool fixedToContainerLayer() const { return m_fixedToContainerLayer; }
+
+ void setPreserves3D(bool);
+ bool preserves3D() const { return m_preserves3D; }
+
+ void setUseParentBackfaceVisibility(bool useParentBackfaceVisibility) { m_useParentBackfaceVisibility = useParentBackfaceVisibility; }
+ bool useParentBackfaceVisibility() const { return m_useParentBackfaceVisibility; }
+
+ void setUseLCDText(bool useLCDText) { m_useLCDText = useLCDText; }
+ bool useLCDText() const { return m_useLCDText; }
+
+ void setSublayerTransform(const WebKit::WebTransformationMatrix&);
+ const WebKit::WebTransformationMatrix& sublayerTransform() const { return m_sublayerTransform; }
+
+ // Debug layer border - visual effect only, do not change geometry/clipping/etc.
+ void setDebugBorderColor(SkColor);
+ SkColor debugBorderColor() const { return m_debugBorderColor; }
+ void setDebugBorderWidth(float);
+ float debugBorderWidth() const { return m_debugBorderWidth; }
+ bool hasDebugBorders() const;
+
+ // Debug layer name.
+ void setDebugName(const std::string& debugName) { m_debugName = debugName; }
+ std::string debugName() const { return m_debugName; }
+
+ CCRenderSurface* renderSurface() const { return m_renderSurface.get(); }
+ void createRenderSurface();
+ void clearRenderSurface() { m_renderSurface.clear(); }
+
+ float drawOpacity() const { return m_drawOpacity; }
+ void setDrawOpacity(float opacity) { m_drawOpacity = opacity; }
+
+ bool drawOpacityIsAnimating() const { return m_drawOpacityIsAnimating; }
+ void setDrawOpacityIsAnimating(bool drawOpacityIsAnimating) { m_drawOpacityIsAnimating = drawOpacityIsAnimating; }
+
+ CCLayerImpl* renderTarget() const { ASSERT(!m_renderTarget || m_renderTarget->renderSurface()); return m_renderTarget; }
+ void setRenderTarget(CCLayerImpl* target) { m_renderTarget = target; }
+
+ void setBounds(const IntSize&);
+ const IntSize& bounds() const { return m_bounds; }
+
+ const IntSize& contentBounds() const { return m_contentBounds; }
+ void setContentBounds(const IntSize&);
+
+ const IntPoint& scrollPosition() const { return m_scrollPosition; }
+ void setScrollPosition(const IntPoint&);
+
+ const IntSize& maxScrollPosition() const {return m_maxScrollPosition; }
+ void setMaxScrollPosition(const IntSize&);
+
+ const FloatSize& scrollDelta() const { return m_scrollDelta; }
+ void setScrollDelta(const FloatSize&);
+
+ const WebKit::WebTransformationMatrix& implTransform() const { return m_implTransform; }
+ void setImplTransform(const WebKit::WebTransformationMatrix& transform);
+
+ const IntSize& sentScrollDelta() const { return m_sentScrollDelta; }
+ void setSentScrollDelta(const IntSize& sentScrollDelta) { m_sentScrollDelta = sentScrollDelta; }
+
+ // Returns the delta of the scroll that was outside of the bounds of the initial scroll
+ FloatSize scrollBy(const FloatSize& scroll);
+
+ bool scrollable() const { return m_scrollable; }
+ void setScrollable(bool scrollable) { m_scrollable = scrollable; }
+
+ bool shouldScrollOnMainThread() const { return m_shouldScrollOnMainThread; }
+ void setShouldScrollOnMainThread(bool shouldScrollOnMainThread) { m_shouldScrollOnMainThread = shouldScrollOnMainThread; }
+
+ bool haveWheelEventHandlers() const { return m_haveWheelEventHandlers; }
+ void setHaveWheelEventHandlers(bool haveWheelEventHandlers) { m_haveWheelEventHandlers = haveWheelEventHandlers; }
+
+ const Region& nonFastScrollableRegion() const { return m_nonFastScrollableRegion; }
+ void setNonFastScrollableRegion(const Region& region) { m_nonFastScrollableRegion = region; }
+
+ void setDrawCheckerboardForMissingTiles(bool checkerboard) { m_drawCheckerboardForMissingTiles = checkerboard; }
+ bool drawCheckerboardForMissingTiles() const;
+
+ CCInputHandlerClient::ScrollStatus tryScroll(const IntPoint& viewportPoint, CCInputHandlerClient::ScrollInputType) const;
+
+ const IntRect& visibleContentRect() const { return m_visibleContentRect; }
+ void setVisibleContentRect(const IntRect& visibleContentRect) { m_visibleContentRect = visibleContentRect; }
+
+ bool doubleSided() const { return m_doubleSided; }
+ void setDoubleSided(bool);
+
+ void setTransform(const WebKit::WebTransformationMatrix&);
+ bool transformIsAnimating() const;
+
+ const WebKit::WebTransformationMatrix& drawTransform() const { return m_drawTransform; }
+ void setDrawTransform(const WebKit::WebTransformationMatrix& matrix) { m_drawTransform = matrix; }
+ const WebKit::WebTransformationMatrix& screenSpaceTransform() const { return m_screenSpaceTransform; }
+ void setScreenSpaceTransform(const WebKit::WebTransformationMatrix& matrix) { m_screenSpaceTransform = matrix; }
+
+ bool drawTransformIsAnimating() const { return m_drawTransformIsAnimating; }
+ void setDrawTransformIsAnimating(bool animating) { m_drawTransformIsAnimating = animating; }
+ bool screenSpaceTransformIsAnimating() const { return m_screenSpaceTransformIsAnimating; }
+ void setScreenSpaceTransformIsAnimating(bool animating) { m_screenSpaceTransformIsAnimating = animating; }
+
+ const IntRect& drawableContentRect() const { return m_drawableContentRect; }
+ void setDrawableContentRect(const IntRect& rect) { m_drawableContentRect = rect; }
+ const FloatRect& updateRect() const { return m_updateRect; }
+ void setUpdateRect(const FloatRect& updateRect) { m_updateRect = updateRect; }
+
+ std::string layerTreeAsText() const;
+
+ void setStackingOrderChanged(bool);
+
+ bool layerPropertyChanged() const { return m_layerPropertyChanged || layerIsAlwaysDamaged(); }
+ bool layerSurfacePropertyChanged() const;
+
+ void resetAllChangeTrackingForSubtree();
+
+ virtual bool layerIsAlwaysDamaged() const;
+
+ CCLayerAnimationController* layerAnimationController() { return m_layerAnimationController.get(); }
+
+ virtual Region visibleContentOpaqueRegion() const;
+
+ // Indicates that the context previously used to render this layer
+ // was lost and that a new one has been created. Won't be called
+ // until the new context has been created successfully.
+ virtual void didLoseContext();
+
+ CCScrollbarAnimationController* scrollbarAnimationController() const { return m_scrollbarAnimationController.get(); }
+
+ CCScrollbarLayerImpl* horizontalScrollbarLayer() const;
+ void setHorizontalScrollbarLayer(CCScrollbarLayerImpl*);
+
+ CCScrollbarLayerImpl* verticalScrollbarLayer() const;
+ void setVerticalScrollbarLayer(CCScrollbarLayerImpl*);
+
+protected:
+ explicit CCLayerImpl(int);
+
+ void appendDebugBorderQuad(CCQuadSink&, const CCSharedQuadState*, CCAppendQuadsData&) const;
+
+ IntRect layerRectToContentRect(const WebKit::WebRect& layerRect);
+
+ virtual void dumpLayerProperties(std::string*, int indent) const;
+ static std::string indentString(int indent);
+
+private:
+ void setParent(CCLayerImpl* parent) { m_parent = parent; }
+ friend class TreeSynchronizer;
+ void clearChildList(); // Warning: This does not preserve tree structure invariants and so is only exposed to the tree synchronizer.
+
+ void noteLayerPropertyChangedForSubtree();
+
+ // Note carefully this does not affect the current layer.
+ void noteLayerPropertyChangedForDescendants();
+
+ virtual const char* layerTypeAsString() const;
+
+ void dumpLayer(std::string*, int indent) const;
+
+ // Properties internal to CCLayerImpl
+ CCLayerImpl* m_parent;
+ ScopedPtrVector<CCLayerImpl> m_children;
+ // m_maskLayer can be temporarily stolen during tree sync, we need this ID to confirm newly assigned layer is still the previous one
+ int m_maskLayerId;
+ scoped_ptr<CCLayerImpl> m_maskLayer;
+ int m_replicaLayerId; // ditto
+ scoped_ptr<CCLayerImpl> m_replicaLayer;
+ int m_layerId;
+ CCLayerTreeHostImpl* m_layerTreeHostImpl;
+
+ // Properties synchronized from the associated LayerChromium.
+ FloatPoint m_anchorPoint;
+ float m_anchorPointZ;
+ IntSize m_bounds;
+ IntSize m_contentBounds;
+ IntPoint m_scrollPosition;
+ bool m_scrollable;
+ bool m_shouldScrollOnMainThread;
+ bool m_haveWheelEventHandlers;
+ Region m_nonFastScrollableRegion;
+ SkColor m_backgroundColor;
+
+ // Whether the "back" of this layer should draw.
+ bool m_doubleSided;
+
+ // Tracks if drawing-related properties have changed since last redraw.
+ bool m_layerPropertyChanged;
+
+ // Indicates that a property has changed on this layer that would not
+ // affect the pixels on its target surface, but would require redrawing
+ // but would require redrawing the targetSurface onto its ancestor targetSurface.
+ // For layers that do not own a surface this flag acts as m_layerPropertyChanged.
+ bool m_layerSurfacePropertyChanged;
+
+ // Uses layer's content space.
+ IntRect m_visibleContentRect;
+ bool m_masksToBounds;
+ bool m_contentsOpaque;
+ float m_opacity;
+ FloatPoint m_position;
+ bool m_preserves3D;
+ bool m_useParentBackfaceVisibility;
+ bool m_drawCheckerboardForMissingTiles;
+ WebKit::WebTransformationMatrix m_sublayerTransform;
+ WebKit::WebTransformationMatrix m_transform;
+ bool m_useLCDText;
+
+ bool m_drawsContent;
+ bool m_forceRenderSurface;
+
+ // Set for the layer that other layers are fixed to.
+ bool m_isContainerForFixedPositionLayers;
+ // This is true if the layer should be fixed to the closest ancestor container.
+ bool m_fixedToContainerLayer;
+
+ FloatSize m_scrollDelta;
+ IntSize m_sentScrollDelta;
+ IntSize m_maxScrollPosition;
+ WebKit::WebTransformationMatrix m_implTransform;
+
+ // The layer whose coordinate space this layer draws into. This can be
+ // either the same layer (m_renderTarget == this) or an ancestor of this
+ // layer.
+ CCLayerImpl* m_renderTarget;
+
+ // The global depth value of the center of the layer. This value is used
+ // to sort layers from back to front.
+ float m_drawDepth;
+ float m_drawOpacity;
+ bool m_drawOpacityIsAnimating;
+
+ // Debug borders.
+ SkColor m_debugBorderColor;
+ float m_debugBorderWidth;
+
+ // Debug layer name.
+ std::string m_debugName;
+
+ WebKit::WebFilterOperations m_filters;
+ WebKit::WebFilterOperations m_backgroundFilters;
+
+ WebKit::WebTransformationMatrix m_drawTransform;
+ WebKit::WebTransformationMatrix m_screenSpaceTransform;
+ bool m_drawTransformIsAnimating;
+ bool m_screenSpaceTransformIsAnimating;
+
+#ifndef NDEBUG
+ bool m_betweenWillDrawAndDidDraw;
+#endif
+
+ // Render surface associated with this layer. The layer and its descendants
+ // will render to this surface.
+ OwnPtr<CCRenderSurface> m_renderSurface;
+
+ // Hierarchical bounding rect containing the layer and its descendants.
+ // Uses target surface's space.
+ IntRect m_drawableContentRect;
+
+ // Rect indicating what was repainted/updated during update.
+ // Note that plugin layers bypass this and leave it empty.
+ // Uses layer's content space.
+ FloatRect m_updateRect;
+
+ // Manages animations for this layer.
+ scoped_ptr<CCLayerAnimationController> m_layerAnimationController;
+
+ // Manages scrollbars for this layer
+ OwnPtr<CCScrollbarAnimationController> m_scrollbarAnimationController;
+};
+
+void sortLayers(std::vector<CCLayerImpl*>::iterator first, std::vector<CCLayerImpl*>::iterator end, CCLayerSorter*);
+
+}
+
+#endif // CCLayerImpl_h
diff --git a/cc/CCLayerIterator.cpp b/cc/layer_iterator.cc
index 71fde80..71fde80 100644
--- a/cc/CCLayerIterator.cpp
+++ b/cc/layer_iterator.cc
diff --git a/cc/layer_iterator.h b/cc/layer_iterator.h
index 638cbb2..4d36080 100644
--- a/cc/layer_iterator.h
+++ b/cc/layer_iterator.h
@@ -1,3 +1,208 @@
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCLayerIterator_h
+#define CCLayerIterator_h
+
+#include "CCLayerTreeHostCommon.h"
+
+#include "base/memory/ref_counted.h"
+
+namespace cc {
+
+// These classes provide means to iterate over the RenderSurface-Layer tree.
+
+// Example code follows, for a tree of LayerChromium/RenderSurfaceChromium objects. See below for details.
+//
+// void doStuffOnLayers(const std::vector<scoped_refptr<LayerChromium> >& renderSurfaceLayerList)
+// {
+// typedef CCLayerIterator<LayerChromium, RenderSurfaceChromium, CCLayerIteratorActions::FrontToBack> CCLayerIteratorType;
+//
+// CCLayerIteratorType end = CCLayerIteratorType::end(&renderSurfaceLayerList);
+// for (CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); it != end; ++it) {
+// // Only one of these will be true
+// if (it.representsTargetRenderSurface())
+// foo(*it); // *it is a layer representing a target RenderSurface
+// if (it.representsContributingRenderSurface())
+// bar(*it); // *it is a layer representing a RenderSurface that contributes to the layer's target RenderSurface
+// if (it.representsItself())
+// baz(*it); // *it is a layer representing itself, as it contributes to its own target RenderSurface
+// }
+// }
+
+// A RenderSurface R may be referred to in one of two different contexts. One RenderSurface is "current" at any time, for
+// whatever operation is being performed. This current surface is referred to as a target surface. For example, when R is
+// being painted it would be the target surface. Once R has been painted, its contents may be included into another
+// surface S. While S is considered the target surface when it is being painted, R is called a contributing surface
+// in this context as it contributes to the content of the target surface S.
+//
+// The iterator's current position in the tree always points to some layer. The state of the iterator indicates the role of the
+// layer, and will be one of the following three states. A single layer L will appear in the iteration process in at least one,
+// and possibly all, of these states.
+// 1. Representing the target surface: The iterator in this state, pointing at layer L, indicates that the target RenderSurface
+// is now the surface owned by L. This will occur exactly once for each RenderSurface in the tree.
+// 2. Representing a contributing surface: The iterator in this state, pointing at layer L, refers to the RenderSurface owned
+// by L as a contributing surface, without changing the current target RenderSurface.
+// 3. Representing itself: The iterator in this state, pointing at layer L, refers to the layer itself, as a child of the
+// current target RenderSurface.
+//
+// The BackToFront iterator will return a layer representing the target surface before returning layers representing themselves
+// as children of the current target surface. Whereas the FrontToBack ordering will iterate over children layers of a surface
+// before the layer representing the surface as a target surface.
+//
+// To use the iterators:
+//
+// Create a stepping iterator and end iterator by calling CCLayerIterator::begin() and CCLayerIterator::end() and passing in the
+// list of layers owning target RenderSurfaces. Step through the tree by incrementing the stepping iterator while it is != to
+// the end iterator. At each step the iterator knows what the layer is representing, and you can query the iterator to decide
+// what actions to perform with the layer given what it represents.
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+// Non-templated constants
+struct CCLayerIteratorValue {
+ static const int InvalidTargetRenderSurfaceLayerIndex = -1;
+ // This must be -1 since the iterator action code assumes that this value can be
+ // reached by subtracting one from the position of the first layer in the current
+ // target surface's child layer list, which is 0.
+ static const int LayerIndexRepresentingTargetRenderSurface = -1;
+};
+
+// The position of a layer iterator that is independent of its many template types.
+template <typename LayerType>
+struct CCLayerIteratorPosition {
+ bool representsTargetRenderSurface;
+ bool representsContributingRenderSurface;
+ bool representsItself;
+ LayerType* targetRenderSurfaceLayer;
+ LayerType* currentLayer;
+};
+
+// An iterator class for walking over layers in the RenderSurface-Layer tree.
+template <typename LayerType, typename LayerList, typename RenderSurfaceType, typename IteratorActionType>
+class CCLayerIterator {
+ typedef CCLayerIterator<LayerType, LayerList, RenderSurfaceType, IteratorActionType> CCLayerIteratorType;
+
+public:
+ CCLayerIterator() : m_renderSurfaceLayerList(0) { }
+
+ static CCLayerIteratorType begin(const LayerList* renderSurfaceLayerList) { return CCLayerIteratorType(renderSurfaceLayerList, true); }
+ static CCLayerIteratorType end(const LayerList* renderSurfaceLayerList) { return CCLayerIteratorType(renderSurfaceLayerList, false); }
+
+ CCLayerIteratorType& operator++() { m_actions.next(*this); return *this; }
+ bool operator==(const CCLayerIterator& other) const
+ {
+ return m_targetRenderSurfaceLayerIndex == other.m_targetRenderSurfaceLayerIndex
+ && m_currentLayerIndex == other.m_currentLayerIndex;
+ }
+ bool operator!=(const CCLayerIteratorType& other) const { return !(*this == other); }
+
+ LayerType* operator->() const { return currentLayer(); }
+ LayerType* operator*() const { return currentLayer(); }
+
+ bool representsTargetRenderSurface() const { return currentLayerRepresentsTargetRenderSurface(); }
+ bool representsContributingRenderSurface() const { return !representsTargetRenderSurface() && currentLayerRepresentsContributingRenderSurface(); }
+ bool representsItself() const { return !representsTargetRenderSurface() && !representsContributingRenderSurface(); }
+
+ LayerType* targetRenderSurfaceLayer() const { return getRawPtr((*m_renderSurfaceLayerList)[m_targetRenderSurfaceLayerIndex]); }
+
+ operator const CCLayerIteratorPosition<LayerType>() const
+ {
+ CCLayerIteratorPosition<LayerType> position;
+ position.representsTargetRenderSurface = representsTargetRenderSurface();
+ position.representsContributingRenderSurface = representsContributingRenderSurface();
+ position.representsItself = representsItself();
+ position.targetRenderSurfaceLayer = targetRenderSurfaceLayer();
+ position.currentLayer = currentLayer();
+ return position;
+ }
+
+private:
+ CCLayerIterator(const LayerList* renderSurfaceLayerList, bool start)
+ : m_renderSurfaceLayerList(renderSurfaceLayerList)
+ , m_targetRenderSurfaceLayerIndex(0)
+ {
+ for (size_t i = 0; i < renderSurfaceLayerList->size(); ++i) {
+ if (!(*renderSurfaceLayerList)[i]->renderSurface()) {
+ ASSERT_NOT_REACHED();
+ m_actions.end(*this);
+ return;
+ }
+ }
+
+ if (start && !renderSurfaceLayerList->empty())
+ m_actions.begin(*this);
+ else
+ m_actions.end(*this);
+ }
+
+ inline static LayerChromium* getRawPtr(const scoped_refptr<LayerChromium>& ptr) { return ptr.get(); }
+ inline static CCLayerImpl* getRawPtr(CCLayerImpl* ptr) { return ptr; }
+
+ inline LayerType* currentLayer() const { return currentLayerRepresentsTargetRenderSurface() ? targetRenderSurfaceLayer() : getRawPtr(targetRenderSurfaceChildren()[m_currentLayerIndex]); }
+
+ inline bool currentLayerRepresentsContributingRenderSurface() const { return CCLayerTreeHostCommon::renderSurfaceContributesToTarget<LayerType>(currentLayer(), targetRenderSurfaceLayer()->id()); }
+ inline bool currentLayerRepresentsTargetRenderSurface() const { return m_currentLayerIndex == CCLayerIteratorValue::LayerIndexRepresentingTargetRenderSurface; }
+
+ inline RenderSurfaceType* targetRenderSurface() const { return targetRenderSurfaceLayer()->renderSurface(); }
+ inline const LayerList& targetRenderSurfaceChildren() const { return targetRenderSurface()->layerList(); }
+
+ IteratorActionType m_actions;
+ const LayerList* m_renderSurfaceLayerList;
+
+ // The iterator's current position.
+
+ // A position in the renderSurfaceLayerList. This points to a layer which owns the current target surface.
+ // This is a value from 0 to n-1 (n = size of renderSurfaceLayerList = number of surfaces). A value outside of
+ // this range (for example, CCLayerIteratorValue::InvalidTargetRenderSurfaceLayerIndex) is used to
+ // indicate a position outside the bounds of the tree.
+ int m_targetRenderSurfaceLayerIndex;
+ // A position in the list of layers that are children of the current target surface. When pointing to one of
+ // these layers, this is a value from 0 to n-1 (n = number of children). Since the iterator must also stop at
+ // the layers representing the target surface, this is done by setting the currentLayerIndex to a value of
+ // CCLayerIteratorValue::LayerRepresentingTargetRenderSurface.
+ int m_currentLayerIndex;
+
+ friend struct CCLayerIteratorActions;
+};
+
+// Orderings for iterating over the RenderSurface-Layer tree.
+struct CCLayerIteratorActions {
+ // Walks layers sorted by z-order from back to front.
+ class BackToFront {
+ public:
+ template <typename LayerType, typename LayerList, typename RenderSurfaceType, typename ActionType>
+ void begin(CCLayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>&);
+
+ template <typename LayerType, typename LayerList, typename RenderSurfaceType, typename ActionType>
+ void end(CCLayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>&);
+
+ template <typename LayerType, typename LayerList, typename RenderSurfaceType, typename ActionType>
+ void next(CCLayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>&);
+
+ private:
+ int m_highestTargetRenderSurfaceLayer;
+ };
+
+ // Walks layers sorted by z-order from front to back
+ class FrontToBack {
+ public:
+ template <typename LayerType, typename LayerList, typename RenderSurfaceType, typename ActionType>
+ void begin(CCLayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>&);
+
+ template <typename LayerType, typename LayerList, typename RenderSurfaceType, typename ActionType>
+ void end(CCLayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>&);
+
+ template <typename LayerType, typename LayerList, typename RenderSurfaceType, typename ActionType>
+ void next(CCLayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>&);
+
+ private:
+ template <typename LayerType, typename LayerList, typename RenderSurfaceType, typename ActionType>
+ void goToHighestInSubtree(CCLayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>&);
+ };
+};
+
+} // namespace cc
+
+#endif
diff --git a/cc/layer_painter.h b/cc/layer_painter.h
index 638cbb2..d552382 100644
--- a/cc/layer_painter.h
+++ b/cc/layer_painter.h
@@ -1,3 +1,26 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+
+#ifndef LayerPainterChromium_h
+#define LayerPainterChromium_h
+
+#if USE(ACCELERATED_COMPOSITING)
+
+class SkCanvas;
+
+namespace cc {
+
+class FloatRect;
+class IntRect;
+
+class LayerPainterChromium {
+public:
+ virtual ~LayerPainterChromium() { }
+ virtual void paint(SkCanvas*, const IntRect& contentRect, FloatRect& opaque) = 0;
+};
+
+} // namespace cc
+#endif // USE(ACCELERATED_COMPOSITING)
+#endif // LayerPainterChromium_h
diff --git a/cc/CCLayerQuad.cpp b/cc/layer_quad.cc
index 9642622..9642622 100644
--- a/cc/CCLayerQuad.cpp
+++ b/cc/layer_quad.cc
diff --git a/cc/layer_quad.h b/cc/layer_quad.h
index 638cbb2..8be296f 100644
--- a/cc/layer_quad.h
+++ b/cc/layer_quad.h
@@ -1,3 +1,106 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+
+#ifndef CCLayerQuad_h
+#define CCLayerQuad_h
+
+#if USE(ACCELERATED_COMPOSITING)
+
+#include "FloatPoint3D.h"
+#include "FloatQuad.h"
+
+static const float kAntiAliasingInflateDistance = 0.5f;
+
+namespace cc {
+
+class CCLayerQuad {
+public:
+ class Edge {
+ public:
+ Edge()
+ : m_x(0)
+ , m_y(0)
+ , m_z(0)
+ {
+ }
+ Edge(const FloatPoint&, const FloatPoint&);
+
+ float x() const { return m_x; }
+ float y() const { return m_y; }
+ float z() const { return m_z; }
+
+ void setX(float x) { m_x = x; }
+ void setY(float y) { m_y = y; }
+ void setZ(float z) { m_z = z; }
+ void set(float x, float y, float z)
+ {
+ m_x = x;
+ m_y = y;
+ m_z = z;
+ }
+
+ void moveX(float dx) { m_x += dx; }
+ void moveY(float dy) { m_y += dy; }
+ void moveZ(float dz) { m_z += dz; }
+ void move(float dx, float dy, float dz)
+ {
+ m_x += dx;
+ m_y += dy;
+ m_z += dz;
+ }
+
+ void scaleX(float sx) { m_x *= sx; }
+ void scaleY(float sy) { m_y *= sy; }
+ void scaleZ(float sz) { m_z *= sz; }
+ void scale(float sx, float sy, float sz)
+ {
+ m_x *= sx;
+ m_y *= sy;
+ m_z *= sz;
+ }
+ void scale(float s) { scale(s, s, s); }
+
+ FloatPoint intersect(const Edge& e) const
+ {
+ return FloatPoint(
+ (y() * e.z() - e.y() * z()) / (x() * e.y() - e.x() * y()),
+ (x() * e.z() - e.x() * z()) / (e.x() * y() - x() * e.y()));
+ }
+
+ private:
+ float m_x;
+ float m_y;
+ float m_z;
+ };
+
+ CCLayerQuad(const Edge& left, const Edge& top, const Edge& right, const Edge& bottom);
+ CCLayerQuad(const FloatQuad&);
+
+ Edge left() const { return m_left; }
+ Edge top() const { return m_top; }
+ Edge right() const { return m_right; }
+ Edge bottom() const { return m_bottom; }
+
+ void inflateX(float dx) { m_left.moveZ(dx); m_right.moveZ(dx); }
+ void inflateY(float dy) { m_top.moveZ(dy); m_bottom.moveZ(dy); }
+ void inflate(float d) { inflateX(d); inflateY(d); }
+ void inflateAntiAliasingDistance() { inflate(kAntiAliasingInflateDistance); }
+
+ FloatQuad floatQuad() const;
+
+ void toFloatArray(float[12]) const;
+
+private:
+ Edge m_left;
+ Edge m_top;
+ Edge m_right;
+ Edge m_bottom;
+};
+
+}
+
+#endif // USE(ACCELERATED_COMPOSITING)
+
+#endif
diff --git a/cc/CCLayerSorter.cpp b/cc/layer_sorter.cc
index cf85777..cf85777 100644
--- a/cc/CCLayerSorter.cpp
+++ b/cc/layer_sorter.cc
diff --git a/cc/layer_sorter.h b/cc/layer_sorter.h
index 638cbb2..d4ca664 100644
--- a/cc/layer_sorter.h
+++ b/cc/layer_sorter.h
@@ -1,3 +1,92 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCLayerSorter_h
+#define CCLayerSorter_h
+
+#include "base/basictypes.h"
+#include "CCLayerImpl.h"
+#include "FloatPoint3D.h"
+#include "FloatQuad.h"
+#include "FloatRect.h"
+#include <vector>
+#include <wtf/HashMap.h>
+#include <wtf/Vector.h>
+
+namespace WebKit {
+class WebTransformationMatrix;
+}
+
+namespace cc {
+
+class CCLayerSorter {
+public:
+ CCLayerSorter();
+ ~CCLayerSorter();
+
+ typedef std::vector<CCLayerImpl*> LayerList;
+
+ void sort(LayerList::iterator first, LayerList::iterator last);
+
+ // Holds various useful properties derived from a layer's 3D outline.
+ struct LayerShape {
+ LayerShape();
+ LayerShape(float width, float height, const WebKit::WebTransformationMatrix& drawTransform);
+
+ float layerZFromProjectedPoint(const FloatPoint&) const;
+
+ FloatPoint3D layerNormal;
+ FloatPoint3D transformOrigin;
+ FloatQuad projectedQuad;
+ FloatRect projectedBounds;
+ };
+
+ enum ABCompareResult {
+ ABeforeB,
+ BBeforeA,
+ None
+ };
+
+ static ABCompareResult checkOverlap(LayerShape*, LayerShape*, float zThreshold, float& weight);
+
+private:
+ struct GraphEdge;
+
+ struct GraphNode {
+ explicit GraphNode(CCLayerImpl* cclayer);
+ ~GraphNode();
+
+ CCLayerImpl* layer;
+ LayerShape shape;
+ Vector<GraphEdge*> incoming;
+ Vector<GraphEdge*> outgoing;
+ float incomingEdgeWeight;
+ };
+
+ struct GraphEdge {
+ GraphEdge(GraphNode* fromNode, GraphNode* toNode, float weight) : from(fromNode), to(toNode), weight(weight) { };
+
+ GraphNode* from;
+ GraphNode* to;
+ float weight;
+ };
+
+ typedef Vector<GraphNode> NodeList;
+ typedef Vector<GraphEdge> EdgeList;
+ NodeList m_nodes;
+ EdgeList m_edges;
+ float m_zRange;
+
+ typedef HashMap<GraphEdge*, GraphEdge*> EdgeMap;
+ EdgeMap m_activeEdges;
+
+ void createGraphNodes(LayerList::iterator first, LayerList::iterator last);
+ void createGraphEdges();
+ void removeEdgeFromList(GraphEdge*, Vector<GraphEdge*>&);
+
+ DISALLOW_COPY_AND_ASSIGN(CCLayerSorter);
+};
+
+}
+#endif
diff --git a/cc/LayerTextureSubImage.cpp b/cc/layer_texture_sub_image.cc
index 60f5311..60f5311 100644
--- a/cc/LayerTextureSubImage.cpp
+++ b/cc/layer_texture_sub_image.cc
diff --git a/cc/layer_texture_sub_image.h b/cc/layer_texture_sub_image.h
index 638cbb2..2c6cc14 100644
--- a/cc/layer_texture_sub_image.h
+++ b/cc/layer_texture_sub_image.h
@@ -1,3 +1,46 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+
+#ifndef LayerTextureSubImage_h
+#define LayerTextureSubImage_h
+
+#if USE(ACCELERATED_COMPOSITING)
+
+#include "GraphicsTypes3D.h"
+#include "IntRect.h"
+#include "IntSize.h"
+#include <wtf/OwnArrayPtr.h>
+
+namespace WebKit {
+class WebGraphicsContext3D;
+}
+
+namespace cc {
+
+class LayerTextureSubImage {
+public:
+ explicit LayerTextureSubImage(bool useMapSubForUpload);
+ ~LayerTextureSubImage();
+
+ void upload(const uint8_t* image, const IntRect& imageRect,
+ const IntRect& sourceRect, const IntSize& destOffset,
+ GC3Denum format, WebKit::WebGraphicsContext3D*);
+
+private:
+ void uploadWithTexSubImage(const uint8_t* image, const IntRect& imageRect,
+ const IntRect& sourceRect, const IntSize& destOffset,
+ GC3Denum format, WebKit::WebGraphicsContext3D*);
+ void uploadWithMapTexSubImage(const uint8_t* image, const IntRect& imageRect,
+ const IntRect& sourceRect, const IntSize& destOffset,
+ GC3Denum format, WebKit::WebGraphicsContext3D*);
+
+ bool m_useMapTexSubImage;
+ size_t m_subImageSize;
+ OwnArrayPtr<uint8_t> m_subImage;
+};
+
+} // namespace cc
+#endif // USE(ACCELERATED_COMPOSITING)
+#endif // LayerTextureSubImage_h
diff --git a/cc/LayerTextureUpdater.cpp b/cc/layer_texture_updater.cc
index d4e708f..d4e708f 100644
--- a/cc/LayerTextureUpdater.cpp
+++ b/cc/layer_texture_updater.cc
diff --git a/cc/layer_texture_updater.h b/cc/layer_texture_updater.h
index 638cbb2..89fc520 100644
--- a/cc/layer_texture_updater.h
+++ b/cc/layer_texture_updater.h
@@ -1,3 +1,69 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+
+#ifndef LayerTextureUpdater_h
+#define LayerTextureUpdater_h
+
+#if USE(ACCELERATED_COMPOSITING)
+
+#include "CCPrioritizedTexture.h"
+#include "GraphicsTypes3D.h"
+#include <wtf/RefCounted.h>
+
+namespace cc {
+
+class IntRect;
+class IntSize;
+class TextureManager;
+struct CCRenderingStats;
+
+class LayerTextureUpdater : public RefCounted<LayerTextureUpdater> {
+public:
+ // Allows texture uploaders to store per-tile resources.
+ class Texture {
+ public:
+ virtual ~Texture();
+
+ CCPrioritizedTexture* texture() { return m_texture.get(); }
+ void swapTextureWith(scoped_ptr<CCPrioritizedTexture>& texture) { m_texture.swap(texture); }
+ virtual void prepareRect(const IntRect& /* sourceRect */, CCRenderingStats&) { }
+ virtual void updateRect(CCResourceProvider*, const IntRect& sourceRect, const IntSize& destOffset) = 0;
+ virtual bool backingResourceWasEvicted() const;
+ protected:
+ explicit Texture(scoped_ptr<CCPrioritizedTexture> texture);
+
+ private:
+ scoped_ptr<CCPrioritizedTexture> m_texture;
+ };
+
+ LayerTextureUpdater()
+ {
+ turnOffVerifier(); // In the component build we don't have WTF threading initialized in this DLL so the thread verifier explodes.
+ }
+
+ virtual ~LayerTextureUpdater() { }
+
+ enum SampledTexelFormat {
+ SampledTexelFormatRGBA,
+ SampledTexelFormatBGRA,
+ SampledTexelFormatInvalid,
+ };
+ virtual PassOwnPtr<Texture> createTexture(CCPrioritizedTextureManager*) = 0;
+ // Returns the format of the texel uploaded by this interface.
+ // This format should not be confused by texture internal format.
+ // This format specifies the component order in the sampled texel.
+ // If the format is TexelFormatBGRA, vec4.x is blue and vec4.z is red.
+ virtual SampledTexelFormat sampledTexelFormat(GC3Denum textureFormat) = 0;
+ // The |resultingOpaqueRect| gives back a region of the layer that was painted opaque. If the layer is marked opaque in the updater,
+ // then this region should be ignored in preference for the entire layer's area.
+ virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpaqueRect, CCRenderingStats&) { }
+
+ // Set true by the layer when it is known that the entire output is going to be opaque.
+ virtual void setOpaque(bool) { }
+};
+
+} // namespace cc
+#endif // USE(ACCELERATED_COMPOSITING)
+#endif // LayerTextureUpdater_h
diff --git a/cc/CCLayerTilingData.cpp b/cc/layer_tiling_data.cc
index 12c7aef..12c7aef 100644
--- a/cc/CCLayerTilingData.cpp
+++ b/cc/layer_tiling_data.cc
diff --git a/cc/layer_tiling_data.h b/cc/layer_tiling_data.h
index 638cbb2..c73f057 100644
--- a/cc/layer_tiling_data.h
+++ b/cc/layer_tiling_data.h
@@ -1,3 +1,101 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+
+#ifndef CCLayerTilingData_h
+#define CCLayerTilingData_h
+
+#if USE(ACCELERATED_COMPOSITING)
+
+#include "base/basictypes.h"
+#include "IntRect.h"
+#include "Region.h"
+#include "TilingData.h"
+#include <wtf/HashMap.h>
+#include <wtf/HashTraits.h>
+#include <wtf/PassOwnPtr.h>
+
+namespace cc {
+
+class CCLayerTilingData {
+public:
+ enum BorderTexelOption { HasBorderTexels, NoBorderTexels };
+
+ ~CCLayerTilingData();
+
+ static PassOwnPtr<CCLayerTilingData> create(const IntSize& tileSize, BorderTexelOption);
+
+ bool hasEmptyBounds() const { return m_tilingData.hasEmptyBounds(); }
+ int numTilesX() const { return m_tilingData.numTilesX(); }
+ int numTilesY() const { return m_tilingData.numTilesY(); }
+ IntRect tileBounds(int i, int j) const { return m_tilingData.tileBounds(i, j); }
+ IntPoint textureOffset(int xIndex, int yIndex) const { return m_tilingData.textureOffset(xIndex, yIndex); }
+
+ // Change the tile size. This may invalidate all the existing tiles.
+ void setTileSize(const IntSize&);
+ IntSize tileSize() const;
+ // Change the border texel setting. This may invalidate all existing tiles.
+ void setBorderTexelOption(BorderTexelOption);
+ bool hasBorderTexels() const { return m_tilingData.borderTexels(); }
+
+ bool isEmpty() const { return hasEmptyBounds() || !tiles().size(); }
+
+ const CCLayerTilingData& operator=(const CCLayerTilingData&);
+
+ class Tile {
+ public:
+ Tile() : m_i(-1), m_j(-1) { }
+ virtual ~Tile() { }
+
+ int i() const { return m_i; }
+ int j() const { return m_j; }
+ void moveTo(int i, int j) { m_i = i; m_j = j; }
+
+ const IntRect& opaqueRect() const { return m_opaqueRect; }
+ void setOpaqueRect(const IntRect& opaqueRect) { m_opaqueRect = opaqueRect; }
+ private:
+ int m_i;
+ int m_j;
+ IntRect m_opaqueRect;
+ DISALLOW_COPY_AND_ASSIGN(Tile);
+ };
+ // Default hash key traits for integers disallow 0 and -1 as a key, so
+ // use a custom hash trait which disallows -1 and -2 instead.
+ typedef std::pair<int, int> TileMapKey;
+ struct TileMapKeyTraits : HashTraits<TileMapKey> {
+ static const bool emptyValueIsZero = false;
+ static const bool needsDestruction = false;
+ static TileMapKey emptyValue() { return std::make_pair(-1, -1); }
+ static void constructDeletedValue(TileMapKey& slot) { slot = std::make_pair(-2, -2); }
+ static bool isDeletedValue(TileMapKey value) { return value.first == -2 && value.second == -2; }
+ };
+ typedef HashMap<TileMapKey, OwnPtr<Tile>, DefaultHash<TileMapKey>::Hash, TileMapKeyTraits> TileMap;
+
+ void addTile(PassOwnPtr<Tile>, int, int);
+ PassOwnPtr<Tile> takeTile(int, int);
+ Tile* tileAt(int, int) const;
+ const TileMap& tiles() const { return m_tiles; }
+
+ void setBounds(const IntSize&);
+ IntSize bounds() const;
+
+ void contentRectToTileIndices(const IntRect&, int &left, int &top, int &right, int &bottom) const;
+ IntRect tileRect(const Tile*) const;
+
+ Region opaqueRegionInContentRect(const IntRect&) const;
+
+ void reset();
+
+protected:
+ CCLayerTilingData(const IntSize& tileSize, BorderTexelOption);
+
+ TileMap m_tiles;
+ TilingData m_tilingData;
+};
+
+}
+
+#endif // USE(ACCELERATED_COMPOSITING)
+
+#endif
diff --git a/cc/CCLayerTreeHost.cpp b/cc/layer_tree_host.cc
index d75a3d3..d75a3d3 100644
--- a/cc/CCLayerTreeHost.cpp
+++ b/cc/layer_tree_host.cc
diff --git a/cc/layer_tree_host.h b/cc/layer_tree_host.h
index 638cbb2..277b1f0 100644
--- a/cc/layer_tree_host.h
+++ b/cc/layer_tree_host.h
@@ -1,3 +1,297 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCLayerTreeHost_h
+#define CCLayerTreeHost_h
+
+#include "base/basictypes.h"
+#include "base/hash_tables.h"
+#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_ptr.h"
+#include "CCAnimationEvents.h"
+#include "CCGraphicsContext.h"
+#include "CCLayerTreeHostClient.h"
+#include "CCLayerTreeHostCommon.h"
+#include "CCOcclusionTracker.h"
+#include "CCPrioritizedTextureManager.h"
+#include "CCProxy.h"
+#include "CCRenderingStats.h"
+#include "IntRect.h"
+#include "RateLimiter.h"
+#include "scoped_ptr_vector.h"
+#include "SkColor.h"
+#include <limits>
+
+#if defined(COMPILER_GCC)
+namespace BASE_HASH_NAMESPACE {
+template<>
+struct hash<WebKit::WebGraphicsContext3D*> {
+ size_t operator()(WebKit::WebGraphicsContext3D* ptr) const {
+ return hash<size_t>()(reinterpret_cast<size_t>(ptr));
+ }
+};
+} // namespace BASE_HASH_NAMESPACE
+#endif // COMPILER
+
+namespace cc {
+
+class CCFontAtlas;
+class CCLayerChromium;
+class CCLayerTreeHostImpl;
+class CCLayerTreeHostImplClient;
+class CCPrioritizedTextureManager;
+class CCTextureUpdateQueue;
+class HeadsUpDisplayLayerChromium;
+class Region;
+struct CCScrollAndScaleSet;
+
+struct CCLayerTreeSettings {
+ CCLayerTreeSettings();
+ ~CCLayerTreeSettings();
+
+ bool acceleratePainting;
+ bool showFPSCounter;
+ bool showPlatformLayerTree;
+ bool showPaintRects;
+ bool showPropertyChangedRects;
+ bool showSurfaceDamageRects;
+ bool showScreenSpaceRects;
+ bool showReplicaScreenSpaceRects;
+ bool showOccludingRects;
+ bool renderVSyncEnabled;
+ double refreshRate;
+ size_t maxPartialTextureUpdates;
+ IntSize defaultTileSize;
+ IntSize maxUntiledLayerSize;
+ IntSize minimumOcclusionTrackingSize;
+
+ bool showDebugInfo() const { return showPlatformLayerTree || showFPSCounter || showDebugRects(); }
+ bool showDebugRects() const { return showPaintRects || showPropertyChangedRects || showSurfaceDamageRects || showScreenSpaceRects || showReplicaScreenSpaceRects || showOccludingRects; }
+};
+
+// Provides information on an Impl's rendering capabilities back to the CCLayerTreeHost
+struct RendererCapabilities {
+ RendererCapabilities();
+ ~RendererCapabilities();
+
+ GC3Denum bestTextureFormat;
+ bool contextHasCachedFrontBuffer;
+ bool usingPartialSwap;
+ bool usingAcceleratedPainting;
+ bool usingSetVisibility;
+ bool usingSwapCompleteCallback;
+ bool usingGpuMemoryManager;
+ bool usingDiscardFramebuffer;
+ bool usingEglImage;
+ int maxTextureSize;
+};
+
+class CCLayerTreeHost : public RateLimiterClient {
+public:
+ static scoped_ptr<CCLayerTreeHost> create(CCLayerTreeHostClient*, const CCLayerTreeSettings&);
+ virtual ~CCLayerTreeHost();
+
+ void setSurfaceReady();
+
+ // Returns true if any CCLayerTreeHost is alive.
+ static bool anyLayerTreeHostInstanceExists();
+
+ static bool needsFilterContext() { return s_needsFilterContext; }
+ static void setNeedsFilterContext(bool needsFilterContext) { s_needsFilterContext = needsFilterContext; }
+ bool needsSharedContext() const { return needsFilterContext() || settings().acceleratePainting; }
+
+ // CCLayerTreeHost interface to CCProxy.
+ void willBeginFrame() { m_client->willBeginFrame(); }
+ void didBeginFrame() { m_client->didBeginFrame(); }
+ void updateAnimations(double monotonicFrameBeginTime);
+ void layout();
+ void beginCommitOnImplThread(CCLayerTreeHostImpl*);
+ void finishCommitOnImplThread(CCLayerTreeHostImpl*);
+ void willCommit();
+ void commitComplete();
+ scoped_ptr<CCGraphicsContext> createContext();
+ scoped_ptr<CCInputHandler> createInputHandler();
+ virtual scoped_ptr<CCLayerTreeHostImpl> createLayerTreeHostImpl(CCLayerTreeHostImplClient*);
+ void didLoseContext();
+ enum RecreateResult {
+ RecreateSucceeded,
+ RecreateFailedButTryAgain,
+ RecreateFailedAndGaveUp,
+ };
+ RecreateResult recreateContext();
+ void didCommitAndDrawFrame() { m_client->didCommitAndDrawFrame(); }
+ void didCompleteSwapBuffers() { m_client->didCompleteSwapBuffers(); }
+ void deleteContentsTexturesOnImplThread(CCResourceProvider*);
+ virtual void acquireLayerTextures();
+ // Returns false if we should abort this frame due to initialization failure.
+ bool initializeRendererIfNeeded();
+ void updateLayers(CCTextureUpdateQueue&, size_t contentsMemoryLimitBytes);
+
+ CCLayerTreeHostClient* client() { return m_client; }
+
+ // Only used when compositing on the main thread.
+ void composite();
+ void scheduleComposite();
+
+ // Composites and attempts to read back the result into the provided
+ // buffer. If it wasn't possible, e.g. due to context lost, will return
+ // false.
+ bool compositeAndReadback(void *pixels, const IntRect&);
+
+ void finishAllRendering();
+
+ int commitNumber() const { return m_commitNumber; }
+
+ void renderingStats(CCRenderingStats*) const;
+
+ const RendererCapabilities& rendererCapabilities() const;
+
+ // Test only hook
+ void loseContext(int numTimes);
+
+ void setNeedsAnimate();
+ // virtual for testing
+ virtual void setNeedsCommit();
+ void setNeedsRedraw();
+ bool commitRequested() const;
+
+ void setAnimationEvents(scoped_ptr<CCAnimationEventsVector>, double wallClockTime);
+ virtual void didAddAnimation();
+
+ LayerChromium* rootLayer() { return m_rootLayer.get(); }
+ const LayerChromium* rootLayer() const { return m_rootLayer.get(); }
+ void setRootLayer(scoped_refptr<LayerChromium>);
+
+ const CCLayerTreeSettings& settings() const { return m_settings; }
+
+ void setViewportSize(const IntSize& layoutViewportSize, const IntSize& deviceViewportSize);
+
+ const IntSize& layoutViewportSize() const { return m_layoutViewportSize; }
+ const IntSize& deviceViewportSize() const { return m_deviceViewportSize; }
+
+ void setPageScaleFactorAndLimits(float pageScaleFactor, float minPageScaleFactor, float maxPageScaleFactor);
+
+ void setBackgroundColor(SkColor color) { m_backgroundColor = color; }
+
+ void setHasTransparentBackground(bool transparent) { m_hasTransparentBackground = transparent; }
+
+ CCPrioritizedTextureManager* contentsTextureManager() const;
+
+ // Delete contents textures' backing resources until they use only bytesLimit bytes. This may
+ // be called on the impl thread while the main thread is running.
+ void reduceContentsTexturesMemoryOnImplThread(size_t bytesLimit, CCResourceProvider*);
+ // Returns true if there any evicted backing textures that have not been deleted.
+ bool evictedContentsTexturesBackingsExist() const;
+ // Retrieve the list of all contents textures' backings that have been evicted, to pass to the
+ // main thread to unlink them from their owning textures.
+ void getEvictedContentTexturesBackings(CCPrioritizedTextureManager::BackingVector&);
+ // Unlink the list of contents textures' backings from their owning textures on the main thread
+ // before updating layers.
+ void unlinkEvictedContentTexturesBackings(const CCPrioritizedTextureManager::BackingVector&);
+ // Deletes all evicted backings, unlinking them from their owning textures if needed.
+ // Returns true if this function had to unlink any backings from their owning texture when
+ // destroying them. If this was the case, the impl layer tree may contain invalid resources.
+ bool deleteEvictedContentTexturesBackings();
+
+ bool visible() const { return m_visible; }
+ void setVisible(bool);
+
+ void startPageScaleAnimation(const IntSize& targetPosition, bool useAnchor, float scale, double durationSec);
+
+ void applyScrollAndScale(const CCScrollAndScaleSet&);
+ void setImplTransform(const WebKit::WebTransformationMatrix&);
+
+ void startRateLimiter(WebKit::WebGraphicsContext3D*);
+ void stopRateLimiter(WebKit::WebGraphicsContext3D*);
+
+ // RateLimitClient implementation
+ virtual void rateLimit() OVERRIDE;
+
+ bool bufferedUpdates();
+ bool requestPartialTextureUpdate();
+ void deleteTextureAfterCommit(scoped_ptr<CCPrioritizedTexture>);
+
+ void setDeviceScaleFactor(float);
+ float deviceScaleFactor() const { return m_deviceScaleFactor; }
+
+ void setFontAtlas(scoped_ptr<CCFontAtlas>);
+
+ HeadsUpDisplayLayerChromium* hudLayer() const { return m_hudLayer.get(); }
+
+protected:
+ CCLayerTreeHost(CCLayerTreeHostClient*, const CCLayerTreeSettings&);
+ bool initialize();
+
+private:
+ typedef std::vector<scoped_refptr<LayerChromium> > LayerList;
+
+ void initializeRenderer();
+
+ void update(LayerChromium*, CCTextureUpdateQueue&, const CCOcclusionTracker*);
+ bool paintLayerContents(const LayerList&, CCTextureUpdateQueue&);
+ bool paintMasksForRenderSurface(LayerChromium*, CCTextureUpdateQueue&);
+
+ void updateLayers(LayerChromium*, CCTextureUpdateQueue&);
+
+ void prioritizeTextures(const LayerList&, CCOverdrawMetrics&);
+ void setPrioritiesForSurfaces(size_t surfaceMemoryBytes);
+ void setPrioritiesForLayers(const LayerList&);
+ size_t calculateMemoryForRenderSurfaces(const LayerList& updateList);
+
+ void animateLayers(double monotonicTime);
+ bool animateLayersRecursive(LayerChromium* current, double monotonicTime);
+ void setAnimationEventsRecursive(const CCAnimationEventsVector&, LayerChromium*, double wallClockTime);
+
+ bool m_animating;
+ bool m_needsAnimateLayers;
+
+ CCLayerTreeHostClient* m_client;
+
+ int m_commitNumber;
+ CCRenderingStats m_renderingStats;
+
+ scoped_ptr<CCProxy> m_proxy;
+ bool m_rendererInitialized;
+ bool m_contextLost;
+ int m_numTimesRecreateShouldFail;
+ int m_numFailedRecreateAttempts;
+
+ scoped_refptr<LayerChromium> m_rootLayer;
+ scoped_refptr<HeadsUpDisplayLayerChromium> m_hudLayer;
+ scoped_ptr<CCFontAtlas> m_fontAtlas;
+
+ scoped_ptr<CCPrioritizedTextureManager> m_contentsTextureManager;
+ scoped_ptr<CCPrioritizedTexture> m_surfaceMemoryPlaceholder;
+
+ CCLayerTreeSettings m_settings;
+
+ IntSize m_layoutViewportSize;
+ IntSize m_deviceViewportSize;
+ float m_deviceScaleFactor;
+
+ bool m_visible;
+
+ typedef base::hash_map<WebKit::WebGraphicsContext3D*, scoped_refptr<RateLimiter> > RateLimiterMap;
+ RateLimiterMap m_rateLimiters;
+
+ float m_pageScaleFactor;
+ float m_minPageScaleFactor, m_maxPageScaleFactor;
+ WebKit::WebTransformationMatrix m_implTransform;
+ bool m_triggerIdleUpdates;
+
+ SkColor m_backgroundColor;
+ bool m_hasTransparentBackground;
+
+ typedef ScopedPtrVector<CCPrioritizedTexture> TextureList;
+ TextureList m_deleteTextureAfterCommitList;
+ size_t m_partialTextureUpdateRequests;
+
+ static bool s_needsFilterContext;
+
+ DISALLOW_COPY_AND_ASSIGN(CCLayerTreeHost);
+};
+
+} // namespace cc
+
+#endif
diff --git a/cc/layer_tree_host_client.h b/cc/layer_tree_host_client.h
index 638cbb2..1c88a75 100644
--- a/cc/layer_tree_host_client.h
+++ b/cc/layer_tree_host_client.h
@@ -1,3 +1,43 @@
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCLayerTreeHostClient_h
+#define CCLayerTreeHostClient_h
+
+#include "base/memory/scoped_ptr.h"
+
+namespace WebKit {
+class WebCompositorOutputSurface;
+}
+
+namespace cc {
+class CCInputHandler;
+class IntSize;
+
+class CCLayerTreeHostClient {
+public:
+ virtual void willBeginFrame() = 0;
+ // Marks finishing compositing-related tasks on the main thread. In threaded mode, this corresponds to didCommit().
+ virtual void didBeginFrame() = 0;
+ virtual void animate(double frameBeginTime) = 0;
+ virtual void layout() = 0;
+ virtual void applyScrollAndScale(const IntSize& scrollDelta, float pageScale) = 0;
+ virtual scoped_ptr<WebKit::WebCompositorOutputSurface> createOutputSurface() = 0;
+ virtual void didRecreateOutputSurface(bool success) = 0;
+ virtual scoped_ptr<CCInputHandler> createInputHandler() = 0;
+ virtual void willCommit() = 0;
+ virtual void didCommit() = 0;
+ virtual void didCommitAndDrawFrame() = 0;
+ virtual void didCompleteSwapBuffers() = 0;
+
+ // Used only in the single-threaded path.
+ virtual void scheduleComposite() = 0;
+
+protected:
+ virtual ~CCLayerTreeHostClient() { }
+};
+
+}
+
+#endif // CCLayerTreeHostClient_h
diff --git a/cc/CCLayerTreeHostCommon.cpp b/cc/layer_tree_host_common.cc
index 24274a6f..24274a6f 100644
--- a/cc/CCLayerTreeHostCommon.cpp
+++ b/cc/layer_tree_host_common.cc
diff --git a/cc/layer_tree_host_common.h b/cc/layer_tree_host_common.h
index 638cbb2..01dc41e 100644
--- a/cc/layer_tree_host_common.h
+++ b/cc/layer_tree_host_common.h
@@ -1,3 +1,96 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCLayerTreeHostCommon_h
+#define CCLayerTreeHostCommon_h
+
+#include "base/memory/ref_counted.h"
+#include "cc/scoped_ptr_vector.h"
+#include "IntRect.h"
+#include "IntSize.h"
+#include <public/WebTransformationMatrix.h>
+#include <wtf/Vector.h>
+
+namespace cc {
+
+class CCLayerImpl;
+class CCLayerSorter;
+class LayerChromium;
+
+class CCLayerTreeHostCommon {
+public:
+ static IntRect calculateVisibleRect(const IntRect& targetSurfaceRect, const IntRect& layerBoundRect, const WebKit::WebTransformationMatrix&);
+
+ static void calculateDrawTransforms(LayerChromium* rootLayer, const IntSize& deviceViewportSize, float deviceScaleFactor, int maxTextureSize, std::vector<scoped_refptr<LayerChromium> >& renderSurfaceLayerList);
+ static void calculateDrawTransforms(CCLayerImpl* rootLayer, const IntSize& deviceViewportSize, float deviceScaleFactor, CCLayerSorter*, int maxTextureSize, std::vector<CCLayerImpl*>& renderSurfaceLayerList);
+
+ // Performs hit testing for a given renderSurfaceLayerList.
+ static CCLayerImpl* findLayerThatIsHitByPoint(const IntPoint& viewportPoint, std::vector<CCLayerImpl*>& renderSurfaceLayerList);
+
+ template<typename LayerType> static bool renderSurfaceContributesToTarget(LayerType*, int targetSurfaceLayerID);
+
+ // Returns a layer with the given id if one exists in the subtree starting
+ // from the given root layer (including mask and replica layers).
+ template<typename LayerType> static LayerType* findLayerInSubtree(LayerType* rootLayer, int layerId);
+
+ static LayerChromium* getChildAsRawPtr(const std::vector<scoped_refptr<LayerChromium> >& children, size_t index)
+ {
+ return children[index].get();
+ }
+
+ static CCLayerImpl* getChildAsRawPtr(const ScopedPtrVector<CCLayerImpl>& children, size_t index)
+ {
+ return children[index];
+ }
+
+ struct ScrollUpdateInfo {
+ int layerId;
+ IntSize scrollDelta;
+ };
+};
+
+struct CCScrollAndScaleSet {
+ CCScrollAndScaleSet();
+ ~CCScrollAndScaleSet();
+
+ Vector<CCLayerTreeHostCommon::ScrollUpdateInfo> scrolls;
+ float pageScaleDelta;
+};
+
+template<typename LayerType>
+bool CCLayerTreeHostCommon::renderSurfaceContributesToTarget(LayerType* layer, int targetSurfaceLayerID)
+{
+ // A layer will either contribute its own content, or its render surface's content, to
+ // the target surface. The layer contributes its surface's content when both the
+ // following are true:
+ // (1) The layer actually has a renderSurface, and
+ // (2) The layer's renderSurface is not the same as the targetSurface.
+ //
+ // Otherwise, the layer just contributes itself to the target surface.
+
+ return layer->renderSurface() && layer->id() != targetSurfaceLayerID;
+}
+
+template<typename LayerType>
+LayerType* CCLayerTreeHostCommon::findLayerInSubtree(LayerType* rootLayer, int layerId)
+{
+ if (rootLayer->id() == layerId)
+ return rootLayer;
+
+ if (rootLayer->maskLayer() && rootLayer->maskLayer()->id() == layerId)
+ return rootLayer->maskLayer();
+
+ if (rootLayer->replicaLayer() && rootLayer->replicaLayer()->id() == layerId)
+ return rootLayer->replicaLayer();
+
+ for (size_t i = 0; i < rootLayer->children().size(); ++i) {
+ if (LayerType* found = findLayerInSubtree(getChildAsRawPtr(rootLayer->children(), i), layerId))
+ return found;
+ }
+ return 0;
+}
+
+} // namespace cc
+
+#endif
diff --git a/cc/CCLayerTreeHostImpl.cpp b/cc/layer_tree_host_impl.cc
index bc50697..bc50697 100644
--- a/cc/CCLayerTreeHostImpl.cpp
+++ b/cc/layer_tree_host_impl.cc
diff --git a/cc/layer_tree_host_impl.h b/cc/layer_tree_host_impl.h
index 638cbb2..297f619 100644
--- a/cc/layer_tree_host_impl.h
+++ b/cc/layer_tree_host_impl.h
@@ -1,3 +1,356 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCLayerTreeHostImpl_h
+#define CCLayerTreeHostImpl_h
+
+#include "base/basictypes.h"
+#include "base/time.h"
+#include "CCAnimationEvents.h"
+#include "CCInputHandler.h"
+#include "CCLayerSorter.h"
+#include "CCRenderPass.h"
+#include "CCRenderPassSink.h"
+#include "CCRenderer.h"
+#include "SkColor.h"
+#include <public/WebCompositorOutputSurfaceClient.h>
+#include <wtf/PassOwnPtr.h>
+#include <wtf/RefPtr.h>
+
+namespace cc {
+
+class CCCompletionEvent;
+class CCDebugRectHistory;
+class CCFrameRateCounter;
+class CCHeadsUpDisplayLayerImpl;
+class CCLayerImpl;
+class CCLayerTreeHostImplTimeSourceAdapter;
+class CCPageScaleAnimation;
+class CCRenderPassDrawQuad;
+class CCResourceProvider;
+struct RendererCapabilities;
+struct CCRenderingStats;
+
+// CCLayerTreeHost->CCProxy callback interface.
+class CCLayerTreeHostImplClient {
+public:
+ virtual void didLoseContextOnImplThread() = 0;
+ virtual void onSwapBuffersCompleteOnImplThread() = 0;
+ virtual void onVSyncParametersChanged(double monotonicTimebase, double intervalInSeconds) = 0;
+ virtual void onCanDrawStateChanged(bool canDraw) = 0;
+ virtual void setNeedsRedrawOnImplThread() = 0;
+ virtual void setNeedsCommitOnImplThread() = 0;
+ virtual void postAnimationEventsToMainThreadOnImplThread(scoped_ptr<CCAnimationEventsVector>, double wallClockTime) = 0;
+ virtual void releaseContentsTexturesOnImplThread() = 0;
+};
+
+// CCPinchZoomViewport models the bounds and offset of the viewport that is used during a pinch-zoom operation.
+// It tracks the layout-space dimensions of the viewport before any applied scale, and then tracks the layout-space
+// coordinates of the viewport respecting the pinch settings.
+class CCPinchZoomViewport {
+public:
+ CCPinchZoomViewport();
+
+ float totalPageScaleFactor() const;
+
+ void setPageScaleFactor(float factor) { m_pageScaleFactor = factor; }
+ float pageScaleFactor() const { return m_pageScaleFactor; }
+
+ void setPageScaleDelta(float delta);
+ float pageScaleDelta() const { return m_pageScaleDelta; }
+
+ float minPageScaleFactor() const { return m_minPageScaleFactor; }
+ float maxPageScaleFactor() const { return m_maxPageScaleFactor; }
+
+ void setSentPageScaleDelta(float delta) { m_sentPageScaleDelta = delta; }
+ float sentPageScaleDelta() const { return m_sentPageScaleDelta; }
+
+ // Returns true if the passed parameters were different from those previously
+ // cached.
+ bool setPageScaleFactorAndLimits(float pageScaleFactor,
+ float minPageScaleFactor,
+ float maxPageScaleFactor);
+
+ // Returns the bounds and offset of the scaled and translated viewport to use for pinch-zoom.
+ FloatRect bounds() const;
+ const FloatPoint& scrollDelta() const { return m_pinchViewportScrollDelta; }
+
+ void setLayoutViewportSize(const FloatSize& size) { m_layoutViewportSize = size; }
+
+ // Apply the scroll offset in layout space to the offset of the pinch-zoom viewport. The viewport cannot be
+ // scrolled outside of the layout viewport bounds. Returns the component of the scroll that is un-applied due to
+ // this constraint.
+ FloatSize applyScroll(FloatSize&);
+
+ WebKit::WebTransformationMatrix implTransform() const;
+
+private:
+ float m_pageScaleFactor;
+ float m_pageScaleDelta;
+ float m_sentPageScaleDelta;
+ float m_maxPageScaleFactor;
+ float m_minPageScaleFactor;
+
+ FloatPoint m_pinchViewportScrollDelta;
+ FloatSize m_layoutViewportSize;
+};
+
+// CCLayerTreeHostImpl owns the CCLayerImpl tree as well as associated rendering state
+class CCLayerTreeHostImpl : public CCInputHandlerClient,
+ public CCRendererClient,
+ public WebKit::WebCompositorOutputSurfaceClient {
+ typedef std::vector<CCLayerImpl*> CCLayerList;
+
+public:
+ static scoped_ptr<CCLayerTreeHostImpl> create(const CCLayerTreeSettings&, CCLayerTreeHostImplClient*);
+ virtual ~CCLayerTreeHostImpl();
+
+ // CCInputHandlerClient implementation
+ virtual CCInputHandlerClient::ScrollStatus scrollBegin(const IntPoint&, CCInputHandlerClient::ScrollInputType) OVERRIDE;
+ virtual void scrollBy(const IntPoint&, const IntSize&) OVERRIDE;
+ virtual void scrollEnd() OVERRIDE;
+ virtual void pinchGestureBegin() OVERRIDE;
+ virtual void pinchGestureUpdate(float, const IntPoint&) OVERRIDE;
+ virtual void pinchGestureEnd() OVERRIDE;
+ virtual void startPageScaleAnimation(const IntSize& targetPosition, bool anchorPoint, float pageScale, double startTime, double duration) OVERRIDE;
+ virtual void scheduleAnimation() OVERRIDE;
+
+ struct FrameData : public CCRenderPassSink {
+ FrameData();
+ ~FrameData();
+
+ Vector<IntRect> occludingScreenSpaceRects;
+ CCRenderPassList renderPasses;
+ CCRenderPassIdHashMap renderPassesById;
+ CCLayerList* renderSurfaceLayerList;
+ CCLayerList willDrawLayers;
+
+ // CCRenderPassSink implementation.
+ virtual void appendRenderPass(scoped_ptr<CCRenderPass>) OVERRIDE;
+ };
+
+ // Virtual for testing.
+ virtual void beginCommit();
+ virtual void commitComplete();
+ virtual void animate(double monotonicTime, double wallClockTime);
+
+ // Returns false if problems occured preparing the frame, and we should try
+ // to avoid displaying the frame. If prepareToDraw is called,
+ // didDrawAllLayers must also be called, regardless of whether drawLayers is
+ // called between the two.
+ virtual bool prepareToDraw(FrameData&);
+ virtual void drawLayers(const FrameData&);
+ // Must be called if and only if prepareToDraw was called.
+ void didDrawAllLayers(const FrameData&);
+
+ // CCRendererClient implementation
+ virtual const IntSize& deviceViewportSize() const OVERRIDE;
+ virtual const CCLayerTreeSettings& settings() const OVERRIDE;
+ virtual void didLoseContext() OVERRIDE;
+ virtual void onSwapBuffersComplete() OVERRIDE;
+ virtual void setFullRootLayerDamage() OVERRIDE;
+ virtual void releaseContentsTextures() OVERRIDE;
+ virtual void setMemoryAllocationLimitBytes(size_t) OVERRIDE;
+
+ // WebCompositorOutputSurfaceClient implementation.
+ virtual void onVSyncParametersChanged(double monotonicTimebase, double intervalInSeconds) OVERRIDE;
+
+ // Implementation
+ bool canDraw();
+ CCGraphicsContext* context() const;
+
+ std::string layerTreeAsText() const;
+
+ void finishAllRendering();
+ int sourceAnimationFrameNumber() const;
+
+ bool initializeRenderer(scoped_ptr<CCGraphicsContext>);
+ bool isContextLost();
+ CCRenderer* renderer() { return m_renderer.get(); }
+ const RendererCapabilities& rendererCapabilities() const;
+
+ bool swapBuffers();
+
+ void readback(void* pixels, const IntRect&);
+
+ void setRootLayer(scoped_ptr<CCLayerImpl>);
+ CCLayerImpl* rootLayer() { return m_rootLayerImpl.get(); }
+
+ void setHudLayer(CCHeadsUpDisplayLayerImpl* layerImpl) { m_hudLayerImpl = layerImpl; }
+ CCHeadsUpDisplayLayerImpl* hudLayer() { return m_hudLayerImpl; }
+
+ // Release ownership of the current layer tree and replace it with an empty
+ // tree. Returns the root layer of the detached tree.
+ scoped_ptr<CCLayerImpl> detachLayerTree();
+
+ CCLayerImpl* rootScrollLayer() const { return m_rootScrollLayerImpl; }
+
+ bool visible() const { return m_visible; }
+ void setVisible(bool);
+
+ int sourceFrameNumber() const { return m_sourceFrameNumber; }
+ void setSourceFrameNumber(int frameNumber) { m_sourceFrameNumber = frameNumber; }
+
+ bool contentsTexturesPurged() const { return m_contentsTexturesPurged; }
+ void setContentsTexturesPurged();
+ void resetContentsTexturesPurged();
+ size_t memoryAllocationLimitBytes() const { return m_memoryAllocationLimitBytes; }
+
+ void setViewportSize(const IntSize& layoutViewportSize, const IntSize& deviceViewportSize);
+ const IntSize& layoutViewportSize() const { return m_layoutViewportSize; }
+
+ float deviceScaleFactor() const { return m_deviceScaleFactor; }
+ void setDeviceScaleFactor(float);
+
+ float pageScaleFactor() const;
+ void setPageScaleFactorAndLimits(float pageScaleFactor, float minPageScaleFactor, float maxPageScaleFactor);
+
+ scoped_ptr<CCScrollAndScaleSet> processScrollDeltas();
+ WebKit::WebTransformationMatrix implTransform() const;
+
+ void startPageScaleAnimation(const IntSize& tragetPosition, bool useAnchor, float scale, double durationSec);
+
+ SkColor backgroundColor() const { return m_backgroundColor; }
+ void setBackgroundColor(SkColor color) { m_backgroundColor = color; }
+
+ bool hasTransparentBackground() const { return m_hasTransparentBackground; }
+ void setHasTransparentBackground(bool transparent) { m_hasTransparentBackground = transparent; }
+
+ bool needsAnimateLayers() const { return m_needsAnimateLayers; }
+ void setNeedsAnimateLayers() { m_needsAnimateLayers = true; }
+
+ void setNeedsRedraw();
+
+ void renderingStats(CCRenderingStats*) const;
+
+ void updateRootScrollLayerImplTransform();
+
+ CCFrameRateCounter* fpsCounter() const { return m_fpsCounter.get(); }
+ CCDebugRectHistory* debugRectHistory() const { return m_debugRectHistory.get(); }
+ CCResourceProvider* resourceProvider() const { return m_resourceProvider.get(); }
+
+ class CullRenderPassesWithCachedTextures {
+ public:
+ bool shouldRemoveRenderPass(const CCRenderPassDrawQuad&, const FrameData&) const;
+
+ // Iterates from the root first, in order to remove the surfaces closest
+ // to the root with cached textures, and all surfaces that draw into
+ // them.
+ size_t renderPassListBegin(const CCRenderPassList& list) const { return list.size() - 1; }
+ size_t renderPassListEnd(const CCRenderPassList&) const { return 0 - 1; }
+ size_t renderPassListNext(size_t it) const { return it - 1; }
+
+ CullRenderPassesWithCachedTextures(CCRenderer& renderer) : m_renderer(renderer) { }
+ private:
+ CCRenderer& m_renderer;
+ };
+
+ class CullRenderPassesWithNoQuads {
+ public:
+ bool shouldRemoveRenderPass(const CCRenderPassDrawQuad&, const FrameData&) const;
+
+ // Iterates in draw order, so that when a surface is removed, and its
+ // target becomes empty, then its target can be removed also.
+ size_t renderPassListBegin(const CCRenderPassList&) const { return 0; }
+ size_t renderPassListEnd(const CCRenderPassList& list) const { return list.size(); }
+ size_t renderPassListNext(size_t it) const { return it + 1; }
+ };
+
+ template<typename RenderPassCuller>
+ static void removeRenderPasses(RenderPassCuller, FrameData&);
+
+protected:
+ CCLayerTreeHostImpl(const CCLayerTreeSettings&, CCLayerTreeHostImplClient*);
+
+ void animatePageScale(double monotonicTime);
+ void animateScrollbars(double monotonicTime);
+
+ // Exposed for testing.
+ void calculateRenderSurfaceLayerList(CCLayerList&);
+
+ // Virtual for testing.
+ virtual void animateLayers(double monotonicTime, double wallClockTime);
+
+ // Virtual for testing.
+ virtual base::TimeDelta lowFrequencyAnimationInterval() const;
+
+ CCLayerTreeHostImplClient* m_client;
+ int m_sourceFrameNumber;
+
+private:
+ void computeDoubleTapZoomDeltas(CCScrollAndScaleSet* scrollInfo);
+ void computePinchZoomDeltas(CCScrollAndScaleSet* scrollInfo);
+ void makeScrollAndScaleSet(CCScrollAndScaleSet* scrollInfo, const IntSize& scrollOffset, float pageScale);
+
+ void setPageScaleDelta(float);
+ void updateMaxScrollPosition();
+ void trackDamageForAllSurfaces(CCLayerImpl* rootDrawLayer, const CCLayerList& renderSurfaceLayerList);
+
+ // Returns false if the frame should not be displayed. This function should
+ // only be called from prepareToDraw, as didDrawAllLayers must be called
+ // if this helper function is called.
+ bool calculateRenderPasses(FrameData&);
+ void animateLayersRecursive(CCLayerImpl*, double monotonicTime, double wallClockTime, CCAnimationEventsVector*, bool& didAnimate, bool& needsAnimateLayers);
+ void setBackgroundTickingEnabled(bool);
+ IntSize contentSize() const;
+
+ void sendDidLoseContextRecursive(CCLayerImpl*);
+ void clearRenderSurfaces();
+ bool ensureRenderSurfaceLayerList();
+ void clearCurrentlyScrollingLayer();
+
+ void animateScrollbarsRecursive(CCLayerImpl*, double monotonicTime);
+
+ void dumpRenderSurfaces(std::string*, int indent, const CCLayerImpl*) const;
+
+ scoped_ptr<CCGraphicsContext> m_context;
+ OwnPtr<CCResourceProvider> m_resourceProvider;
+ OwnPtr<CCRenderer> m_renderer;
+ scoped_ptr<CCLayerImpl> m_rootLayerImpl;
+ CCLayerImpl* m_rootScrollLayerImpl;
+ CCLayerImpl* m_currentlyScrollingLayerImpl;
+ CCHeadsUpDisplayLayerImpl* m_hudLayerImpl;
+ int m_scrollingLayerIdFromPreviousTree;
+ bool m_scrollDeltaIsInScreenSpace;
+ CCLayerTreeSettings m_settings;
+ IntSize m_layoutViewportSize;
+ IntSize m_deviceViewportSize;
+ float m_deviceScaleFactor;
+ bool m_visible;
+ bool m_contentsTexturesPurged;
+ size_t m_memoryAllocationLimitBytes;
+
+ SkColor m_backgroundColor;
+ bool m_hasTransparentBackground;
+
+ // If this is true, it is necessary to traverse the layer tree ticking the animators.
+ bool m_needsAnimateLayers;
+ bool m_pinchGestureActive;
+ IntPoint m_previousPinchAnchor;
+
+ OwnPtr<CCPageScaleAnimation> m_pageScaleAnimation;
+
+ // This is used for ticking animations slowly when hidden.
+ OwnPtr<CCLayerTreeHostImplTimeSourceAdapter> m_timeSourceClientAdapter;
+
+ CCLayerSorter m_layerSorter;
+
+ // List of visible layers for the most recently prepared frame. Used for
+ // rendering and input event hit testing.
+ CCLayerList m_renderSurfaceLayerList;
+
+ CCPinchZoomViewport m_pinchZoomViewport;
+
+ OwnPtr<CCFrameRateCounter> m_fpsCounter;
+ OwnPtr<CCDebugRectHistory> m_debugRectHistory;
+
+ size_t m_numImplThreadScrolls;
+ size_t m_numMainThreadScrolls;
+
+ DISALLOW_COPY_AND_ASSIGN(CCLayerTreeHostImpl);
+};
+
+};
+
+#endif
diff --git a/cc/CCMathUtil.cpp b/cc/math_util.cc
index d90eb09..d90eb09 100644
--- a/cc/CCMathUtil.cpp
+++ b/cc/math_util.cc
diff --git a/cc/math_util.h b/cc/math_util.h
index 638cbb2..ed3848e 100644
--- a/cc/math_util.h
+++ b/cc/math_util.h
@@ -1,3 +1,107 @@
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCMathUtil_h
+#define CCMathUtil_h
+
+#include "FloatPoint.h"
+#include "FloatPoint3D.h"
+
+namespace WebKit {
+class WebTransformationMatrix;
+}
+
+namespace cc {
+
+class IntRect;
+class FloatRect;
+class FloatQuad;
+
+struct HomogeneousCoordinate {
+ HomogeneousCoordinate(double newX, double newY, double newZ, double newW)
+ : x(newX)
+ , y(newY)
+ , z(newZ)
+ , w(newW)
+ {
+ }
+
+ bool shouldBeClipped() const
+ {
+ return w <= 0;
+ }
+
+ FloatPoint cartesianPoint2d() const
+ {
+ if (w == 1)
+ return FloatPoint(x, y);
+
+ // For now, because this code is used privately only by CCMathUtil, it should never be called when w == 0, and we do not yet need to handle that case.
+ ASSERT(w);
+ double invW = 1.0 / w;
+ return FloatPoint(x * invW, y * invW);
+ }
+
+ FloatPoint3D cartesianPoint3d() const
+ {
+ if (w == 1)
+ return FloatPoint3D(x, y, z);
+
+ // For now, because this code is used privately only by CCMathUtil, it should never be called when w == 0, and we do not yet need to handle that case.
+ ASSERT(w);
+ double invW = 1.0 / w;
+ return FloatPoint3D(x * invW, y * invW, z * invW);
+ }
+
+ double x;
+ double y;
+ double z;
+ double w;
+};
+
+class CCMathUtil {
+public:
+
+ // Background: WebTransformationMatrix code in WebCore does not do the right thing in
+ // mapRect / mapQuad / projectQuad when there is a perspective projection that causes
+ // one of the transformed vertices to go to w < 0. In those cases, it is necessary to
+ // perform clipping in homogeneous coordinates, after applying the transform, before
+ // dividing-by-w to convert to cartesian coordinates.
+ //
+ // These functions return the axis-aligned rect that encloses the correctly clipped,
+ // transformed polygon.
+ static IntRect mapClippedRect(const WebKit::WebTransformationMatrix&, const IntRect&);
+ static FloatRect mapClippedRect(const WebKit::WebTransformationMatrix&, const FloatRect&);
+ static FloatRect projectClippedRect(const WebKit::WebTransformationMatrix&, const FloatRect&);
+
+ // Returns an array of vertices that represent the clipped polygon. After returning, indexes from
+ // 0 to numVerticesInClippedQuad are valid in the clippedQuad array. Note that
+ // numVerticesInClippedQuad may be zero, which means the entire quad was clipped, and
+ // none of the vertices in the array are valid.
+ static void mapClippedQuad(const WebKit::WebTransformationMatrix&, const FloatQuad& srcQuad, FloatPoint clippedQuad[8], int& numVerticesInClippedQuad);
+
+ static FloatRect computeEnclosingRectOfVertices(FloatPoint vertices[], int numVertices);
+ static FloatRect computeEnclosingClippedRect(const HomogeneousCoordinate& h1, const HomogeneousCoordinate& h2, const HomogeneousCoordinate& h3, const HomogeneousCoordinate& h4);
+
+ // NOTE: These functions do not do correct clipping against w = 0 plane, but they
+ // correctly detect the clipped condition via the boolean clipped.
+ static FloatQuad mapQuad(const WebKit::WebTransformationMatrix&, const FloatQuad&, bool& clipped);
+ static FloatPoint mapPoint(const WebKit::WebTransformationMatrix&, const FloatPoint&, bool& clipped);
+ static FloatPoint3D mapPoint(const WebKit::WebTransformationMatrix&, const FloatPoint3D&, bool& clipped);
+ static FloatQuad projectQuad(const WebKit::WebTransformationMatrix&, const FloatQuad&, bool& clipped);
+ static FloatPoint projectPoint(const WebKit::WebTransformationMatrix&, const FloatPoint&, bool& clipped);
+
+ static void flattenTransformTo2d(WebKit::WebTransformationMatrix&);
+
+ // Returns the smallest angle between the given two vectors in degrees. Neither vector is
+ // assumed to be normalized.
+ static float smallestAngleBetweenVectors(const FloatSize&, const FloatSize&);
+
+ // Projects the |source| vector onto |destination|. Neither vector is assumed to be normalized.
+ static FloatSize projectVector(const FloatSize& source, const FloatSize& destination);
+};
+
+} // namespace cc
+
+#endif // #define CCMathUtil_h
diff --git a/cc/CCOcclusionTracker.cpp b/cc/occlusion_tracker.cc
index bedb80c..bedb80c 100644
--- a/cc/CCOcclusionTracker.cpp
+++ b/cc/occlusion_tracker.cc
diff --git a/cc/occlusion_tracker.h b/cc/occlusion_tracker.h
index 638cbb2..c2526cd 100644
--- a/cc/occlusion_tracker.h
+++ b/cc/occlusion_tracker.h
@@ -1,3 +1,105 @@
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCOcclusionTracker_h
+#define CCOcclusionTracker_h
+
+#include "base/basictypes.h"
+#include "CCLayerIterator.h"
+#include "FloatQuad.h"
+#include "Region.h"
+
+namespace cc {
+class CCOverdrawMetrics;
+class CCLayerImpl;
+class CCRenderSurface;
+class LayerChromium;
+class RenderSurfaceChromium;
+
+// This class is used to track occlusion of layers while traversing them in a front-to-back order. As each layer is visited, one of the
+// methods in this class is called to notify it about the current target surface.
+// Then, occlusion in the content space of the current layer may be queried, via methods such as occluded() and unoccludedContentRect().
+// If the current layer owns a RenderSurface, then occlusion on that RenderSurface may also be queried via surfaceOccluded() and surfaceUnoccludedContentRect().
+// Finally, once finished with the layer, occlusion behind the layer should be marked by calling markOccludedBehindLayer().
+template<typename LayerType, typename RenderSurfaceType>
+class CCOcclusionTrackerBase {
+public:
+ CCOcclusionTrackerBase(IntRect rootTargetRect, bool recordMetricsForFrame);
+
+ // Called at the beginning of each step in the CCLayerIterator's front-to-back traversal.
+ void enterLayer(const CCLayerIteratorPosition<LayerType>&);
+ // Called at the end of each step in the CCLayerIterator's front-to-back traversal.
+ void leaveLayer(const CCLayerIteratorPosition<LayerType>&);
+
+ // Returns true if the given rect in content space for the layer is fully occluded in either screen space or the layer's target surface.
+ bool occluded(const LayerType*, const IntRect& contentRect, bool* hasOcclusionFromOutsideTargetSurface = 0) const;
+ // Gives an unoccluded sub-rect of |contentRect| in the content space of the layer. Used when considering occlusion for a layer that paints/draws something.
+ IntRect unoccludedContentRect(const LayerType*, const IntRect& contentRect, bool* hasOcclusionFromOutsideTargetSurface = 0) const;
+
+ // Gives an unoccluded sub-rect of |contentRect| in the content space of the renderTarget owned by the layer.
+ // Used when considering occlusion for a contributing surface that is rendering into another target.
+ IntRect unoccludedContributingSurfaceContentRect(const LayerType*, bool forReplica, const IntRect& contentRect, bool* hasOcclusionFromOutsideTargetSurface = 0) const;
+
+ // Report operations for recording overdraw metrics.
+ CCOverdrawMetrics& overdrawMetrics() const { return *m_overdrawMetrics.get(); }
+
+ // Gives the region of the screen that is not occluded by something opaque.
+ Region computeVisibleRegionInScreen() const { return subtract(Region(m_rootTargetRect), m_stack.last().occlusionInScreen); }
+
+ void setMinimumTrackingSize(const IntSize& size) { m_minimumTrackingSize = size; }
+
+ // The following is used for visualization purposes.
+ void setOccludingScreenSpaceRectsContainer(Vector<IntRect>* rects) { m_occludingScreenSpaceRects = rects; }
+
+protected:
+ struct StackObject {
+ StackObject() : target(0) { }
+ StackObject(const LayerType* target) : target(target) { }
+ const LayerType* target;
+ Region occlusionInScreen;
+ Region occlusionInTarget;
+ };
+
+ // The stack holds occluded regions for subtrees in the RenderSurface-Layer tree, so that when we leave a subtree we may
+ // apply a mask to it, but not to the parts outside the subtree.
+ // - The first time we see a new subtree under a target, we add that target to the top of the stack. This can happen as a layer representing itself, or as a target surface.
+ // - When we visit a target surface, we apply its mask to its subtree, which is at the top of the stack.
+ // - When we visit a layer representing itself, we add its occlusion to the current subtree, which is at the top of the stack.
+ // - When we visit a layer representing a contributing surface, the current target will never be the top of the stack since we just came from the contributing surface.
+ // We merge the occlusion at the top of the stack with the new current subtree. This new target is pushed onto the stack if not already there.
+ Vector<StackObject, 1> m_stack;
+
+ // Allow tests to override this.
+ virtual IntRect layerClipRectInTarget(const LayerType*) const;
+
+private:
+ // Called when visiting a layer representing itself. If the target was not already current, then this indicates we have entered a new surface subtree.
+ void enterRenderTarget(const LayerType* newTarget);
+
+ // Called when visiting a layer representing a target surface. This indicates we have visited all the layers within the surface, and we may
+ // perform any surface-wide operations.
+ void finishedRenderTarget(const LayerType* finishedTarget);
+
+ // Called when visiting a layer representing a contributing surface. This indicates that we are leaving our current surface, and
+ // entering the new one. We then perform any operations required for merging results from the child subtree into its parent.
+ void leaveToRenderTarget(const LayerType* newTarget);
+
+ // Add the layer's occlusion to the tracked state.
+ void markOccludedBehindLayer(const LayerType*);
+
+ IntRect m_rootTargetRect;
+ OwnPtr<CCOverdrawMetrics> m_overdrawMetrics;
+ IntSize m_minimumTrackingSize;
+
+ // This is used for visualizing the occlusion tracking process.
+ Vector<IntRect>* m_occludingScreenSpaceRects;
+
+ DISALLOW_COPY_AND_ASSIGN(CCOcclusionTrackerBase);
+};
+
+typedef CCOcclusionTrackerBase<LayerChromium, RenderSurfaceChromium> CCOcclusionTracker;
+typedef CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface> CCOcclusionTrackerImpl;
+
+}
+#endif // CCOcclusionTracker_h
diff --git a/cc/CCOverdrawMetrics.cpp b/cc/overdraw_metrics.cc
index 4eba7d3..4eba7d3 100644
--- a/cc/CCOverdrawMetrics.cpp
+++ b/cc/overdraw_metrics.cc
diff --git a/cc/overdraw_metrics.h b/cc/overdraw_metrics.h
index 638cbb2..b907a64 100644
--- a/cc/overdraw_metrics.h
+++ b/cc/overdraw_metrics.h
@@ -1,3 +1,97 @@
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCOverdrawMetrics_h
+#define CCOverdrawMetrics_h
+
+#include <wtf/PassOwnPtr.h>
+
+namespace WebKit {
+class WebTransformationMatrix;
+}
+
+namespace cc {
+class IntRect;
+class CCLayerTreeHost;
+class CCLayerTreeHostImpl;
+
+// FIXME: compute overdraw metrics only occasionally, not every frame.
+class CCOverdrawMetrics {
+public:
+ static PassOwnPtr<CCOverdrawMetrics> create(bool recordMetricsForFrame) { return adoptPtr(new CCOverdrawMetrics(recordMetricsForFrame)); }
+
+ // These methods are used for saving metrics during update/commit.
+
+ // Record pixels painted by WebKit into the texture updater, but does not mean the pixels were rasterized in main memory.
+ void didPaint(const IntRect& paintedRect);
+ // Records that an invalid tile was culled and did not need to be painted/uploaded, and did not contribute to other tiles needing to be painted.
+ void didCullTileForUpload();
+ // Records pixels that were uploaded to texture memory.
+ void didUpload(const WebKit::WebTransformationMatrix& transformToTarget, const IntRect& uploadRect, const IntRect& opaqueRect);
+ // Record contents texture(s) behind present using the given number of bytes.
+ void didUseContentsTextureMemoryBytes(size_t contentsTextureUseBytes);
+ // Record RenderSurface texture(s) being present using the given number of bytes.
+ void didUseRenderSurfaceTextureMemoryBytes(size_t renderSurfaceUseBytes);
+
+ // These methods are used for saving metrics during draw.
+
+ // Record pixels that were not drawn to screen.
+ void didCullForDrawing(const WebKit::WebTransformationMatrix& transformToTarget, const IntRect& beforeCullRect, const IntRect& afterCullRect);
+ // Record pixels that were drawn to screen.
+ void didDraw(const WebKit::WebTransformationMatrix& transformToTarget, const IntRect& afterCullRect, const IntRect& opaqueRect);
+
+ void recordMetrics(const CCLayerTreeHost*) const;
+ void recordMetrics(const CCLayerTreeHostImpl*) const;
+
+ // Accessors for tests.
+ float pixelsDrawnOpaque() const { return m_pixelsDrawnOpaque; }
+ float pixelsDrawnTranslucent() const { return m_pixelsDrawnTranslucent; }
+ float pixelsCulledForDrawing() const { return m_pixelsCulledForDrawing; }
+ float pixelsPainted() const { return m_pixelsPainted; }
+ float pixelsUploadedOpaque() const { return m_pixelsUploadedOpaque; }
+ float pixelsUploadedTranslucent() const { return m_pixelsUploadedTranslucent; }
+ int tilesCulledForUpload() const { return m_tilesCulledForUpload; }
+
+private:
+ enum MetricsType {
+ UpdateAndCommit,
+ DrawingToScreen
+ };
+
+ explicit CCOverdrawMetrics(bool recordMetricsForFrame);
+
+ template<typename LayerTreeHostType>
+ void recordMetricsInternal(MetricsType, const LayerTreeHostType*) const;
+
+ // When false this class is a giant no-op.
+ bool m_recordMetricsForFrame;
+
+ // These values are used for saving metrics during update/commit.
+
+ // Count of pixels that were painted due to invalidation.
+ float m_pixelsPainted;
+ // Count of pixels uploaded to textures and known to be opaque.
+ float m_pixelsUploadedOpaque;
+ // Count of pixels uploaded to textures and not known to be opaque.
+ float m_pixelsUploadedTranslucent;
+ // Count of tiles that were invalidated but not uploaded.
+ int m_tilesCulledForUpload;
+ // Count the number of bytes in contents textures.
+ unsigned long long m_contentsTextureUseBytes;
+ // Count the number of bytes in RenderSurface textures.
+ unsigned long long m_renderSurfaceTextureUseBytes;
+
+ // These values are used for saving metrics during draw.
+
+ // Count of pixels that are opaque (and thus occlude). Ideally this is no more than wiewport width x height.
+ float m_pixelsDrawnOpaque;
+ // Count of pixels that are possibly translucent, and cannot occlude.
+ float m_pixelsDrawnTranslucent;
+ // Count of pixels not drawn as they are occluded by somthing opaque.
+ float m_pixelsCulledForDrawing;
+};
+
+} // namespace cc
+
+#endif
diff --git a/cc/CCPageScaleAnimation.cpp b/cc/page_scale_animation.cc
index 12dda09..12dda09 100644
--- a/cc/CCPageScaleAnimation.cpp
+++ b/cc/page_scale_animation.cc
diff --git a/cc/page_scale_animation.h b/cc/page_scale_animation.h
index 638cbb2..f597026 100644
--- a/cc/page_scale_animation.h
+++ b/cc/page_scale_animation.h
@@ -1,3 +1,74 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCPageScaleAnimation_h
+#define CCPageScaleAnimation_h
+
+#include "IntSize.h"
+#include <wtf/PassOwnPtr.h>
+
+namespace cc {
+
+// A small helper class that does the math for zoom animations, primarily for
+// double-tap zoom. Initialize it with starting and ending scroll/page scale
+// positions and an animation length time, then call ...AtTime() at every frame
+// to obtain the current interpolated position.
+class CCPageScaleAnimation {
+public:
+ // Construct with the starting page scale and scroll offset (which is in
+ // pageScaleStart space). The window size is the user-viewable area
+ // in pixels.
+ static PassOwnPtr<CCPageScaleAnimation> create(const IntSize& scrollStart, float pageScaleStart, const IntSize& windowSize, const IntSize& contentSize, double startTime);
+
+ // The following methods initialize the animation. Call one of them
+ // immediately after construction to set the final scroll and page scale.
+
+ // Zoom while explicitly specifying the top-left scroll position. The
+ // scroll offset is in finalPageScale coordinates.
+ void zoomTo(const IntSize& finalScroll, float finalPageScale, double duration);
+
+ // Zoom based on a specified onscreen anchor, which will remain at the same
+ // position on the screen throughout the animation. The anchor is in local
+ // space relative to scrollStart.
+ void zoomWithAnchor(const IntSize& anchor, float finalPageScale, double duration);
+
+ // Call these functions while the animation is in progress to output the
+ // current state.
+ IntSize scrollOffsetAtTime(double time) const;
+ float pageScaleAtTime(double time) const;
+ bool isAnimationCompleteAtTime(double time) const;
+
+ // The following methods return state which is invariant throughout the
+ // course of the animation.
+ double startTime() const { return m_startTime; }
+ double duration() const { return m_duration; }
+ double endTime() const { return m_startTime + m_duration; }
+ const IntSize& finalScrollOffset() const { return m_scrollEnd; }
+ float finalPageScale() const { return m_pageScaleEnd; }
+
+protected:
+ CCPageScaleAnimation(const IntSize& scrollStart, float pageScaleStart, const IntSize& windowSize, const IntSize& contentSize, double startTime);
+
+private:
+ float progressRatioForTime(double time) const;
+ IntSize scrollOffsetAtRatio(float ratio) const;
+ float pageScaleAtRatio(float ratio) const;
+
+ IntSize m_scrollStart;
+ float m_pageScaleStart;
+ IntSize m_windowSize;
+ IntSize m_contentSize;
+
+ bool m_anchorMode;
+ IntSize m_anchor;
+ IntSize m_scrollEnd;
+ float m_pageScaleEnd;
+
+ double m_startTime;
+ double m_duration;
+};
+
+} // namespace cc
+
+#endif
diff --git a/cc/platform_color.h b/cc/platform_color.h
index 638cbb2..61ffd31 100644
--- a/cc/platform_color.h
+++ b/cc/platform_color.h
@@ -1,3 +1,58 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef PlatformColor_h
+#define PlatformColor_h
+
+#include "Extensions3D.h"
+#include "GraphicsContext3D.h"
+#include "SkTypes.h"
+#include <public/WebGraphicsContext3D.h>
+
+namespace cc {
+
+class PlatformColor {
+public:
+ static GraphicsContext3D::SourceDataFormat format()
+ {
+ return SK_B32_SHIFT ? GraphicsContext3D::SourceFormatRGBA8 : GraphicsContext3D::SourceFormatBGRA8;
+ }
+
+ // Returns the most efficient texture format for this platform.
+ static GC3Denum bestTextureFormat(WebKit::WebGraphicsContext3D* context, bool supportsBGRA8888)
+ {
+ GC3Denum textureFormat = GraphicsContext3D::RGBA;
+ switch (format()) {
+ case GraphicsContext3D::SourceFormatRGBA8:
+ break;
+ case GraphicsContext3D::SourceFormatBGRA8:
+ if (supportsBGRA8888)
+ textureFormat = Extensions3D::BGRA_EXT;
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ break;
+ }
+ return textureFormat;
+ }
+
+ // Return true if the given texture format has the same component order
+ // as the color on this platform.
+ static bool sameComponentOrder(GC3Denum textureFormat)
+ {
+ switch (format()) {
+ case GraphicsContext3D::SourceFormatRGBA8:
+ return textureFormat == GraphicsContext3D::RGBA;
+ case GraphicsContext3D::SourceFormatBGRA8:
+ return textureFormat == Extensions3D::BGRA_EXT;
+ default:
+ ASSERT_NOT_REACHED();
+ return false;
+ }
+ }
+};
+
+} // namespace cc
+
+#endif
diff --git a/cc/CCPrioritizedTexture.cpp b/cc/prioritized_texture.cc
index 2940e92..2940e92 100644
--- a/cc/CCPrioritizedTexture.cpp
+++ b/cc/prioritized_texture.cc
diff --git a/cc/prioritized_texture.h b/cc/prioritized_texture.h
index 638cbb2..3196867 100644
--- a/cc/prioritized_texture.h
+++ b/cc/prioritized_texture.h
@@ -1,3 +1,142 @@
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCPrioritizedTexture_h
+#define CCPrioritizedTexture_h
+
+#include "base/basictypes.h"
+#include "base/memory/scoped_ptr.h"
+#include "CCPriorityCalculator.h"
+#include "CCResourceProvider.h"
+#include "CCTexture.h"
+#include "GraphicsContext3D.h"
+#include "IntRect.h"
+#include "IntSize.h"
+
+namespace cc {
+
+class CCPrioritizedTextureManager;
+
+class CCPrioritizedTexture {
+public:
+ static scoped_ptr<CCPrioritizedTexture> create(CCPrioritizedTextureManager* manager, IntSize size, GC3Denum format)
+ {
+ return make_scoped_ptr(new CCPrioritizedTexture(manager, size, format));
+ }
+ static scoped_ptr<CCPrioritizedTexture> create(CCPrioritizedTextureManager* manager)
+ {
+ return make_scoped_ptr(new CCPrioritizedTexture(manager, IntSize(), 0));
+ }
+ ~CCPrioritizedTexture();
+
+ // Texture properties. Changing these causes the backing texture to be lost.
+ // Setting these to the same value is a no-op.
+ void setTextureManager(CCPrioritizedTextureManager*);
+ CCPrioritizedTextureManager* textureManager() { return m_manager; }
+ void setDimensions(IntSize, GC3Denum format);
+ GC3Denum format() const { return m_format; }
+ IntSize size() const { return m_size; }
+ size_t bytes() const { return m_bytes; }
+
+ // Set priority for the requested texture.
+ void setRequestPriority(int priority) { m_priority = priority; }
+ int requestPriority() const { return m_priority; }
+
+ // After CCPrioritizedTexture::prioritizeTextures() is called, this returns
+ // if the the request succeeded and this texture can be acquired for use.
+ bool canAcquireBackingTexture() const { return m_isAbovePriorityCutoff; }
+
+ // This returns whether we still have a backing texture. This can continue
+ // to be true even after canAcquireBackingTexture() becomes false. In this
+ // case the texture can be used but shouldn't be updated since it will get
+ // taken away "soon".
+ bool haveBackingTexture() const { return !!backing(); }
+
+ bool backingResourceWasEvicted() const;
+
+ // If canAcquireBackingTexture() is true acquireBackingTexture() will acquire
+ // a backing texture for use. Call this whenever the texture is actually needed.
+ void acquireBackingTexture(CCResourceProvider*);
+
+ // FIXME: Request late is really a hack for when we are totally out of memory
+ // (all textures are visible) but we can still squeeze into the limit
+ // by not painting occluded textures. In this case the manager
+ // refuses all visible textures and requestLate() will enable
+ // canAcquireBackingTexture() on a call-order basis. We might want to
+ // just remove this in the future (carefully) and just make sure we don't
+ // regress OOMs situations.
+ bool requestLate();
+
+ // Uploads pixels into the backing resource. This functions will aquire the backing if needed.
+ void upload(CCResourceProvider*, const uint8_t* image, const IntRect& imageRect, const IntRect& sourceRect, const IntSize& destOffset);
+
+ CCResourceProvider::ResourceId resourceId() const;
+
+ // Self-managed textures are accounted for when prioritizing other textures,
+ // but they are not allocated/recycled/deleted, so this needs to be done
+ // externally. canAcquireBackingTexture() indicates if the texture would have
+ // been allowed given its priority.
+ void setIsSelfManaged(bool isSelfManaged) { m_isSelfManaged = isSelfManaged; }
+ bool isSelfManaged() { return m_isSelfManaged; }
+ void setToSelfManagedMemoryPlaceholder(size_t bytes);
+
+private:
+ friend class CCPrioritizedTextureManager;
+ friend class CCPrioritizedTextureTest;
+
+ class Backing : public CCTexture {
+ public:
+ Backing(unsigned id, CCResourceProvider*, IntSize, GC3Denum format);
+ ~Backing();
+ void updatePriority();
+
+ CCPrioritizedTexture* owner() { return m_owner; }
+ bool hadOwnerAtLastPriorityUpdate() const { return m_ownerExistedAtLastPriorityUpdate; }
+ int requestPriorityAtLastPriorityUpdate() const { return m_priorityAtLastPriorityUpdate; }
+ bool wasAbovePriorityCutoffAtLastPriorityUpdate() const { return m_wasAbovePriorityCutoffAtLastPriorityUpdate; }
+
+ void deleteResource(CCResourceProvider*);
+ bool resourceHasBeenDeleted() const;
+
+ private:
+ friend class CCPrioritizedTexture;
+ CCPrioritizedTexture* m_owner;
+ int m_priorityAtLastPriorityUpdate;
+ bool m_ownerExistedAtLastPriorityUpdate;
+ bool m_wasAbovePriorityCutoffAtLastPriorityUpdate;
+ bool m_resourceHasBeenDeleted;
+#ifndef NDEBUG
+ CCResourceProvider* m_resourceProvider;
+#endif
+
+ DISALLOW_COPY_AND_ASSIGN(Backing);
+ };
+
+ CCPrioritizedTexture(CCPrioritizedTextureManager*, IntSize, GC3Denum format);
+
+ bool isAbovePriorityCutoff() { return m_isAbovePriorityCutoff; }
+ void setAbovePriorityCutoff(bool isAbovePriorityCutoff) { m_isAbovePriorityCutoff = isAbovePriorityCutoff; }
+ void setManagerInternal(CCPrioritizedTextureManager* manager) { m_manager = manager; }
+
+ Backing* backing() const { return m_backing; }
+ void link(Backing*);
+ void unlink();
+
+ IntSize m_size;
+ GC3Denum m_format;
+ size_t m_bytes;
+
+ int m_priority;
+ bool m_isAbovePriorityCutoff;
+ bool m_isSelfManaged;
+
+ Backing* m_backing;
+ CCPrioritizedTextureManager* m_manager;
+
+ DISALLOW_COPY_AND_ASSIGN(CCPrioritizedTexture);
+};
+
+} // namespace cc
+
+#endif
diff --git a/cc/CCPrioritizedTextureManager.cpp b/cc/prioritized_texture_manager.cc
index a609548..a609548 100644
--- a/cc/CCPrioritizedTextureManager.cpp
+++ b/cc/prioritized_texture_manager.cc
diff --git a/cc/prioritized_texture_manager.h b/cc/prioritized_texture_manager.h
index 638cbb2..1b3b1ed 100644
--- a/cc/prioritized_texture_manager.h
+++ b/cc/prioritized_texture_manager.h
@@ -1,3 +1,159 @@
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCPrioritizedTextureManager_h
+#define CCPrioritizedTextureManager_h
+
+#include "base/basictypes.h"
+#include "base/hash_tables.h"
+#include "base/memory/scoped_ptr.h"
+#include "CCPrioritizedTexture.h"
+#include "CCPriorityCalculator.h"
+#include "CCTexture.h"
+#include "GraphicsContext3D.h"
+#include "IntRect.h"
+#include "IntSize.h"
+#include <wtf/ListHashSet.h>
+#include <wtf/Vector.h>
+
+#if defined(COMPILER_GCC)
+namespace BASE_HASH_NAMESPACE {
+template<>
+struct hash<cc::CCPrioritizedTexture*> {
+ size_t operator()(cc::CCPrioritizedTexture* ptr) const {
+ return hash<size_t>()(reinterpret_cast<size_t>(ptr));
+ }
+};
+} // namespace BASE_HASH_NAMESPACE
+#endif // COMPILER
+
+namespace cc {
+
+class CCPriorityCalculator;
+
+class CCPrioritizedTextureManager {
+public:
+ static scoped_ptr<CCPrioritizedTextureManager> create(size_t maxMemoryLimitBytes, int maxTextureSize, int pool)
+ {
+ return make_scoped_ptr(new CCPrioritizedTextureManager(maxMemoryLimitBytes, maxTextureSize, pool));
+ }
+ scoped_ptr<CCPrioritizedTexture> createTexture(IntSize size, GC3Denum format)
+ {
+ return make_scoped_ptr(new CCPrioritizedTexture(this, size, format));
+ }
+ ~CCPrioritizedTextureManager();
+
+ typedef Vector<CCPrioritizedTexture::Backing*> BackingVector;
+
+ // FIXME (http://crbug.com/137094): This 64MB default is a straggler from the
+ // old texture manager and is just to give us a default memory allocation before
+ // we get a callback from the GPU memory manager. We should probaby either:
+ // - wait for the callback before rendering anything instead
+ // - push this into the GPU memory manager somehow.
+ static size_t defaultMemoryAllocationLimit() { return 64 * 1024 * 1024; }
+
+ // memoryUseBytes() describes the number of bytes used by existing allocated textures.
+ // memoryAboveCutoffBytes() describes the number of bytes that would be used if all
+ // textures that are above the cutoff were allocated.
+ // memoryUseBytes() <= memoryAboveCutoffBytes() should always be true.
+ size_t memoryUseBytes() const { return m_memoryUseBytes; }
+ size_t memoryAboveCutoffBytes() const { return m_memoryAboveCutoffBytes; }
+ size_t memoryForSelfManagedTextures() const { return m_maxMemoryLimitBytes - m_memoryAvailableBytes; }
+
+ void setMaxMemoryLimitBytes(size_t bytes) { m_maxMemoryLimitBytes = bytes; }
+ size_t maxMemoryLimitBytes() const { return m_maxMemoryLimitBytes; }
+
+ void prioritizeTextures();
+ void clearPriorities();
+
+ void reduceMemoryOnImplThread(size_t limitBytes, CCResourceProvider*);
+ bool evictedBackingsExist() const { return !m_evictedBackings.isEmpty(); }
+ void getEvictedBackings(BackingVector& evictedBackings);
+ void unlinkEvictedBackings(const BackingVector& evictedBackings);
+ // Deletes all evicted backings, unlinking them from their owning textures if needed.
+ // Returns true if this function unlinked any backings from their owning texture while
+ // destroying them.
+ bool deleteEvictedBackings();
+
+ bool requestLate(CCPrioritizedTexture*);
+
+ void reduceMemory(CCResourceProvider*);
+ void clearAllMemory(CCResourceProvider*);
+
+ void acquireBackingTextureIfNeeded(CCPrioritizedTexture*, CCResourceProvider*);
+
+ void registerTexture(CCPrioritizedTexture*);
+ void unregisterTexture(CCPrioritizedTexture*);
+ void returnBackingTexture(CCPrioritizedTexture*);
+
+private:
+ friend class CCPrioritizedTextureTest;
+
+ enum EvictionPriorityPolicy {
+ RespectManagerPriorityCutoff,
+ DoNotRespectManagerPriorityCutoff,
+ };
+
+ // Compare textures. Highest priority first.
+ static inline bool compareTextures(CCPrioritizedTexture* a, CCPrioritizedTexture* b)
+ {
+ if (a->requestPriority() == b->requestPriority())
+ return a < b;
+ return CCPriorityCalculator::priorityIsHigher(a->requestPriority(), b->requestPriority());
+ }
+ // Compare backings. Lowest priority first.
+ static inline bool compareBackings(CCPrioritizedTexture::Backing* a, CCPrioritizedTexture::Backing* b)
+ {
+ int priorityA = a->requestPriorityAtLastPriorityUpdate();
+ int priorityB = b->requestPriorityAtLastPriorityUpdate();
+ if (priorityA != priorityB)
+ return CCPriorityCalculator::priorityIsLower(priorityA, priorityB);
+ bool aboveCutoffA = a->wasAbovePriorityCutoffAtLastPriorityUpdate();
+ bool aboveCutoffB = b->wasAbovePriorityCutoffAtLastPriorityUpdate();
+ if (!aboveCutoffA && aboveCutoffB)
+ return true;
+ if (aboveCutoffA && !aboveCutoffB)
+ return false;
+ return a < b;
+ }
+
+ CCPrioritizedTextureManager(size_t maxMemoryLimitBytes, int maxTextureSize, int pool);
+
+ void updateBackingsPriorities();
+ void evictBackingsToReduceMemory(size_t limitBytes, EvictionPriorityPolicy, CCResourceProvider*);
+ CCPrioritizedTexture::Backing* createBacking(IntSize, GC3Denum format, CCResourceProvider*);
+ void evictBackingResource(CCPrioritizedTexture::Backing*, CCResourceProvider*);
+
+#if !ASSERT_DISABLED
+ void assertInvariants();
+#endif
+
+ size_t m_maxMemoryLimitBytes;
+ unsigned m_priorityCutoff;
+ size_t m_memoryUseBytes;
+ size_t m_memoryAboveCutoffBytes;
+ size_t m_memoryAvailableBytes;
+ int m_pool;
+
+ typedef base::hash_set<CCPrioritizedTexture*> TextureSet;
+ typedef ListHashSet<CCPrioritizedTexture::Backing*> BackingSet;
+ typedef Vector<CCPrioritizedTexture*> TextureVector;
+
+ TextureSet m_textures;
+ BackingSet m_backings;
+ BackingVector m_evictedBackings;
+
+ TextureVector m_tempTextureVector;
+ BackingVector m_tempBackingVector;
+
+ // Set by the main thread when it adjust priorities in such a way that
+ // the m_backings array's view of priorities is now out of date.
+ bool m_needsUpdateBackingsPrioritites;
+
+ DISALLOW_COPY_AND_ASSIGN(CCPrioritizedTextureManager);
+};
+
+} // namespace cc
+
+#endif
diff --git a/cc/CCPriorityCalculator.cpp b/cc/priority_calculator.cc
index 055520c..055520c 100644
--- a/cc/CCPriorityCalculator.cpp
+++ b/cc/priority_calculator.cc
diff --git a/cc/priority_calculator.h b/cc/priority_calculator.h
index 638cbb2..45f2e64 100644
--- a/cc/priority_calculator.h
+++ b/cc/priority_calculator.h
@@ -1,3 +1,32 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCPriorityCalculator_h
+#define CCPriorityCalculator_h
+
+#include "GraphicsContext3D.h"
+#include "IntRect.h"
+#include "IntSize.h"
+
+namespace cc {
+
+class CCPriorityCalculator {
+public:
+ static int uiPriority(bool drawsToRootSurface);
+ static int visiblePriority(bool drawsToRootSurface);
+ static int renderSurfacePriority();
+ static int lingeringPriority(int previousPriority);
+ static int priorityFromDistance(const IntRect& visibleRect, const IntRect& textureRect, bool drawsToRootSurface);
+ static int smallAnimatedLayerMinPriority();
+
+ static inline int highestPriority() { return std::numeric_limits<int>::min(); }
+ static inline int lowestPriority() { return std::numeric_limits<int>::max(); }
+ static inline bool priorityIsLower(int a, int b) { return a > b; }
+ static inline bool priorityIsHigher(int a, int b) { return a < b; }
+ static inline bool maxPriority(int a, int b) { return priorityIsHigher(a, b) ? a : b; }
+};
+
+}
+
+#endif
diff --git a/cc/ProgramBinding.cpp b/cc/program_binding.cc
index 27d5226..27d5226 100644
--- a/cc/ProgramBinding.cpp
+++ b/cc/program_binding.cc
diff --git a/cc/program_binding.h b/cc/program_binding.h
index 638cbb2..9f0d067 100644
--- a/cc/program_binding.h
+++ b/cc/program_binding.h
@@ -1,3 +1,84 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef ProgramBinding_h
+#define ProgramBinding_h
+
+#if USE(ACCELERATED_COMPOSITING)
+
+#include <string>
+
+namespace WebKit {
+class WebGraphicsContext3D;
+}
+
+namespace cc {
+
+class ProgramBindingBase {
+public:
+ ProgramBindingBase();
+ ~ProgramBindingBase();
+
+ void init(WebKit::WebGraphicsContext3D*, const std::string& vertexShader, const std::string& fragmentShader);
+ void link(WebKit::WebGraphicsContext3D*);
+ void cleanup(WebKit::WebGraphicsContext3D*);
+
+ unsigned program() const { ASSERT(m_initialized); return m_program; }
+ bool initialized() const { return m_initialized; }
+
+protected:
+
+ unsigned loadShader(WebKit::WebGraphicsContext3D*, unsigned type, const std::string& shaderSource);
+ unsigned createShaderProgram(WebKit::WebGraphicsContext3D*, unsigned vertexShader, unsigned fragmentShader);
+ void cleanupShaders(WebKit::WebGraphicsContext3D*);
+
+ unsigned m_program;
+ unsigned m_vertexShaderId;
+ unsigned m_fragmentShaderId;
+ bool m_initialized;
+};
+
+template<class VertexShader, class FragmentShader>
+class ProgramBinding : public ProgramBindingBase {
+public:
+ explicit ProgramBinding(WebKit::WebGraphicsContext3D* context)
+ {
+ ProgramBindingBase::init(context, m_vertexShader.getShaderString(), m_fragmentShader.getShaderString());
+ }
+
+ void initialize(WebKit::WebGraphicsContext3D* context, bool usingBindUniform)
+ {
+ ASSERT(context);
+ ASSERT(m_program);
+ ASSERT(!m_initialized);
+
+ // Need to bind uniforms before linking
+ if (!usingBindUniform)
+ link(context);
+
+ int baseUniformIndex = 0;
+ m_vertexShader.init(context, m_program, usingBindUniform, &baseUniformIndex);
+ m_fragmentShader.init(context, m_program, usingBindUniform, &baseUniformIndex);
+
+ // Link after binding uniforms
+ if (usingBindUniform)
+ link(context);
+
+ m_initialized = true;
+ }
+
+ const VertexShader& vertexShader() const { return m_vertexShader; }
+ const FragmentShader& fragmentShader() const { return m_fragmentShader; }
+
+private:
+
+ VertexShader m_vertexShader;
+ FragmentShader m_fragmentShader;
+};
+
+} // namespace cc
+
+#endif // USE(ACCELERATED_COMPOSITING)
+
+#endif
diff --git a/cc/CCProxy.cpp b/cc/proxy.cc
index bc5ae69..bc5ae69 100644
--- a/cc/CCProxy.cpp
+++ b/cc/proxy.cc
diff --git a/cc/proxy.h b/cc/proxy.h
index 638cbb2..30a62cc 100644
--- a/cc/proxy.h
+++ b/cc/proxy.h
@@ -1,3 +1,129 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCProxy_h
+#define CCProxy_h
+
+#include "base/basictypes.h"
+#include <public/WebCompositorOutputSurface.h>
+#include <wtf/PassOwnPtr.h>
+#include <wtf/PassRefPtr.h>
+
+namespace cc {
+
+class CCThread;
+class IntRect;
+class IntSize;
+struct CCRenderingStats;
+struct RendererCapabilities;
+
+// Abstract class responsible for proxying commands from the main-thread side of
+// the compositor over to the compositor implementation.
+class CCProxy {
+public:
+ static void setMainThread(CCThread*);
+ static CCThread* mainThread();
+
+ static bool hasImplThread();
+ static void setImplThread(CCThread*);
+ static CCThread* implThread();
+
+ // Returns 0 if the current thread is neither the main thread nor the impl thread.
+ static CCThread* currentThread();
+
+ virtual ~CCProxy();
+
+ virtual bool compositeAndReadback(void *pixels, const IntRect&) = 0;
+
+ virtual void startPageScaleAnimation(const IntSize& targetPosition, bool useAnchor, float scale, double durationSec) = 0;
+
+ virtual void finishAllRendering() = 0;
+
+ virtual bool isStarted() const = 0;
+
+ // Attempts to initialize a context to use for rendering. Returns false if the context could not be created.
+ // The context will not be used and no frames may be produced until initializeRenderer() is called.
+ virtual bool initializeContext() = 0;
+
+ // Indicates that the compositing surface associated with our context is ready to use.
+ virtual void setSurfaceReady() = 0;
+
+ virtual void setVisible(bool) = 0;
+
+ // Attempts to initialize the layer renderer. Returns false if the context isn't usable for compositing.
+ virtual bool initializeRenderer() = 0;
+
+ // Attempts to recreate the context and layer renderer after a context lost. Returns false if the renderer couldn't be
+ // reinitialized.
+ virtual bool recreateContext() = 0;
+
+ virtual void renderingStats(CCRenderingStats*) = 0;
+
+ virtual const RendererCapabilities& rendererCapabilities() const = 0;
+
+ virtual void setNeedsAnimate() = 0;
+ virtual void setNeedsCommit() = 0;
+ virtual void setNeedsRedraw() = 0;
+
+ virtual void didAddAnimation() = 0;
+
+ virtual bool commitRequested() const = 0;
+
+ virtual void start() = 0; // Must be called before using the proxy.
+ virtual void stop() = 0; // Must be called before deleting the proxy.
+
+ // Forces 3D commands on all contexts to wait for all previous SwapBuffers to finish before executing in the GPU
+ // process.
+ virtual void forceSerializeOnSwapBuffers() = 0;
+
+ // Maximum number of sub-region texture updates supported for each commit.
+ virtual size_t maxPartialTextureUpdates() const = 0;
+
+ virtual void acquireLayerTextures() = 0;
+
+ // Debug hooks
+#ifndef NDEBUG
+ static bool isMainThread();
+ static bool isImplThread();
+ static bool isMainThreadBlocked();
+ static void setMainThreadBlocked(bool);
+#endif
+
+ // Testing hooks
+ virtual void loseContext() = 0;
+
+#ifndef NDEBUG
+ static void setCurrentThreadIsImplThread(bool);
+#endif
+
+protected:
+ CCProxy();
+ friend class DebugScopedSetImplThread;
+ friend class DebugScopedSetMainThreadBlocked;
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(CCProxy);
+};
+
+class DebugScopedSetMainThreadBlocked {
+public:
+ DebugScopedSetMainThreadBlocked()
+ {
+#if !ASSERT_DISABLED
+ ASSERT(!CCProxy::isMainThreadBlocked());
+ CCProxy::setMainThreadBlocked(true);
+#endif
+ }
+ ~DebugScopedSetMainThreadBlocked()
+ {
+#if !ASSERT_DISABLED
+ ASSERT(CCProxy::isMainThreadBlocked());
+ CCProxy::setMainThreadBlocked(false);
+#endif
+ }
+};
+
+}
+
+#endif
diff --git a/cc/CCQuadCuller.cpp b/cc/quad_culler.cc
index 8955a98..8955a98 100644
--- a/cc/CCQuadCuller.cpp
+++ b/cc/quad_culler.cc
diff --git a/cc/quad_culler.h b/cc/quad_culler.h
index 638cbb2..b3927cc 100644
--- a/cc/quad_culler.h
+++ b/cc/quad_culler.h
@@ -1,3 +1,37 @@
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCQuadCuller_h
+#define CCQuadCuller_h
+
+#include "CCQuadSink.h"
+#include "CCRenderPass.h"
+
+namespace cc {
+class CCLayerImpl;
+class CCRenderSurface;
+template<typename LayerType, typename SurfaceType>
+class CCOcclusionTrackerBase;
+
+class CCQuadCuller : public CCQuadSink {
+public:
+ CCQuadCuller(CCQuadList&, CCSharedQuadStateList&, CCLayerImpl*, const CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface>*, bool showCullingWithDebugBorderQuads, bool forSurface);
+ virtual ~CCQuadCuller() { }
+
+ // CCQuadSink implementation.
+ virtual CCSharedQuadState* useSharedQuadState(scoped_ptr<CCSharedQuadState>) OVERRIDE;
+ virtual bool append(scoped_ptr<CCDrawQuad>, CCAppendQuadsData&) OVERRIDE;
+
+private:
+ CCQuadList& m_quadList;
+ CCSharedQuadStateList& m_sharedQuadStateList;
+ CCSharedQuadState* m_currentSharedQuadState;
+ CCLayerImpl* m_layer;
+ const CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface>* m_occlusionTracker;
+ bool m_showCullingWithDebugBorderQuads;
+ bool m_forSurface;
+};
+
+}
+#endif // CCQuadCuller_h
diff --git a/cc/quad_sink.h b/cc/quad_sink.h
index 638cbb2..06d31b0 100644
--- a/cc/quad_sink.h
+++ b/cc/quad_sink.h
@@ -1,3 +1,30 @@
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCQuadSink_h
+#define CCQuadSink_h
+
+#include "base/memory/scoped_ptr.h"
+
+namespace cc {
+
+class CCDrawQuad;
+
+struct CCAppendQuadsData;
+struct CCSharedQuadState;
+
+class CCQuadSink {
+public:
+ virtual ~CCQuadSink() { }
+
+ // Call this to add a SharedQuadState before appending quads that refer to it. Returns a pointer
+ // to the given SharedQuadState for convenience, that can be set on the quads to append.
+ virtual CCSharedQuadState* useSharedQuadState(scoped_ptr<CCSharedQuadState>) = 0;
+
+ // Returns true if the quad is added to the list, and false if the quad is entirely culled.
+ virtual bool append(scoped_ptr<CCDrawQuad> passDrawQuad, CCAppendQuadsData&) = 0;
+};
+
+}
+#endif // CCQuadCuller_h
diff --git a/cc/RateLimiter.cpp b/cc/rate_limiter.cc
index a521525..a521525 100644
--- a/cc/RateLimiter.cpp
+++ b/cc/rate_limiter.cc
diff --git a/cc/rate_limiter.h b/cc/rate_limiter.h
index 638cbb2..7b48d74 100644
--- a/cc/rate_limiter.h
+++ b/cc/rate_limiter.h
@@ -1,3 +1,53 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef RateLimiter_h
+#define RateLimiter_h
+
+#if USE(ACCELERATED_COMPOSITING)
+
+#include "base/memory/ref_counted.h"
+
+namespace WebKit {
+class WebGraphicsContext3D;
+}
+
+namespace cc {
+
+class RateLimiterClient {
+public:
+ virtual void rateLimit() = 0;
+};
+
+// A RateLimiter can be used to make sure that a single context does not dominate all execution time.
+// To use, construct a RateLimiter class around the context and call start() whenever calls are made on the
+// context outside of normal flow control. RateLimiter will block if the context is too far ahead of the
+// compositor.
+class RateLimiter : public base::RefCounted<RateLimiter> {
+public:
+ static scoped_refptr<RateLimiter> create(WebKit::WebGraphicsContext3D*, RateLimiterClient*);
+
+ void start();
+
+ // Context and client will not be accessed after stop().
+ void stop();
+
+private:
+ RateLimiter(WebKit::WebGraphicsContext3D*, RateLimiterClient*);
+ ~RateLimiter();
+ friend class base::RefCounted<RateLimiter>;
+
+ class Task;
+ friend class Task;
+ void rateLimitContext();
+
+ WebKit::WebGraphicsContext3D* m_context;
+ bool m_active;
+ RateLimiterClient *m_client;
+};
+
+}
+#endif // USE(ACCELERATED_COMPOSITING)
+
+#endif
diff --git a/cc/CCRenderPass.cpp b/cc/render_pass.cc
index 513bd8b..513bd8b 100644
--- a/cc/CCRenderPass.cpp
+++ b/cc/render_pass.cc
diff --git a/cc/render_pass.h b/cc/render_pass.h
index 638cbb2..cdfa958 100644
--- a/cc/render_pass.h
+++ b/cc/render_pass.h
@@ -1,3 +1,140 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCRenderPass_h
+#define CCRenderPass_h
+
+#include "base/basictypes.h"
+#include "cc/hash_pair.h"
+#include "cc/scoped_ptr_hash_map.h"
+#include "cc/scoped_ptr_vector.h"
+#include "CCDrawQuad.h"
+#include "CCSharedQuadState.h"
+#include "FloatRect.h"
+#include "SkColor.h"
+#include <public/WebFilterOperations.h>
+#include <public/WebTransformationMatrix.h>
+#include <vector>
+
+namespace cc {
+
+class CCLayerImpl;
+template<typename LayerType, typename SurfaceType>
+class CCOcclusionTrackerBase;
+class CCRenderSurface;
+
+struct CCAppendQuadsData;
+
+typedef CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface> CCOcclusionTrackerImpl;
+
+// A list of CCDrawQuad objects, sorted internally in front-to-back order.
+class CCQuadList : public ScopedPtrVector<CCDrawQuad> {
+public:
+ typedef reverse_iterator backToFrontIterator;
+ typedef const_reverse_iterator constBackToFrontIterator;
+
+ inline backToFrontIterator backToFrontBegin() { return rbegin(); }
+ inline backToFrontIterator backToFrontEnd() { return rend(); }
+ inline constBackToFrontIterator backToFrontBegin() const { return rbegin(); }
+ inline constBackToFrontIterator backToFrontEnd() const { return rend(); }
+};
+
+typedef ScopedPtrVector<CCSharedQuadState> CCSharedQuadStateList;
+
+class CCRenderPass {
+public:
+ ~CCRenderPass();
+
+ struct Id {
+ int layerId;
+ int index;
+
+ Id(int layerId, int index)
+ : layerId(layerId)
+ , index(index)
+ {
+ }
+
+ bool operator==(const Id& other) const { return layerId == other.layerId && index == other.index; }
+ bool operator!=(const Id& other) const { return !(*this == other); }
+ bool operator<(const Id& other) const { return layerId < other.layerId || (layerId == other.layerId && index < other.index); }
+ };
+
+ static scoped_ptr<CCRenderPass> create(Id, IntRect outputRect, const WebKit::WebTransformationMatrix& transformToRootTarget);
+
+ // A shallow copy of the render pass, which does not include its quads.
+ scoped_ptr<CCRenderPass> copy(Id newId) const;
+
+ void appendQuadsForLayer(CCLayerImpl*, CCOcclusionTrackerImpl*, CCAppendQuadsData&);
+ void appendQuadsForRenderSurfaceLayer(CCLayerImpl*, const CCRenderPass* contributingRenderPass, CCOcclusionTrackerImpl*, CCAppendQuadsData&);
+ void appendQuadsToFillScreen(CCLayerImpl* rootLayer, SkColor screenBackgroundColor, const CCOcclusionTrackerImpl&);
+
+ const CCQuadList& quadList() const { return m_quadList; }
+
+ Id id() const { return m_id; }
+
+ // FIXME: Modify this transform when merging the RenderPass into a parent compositor.
+ // Transforms from quad's original content space to the root target's content space.
+ const WebKit::WebTransformationMatrix& transformToRootTarget() const { return m_transformToRootTarget; }
+
+ // This denotes the bounds in physical pixels of the output generated by this RenderPass.
+ const IntRect& outputRect() const { return m_outputRect; }
+
+ FloatRect damageRect() const { return m_damageRect; }
+ void setDamageRect(FloatRect rect) { m_damageRect = rect; }
+
+ const WebKit::WebFilterOperations& filters() const { return m_filters; }
+ void setFilters(const WebKit::WebFilterOperations& filters) { m_filters = filters; }
+
+ const WebKit::WebFilterOperations& backgroundFilters() const { return m_backgroundFilters; }
+ void setBackgroundFilters(const WebKit::WebFilterOperations& filters) { m_backgroundFilters = filters; }
+
+ bool hasTransparentBackground() const { return m_hasTransparentBackground; }
+ void setHasTransparentBackground(bool transparent) { m_hasTransparentBackground = transparent; }
+
+ bool hasOcclusionFromOutsideTargetSurface() const { return m_hasOcclusionFromOutsideTargetSurface; }
+ void setHasOcclusionFromOutsideTargetSurface(bool hasOcclusionFromOutsideTargetSurface) { m_hasOcclusionFromOutsideTargetSurface = hasOcclusionFromOutsideTargetSurface; }
+protected:
+ CCRenderPass(Id, IntRect outputRect, const WebKit::WebTransformationMatrix& transformToRootTarget);
+
+ Id m_id;
+ CCQuadList m_quadList;
+ CCSharedQuadStateList m_sharedQuadStateList;
+ WebKit::WebTransformationMatrix m_transformToRootTarget;
+ IntRect m_outputRect;
+ FloatRect m_damageRect;
+ bool m_hasTransparentBackground;
+ bool m_hasOcclusionFromOutsideTargetSurface;
+ WebKit::WebFilterOperations m_filters;
+ WebKit::WebFilterOperations m_backgroundFilters;
+
+ DISALLOW_COPY_AND_ASSIGN(CCRenderPass);
+};
+
+} // namespace cc
+
+namespace BASE_HASH_NAMESPACE {
+#if defined(COMPILER_MSVC)
+template<>
+inline size_t hash_value<cc::CCRenderPass::Id>(const cc::CCRenderPass::Id& key) {
+ return hash_value<std::pair<int, int> >(std::pair<int, int>(key.layerId, key.index));
+}
+#elif defined(COMPILER_GCC)
+template<>
+struct hash<cc::CCRenderPass::Id> {
+ size_t operator()(cc::CCRenderPass::Id key) const {
+ return hash<std::pair<int, int> >()(std::pair<int, int>(key.layerId, key.index));
+ }
+};
+#else
+#error define a hash function for your compiler
+#endif // COMPILER
+}
+
+namespace cc {
+typedef std::vector<CCRenderPass*> CCRenderPassList;
+typedef ScopedPtrHashMap<CCRenderPass::Id, CCRenderPass> CCRenderPassIdHashMap;
+} // namespace cc
+
+#endif
diff --git a/cc/CCRenderPassDrawQuad.cpp b/cc/render_pass_draw_quad.cc
index 9e385c6..9e385c6 100644
--- a/cc/CCRenderPassDrawQuad.cpp
+++ b/cc/render_pass_draw_quad.cc
diff --git a/cc/render_pass_draw_quad.h b/cc/render_pass_draw_quad.h
index 638cbb2..99222d9 100644
--- a/cc/render_pass_draw_quad.h
+++ b/cc/render_pass_draw_quad.h
@@ -1,3 +1,51 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCRenderPassDrawQuad_h
+#define CCRenderPassDrawQuad_h
+
+#include "base/basictypes.h"
+#include "base/memory/scoped_ptr.h"
+#include "CCDrawQuad.h"
+#include "CCRenderPass.h"
+#include "CCResourceProvider.h"
+#include "IntRect.h"
+
+namespace cc {
+
+class CCRenderPassDrawQuad : public CCDrawQuad {
+public:
+ static scoped_ptr<CCRenderPassDrawQuad> create(const CCSharedQuadState*, const IntRect&, CCRenderPass::Id renderPassId, bool isReplica, CCResourceProvider::ResourceId maskResourceId, const IntRect& contentsChangedSinceLastFrame, float maskTexCoordScaleX, float maskTexCoordScaleY, float maskTexCoordOffsetX, float maskTexCoordOffsetY);
+
+ CCRenderPass::Id renderPassId() const { return m_renderPassId; }
+ bool isReplica() const { return m_isReplica; }
+ CCResourceProvider::ResourceId maskResourceId() const { return m_maskResourceId; }
+ const IntRect& contentsChangedSinceLastFrame() const { return m_contentsChangedSinceLastFrame; }
+
+ static const CCRenderPassDrawQuad* materialCast(const CCDrawQuad*);
+ float maskTexCoordScaleX() const { return m_maskTexCoordScaleX; }
+ float maskTexCoordScaleY() const { return m_maskTexCoordScaleY; }
+ float maskTexCoordOffsetX() const { return m_maskTexCoordOffsetX; }
+ float maskTexCoordOffsetY() const { return m_maskTexCoordOffsetY; }
+
+ scoped_ptr<CCRenderPassDrawQuad> copy(const CCSharedQuadState* copiedSharedQuadState, CCRenderPass::Id copiedRenderPassId) const;
+
+private:
+ CCRenderPassDrawQuad(const CCSharedQuadState*, const IntRect&, CCRenderPass::Id renderPassId, bool isReplica, CCResourceProvider::ResourceId maskResourceId, const IntRect& contentsChangedSinceLastFrame, float maskTexCoordScaleX, float maskTexCoordScaleY, float maskTexCoordOffsetX, float maskTexCoordOffsetY);
+
+ CCRenderPass::Id m_renderPassId;
+ bool m_isReplica;
+ CCResourceProvider::ResourceId m_maskResourceId;
+ IntRect m_contentsChangedSinceLastFrame;
+ float m_maskTexCoordScaleX;
+ float m_maskTexCoordScaleY;
+ float m_maskTexCoordOffsetX;
+ float m_maskTexCoordOffsetY;
+
+ DISALLOW_COPY_AND_ASSIGN(CCRenderPassDrawQuad);
+};
+
+}
+
+#endif
diff --git a/cc/render_pass_sink.h b/cc/render_pass_sink.h
index 638cbb2..f3bac1d 100644
--- a/cc/render_pass_sink.h
+++ b/cc/render_pass_sink.h
@@ -1,3 +1,20 @@
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCRenderPassSink_h
+#define CCRenderPassSink_h
+
+#include "base/memory/scoped_ptr.h"
+
+namespace cc {
+
+class CCRenderPass;
+
+class CCRenderPassSink {
+public:
+ virtual void appendRenderPass(scoped_ptr<CCRenderPass>) = 0;
+};
+
+}
+#endif // CCRenderPassSink_h
diff --git a/cc/RenderSurfaceChromium.cpp b/cc/render_surface.cc
index 320a3d8..320a3d8 100644
--- a/cc/RenderSurfaceChromium.cpp
+++ b/cc/render_surface.cc
diff --git a/cc/render_surface.h b/cc/render_surface.h
index 638cbb2..67ed626 100644
--- a/cc/render_surface.h
+++ b/cc/render_surface.h
@@ -1,3 +1,107 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+
+#ifndef RenderSurfaceChromium_h
+#define RenderSurfaceChromium_h
+
+#if USE(ACCELERATED_COMPOSITING)
+
+#include "base/basictypes.h"
+#include "base/memory/ref_counted.h"
+#include "FloatRect.h"
+#include "IntRect.h"
+#include <public/WebTransformationMatrix.h>
+#include <vector>
+
+namespace cc {
+
+class LayerChromium;
+
+class RenderSurfaceChromium {
+public:
+ explicit RenderSurfaceChromium(LayerChromium*);
+ ~RenderSurfaceChromium();
+
+ // Returns the rect that encloses the RenderSurface including any reflection.
+ FloatRect drawableContentRect() const;
+
+ const IntRect& contentRect() const { return m_contentRect; }
+ void setContentRect(const IntRect& contentRect) { m_contentRect = contentRect; }
+
+ float drawOpacity() const { return m_drawOpacity; }
+ void setDrawOpacity(float drawOpacity) { m_drawOpacity = drawOpacity; }
+
+ bool drawOpacityIsAnimating() const { return m_drawOpacityIsAnimating; }
+ void setDrawOpacityIsAnimating(bool drawOpacityIsAnimating) { m_drawOpacityIsAnimating = drawOpacityIsAnimating; }
+
+ // This goes from content space with the origin in the center of the rect being transformed to the target space with the origin in the top left of the
+ // rect being transformed. Position the rect so that the origin is in the center of it before applying this transform.
+ const WebKit::WebTransformationMatrix& drawTransform() const { return m_drawTransform; }
+ void setDrawTransform(const WebKit::WebTransformationMatrix& drawTransform) { m_drawTransform = drawTransform; }
+
+ const WebKit::WebTransformationMatrix& screenSpaceTransform() const { return m_screenSpaceTransform; }
+ void setScreenSpaceTransform(const WebKit::WebTransformationMatrix& screenSpaceTransform) { m_screenSpaceTransform = screenSpaceTransform; }
+
+ const WebKit::WebTransformationMatrix& replicaDrawTransform() const { return m_replicaDrawTransform; }
+ void setReplicaDrawTransform(const WebKit::WebTransformationMatrix& replicaDrawTransform) { m_replicaDrawTransform = replicaDrawTransform; }
+
+ const WebKit::WebTransformationMatrix& replicaScreenSpaceTransform() const { return m_replicaScreenSpaceTransform; }
+ void setReplicaScreenSpaceTransform(const WebKit::WebTransformationMatrix& replicaScreenSpaceTransform) { m_replicaScreenSpaceTransform = replicaScreenSpaceTransform; }
+
+ bool targetSurfaceTransformsAreAnimating() const { return m_targetSurfaceTransformsAreAnimating; }
+ void setTargetSurfaceTransformsAreAnimating(bool animating) { m_targetSurfaceTransformsAreAnimating = animating; }
+ bool screenSpaceTransformsAreAnimating() const { return m_screenSpaceTransformsAreAnimating; }
+ void setScreenSpaceTransformsAreAnimating(bool animating) { m_screenSpaceTransformsAreAnimating = animating; }
+
+ const IntRect& clipRect() const { return m_clipRect; }
+ void setClipRect(const IntRect& clipRect) { m_clipRect = clipRect; }
+
+ typedef std::vector<scoped_refptr<LayerChromium> > LayerList;
+ LayerList& layerList() { return m_layerList; }
+ // A no-op since DelegatedRendererLayers on the main thread don't have any
+ // RenderPasses so they can't contribute to a surface.
+ void addContributingDelegatedRenderPassLayer(LayerChromium*) { }
+ void clearLayerLists() { m_layerList.clear(); }
+
+ void setNearestAncestorThatMovesPixels(RenderSurfaceChromium* surface) { m_nearestAncestorThatMovesPixels = surface; }
+ const RenderSurfaceChromium* nearestAncestorThatMovesPixels() const { return m_nearestAncestorThatMovesPixels; }
+
+private:
+ friend struct CCLayerIteratorActions;
+
+ LayerChromium* m_owningLayer;
+
+ // Uses this surface's space.
+ IntRect m_contentRect;
+
+ float m_drawOpacity;
+ bool m_drawOpacityIsAnimating;
+ WebKit::WebTransformationMatrix m_drawTransform;
+ WebKit::WebTransformationMatrix m_screenSpaceTransform;
+ WebKit::WebTransformationMatrix m_replicaDrawTransform;
+ WebKit::WebTransformationMatrix m_replicaScreenSpaceTransform;
+ bool m_targetSurfaceTransformsAreAnimating;
+ bool m_screenSpaceTransformsAreAnimating;
+
+ // Uses the space of the surface's target surface.
+ IntRect m_clipRect;
+
+ LayerList m_layerList;
+
+ // The nearest ancestor target surface that will contain the contents of this surface, and that is going
+ // to move pixels within the surface (such as with a blur). This can point to itself.
+ RenderSurfaceChromium* m_nearestAncestorThatMovesPixels;
+
+ // For CCLayerIteratorActions
+ int m_targetRenderSurfaceLayerIndexHistory;
+ int m_currentLayerIndexHistory;
+
+ DISALLOW_COPY_AND_ASSIGN(RenderSurfaceChromium);
+};
+
+}
+#endif // USE(ACCELERATED_COMPOSITING)
+
+#endif
diff --git a/cc/CCRenderSurfaceFilters.cpp b/cc/render_surface_filters.cc
index 40344c6..40344c6 100644
--- a/cc/CCRenderSurfaceFilters.cpp
+++ b/cc/render_surface_filters.cc
diff --git a/cc/render_surface_filters.h b/cc/render_surface_filters.h
index 638cbb2..cd199b5 100644
--- a/cc/render_surface_filters.h
+++ b/cc/render_surface_filters.h
@@ -1,3 +1,34 @@
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+
+#ifndef CCRenderSurfaceFilters_h
+#define CCRenderSurfaceFilters_h
+
+#if USE(ACCELERATED_COMPOSITING)
+
+class GrContext;
+class SkBitmap;
+
+namespace WebKit {
+class WebFilterOperations;
+class WebGraphicsContext3D;
+}
+
+namespace cc {
+class FloatSize;
+
+class CCRenderSurfaceFilters {
+public:
+ static SkBitmap apply(const WebKit::WebFilterOperations& filters, unsigned textureId, const FloatSize&, WebKit::WebGraphicsContext3D*, GrContext*);
+ static WebKit::WebFilterOperations optimize(const WebKit::WebFilterOperations& filters);
+
+private:
+ CCRenderSurfaceFilters();
+};
+
+}
+#endif // USE(ACCELERATED_COMPOSITING)
+
+#endif
diff --git a/cc/CCRenderSurface.cpp b/cc/render_surface_impl.cc
index f10c83b..f10c83b 100644
--- a/cc/CCRenderSurface.cpp
+++ b/cc/render_surface_impl.cc
diff --git a/cc/render_surface_impl.h b/cc/render_surface_impl.h
index 638cbb2..afdf062 100644
--- a/cc/render_surface_impl.h
+++ b/cc/render_surface_impl.h
@@ -1,3 +1,132 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCRenderSurface_h
+#define CCRenderSurface_h
+
+#if USE(ACCELERATED_COMPOSITING)
+
+#include "base/basictypes.h"
+#include "base/memory/scoped_ptr.h"
+#include "CCRenderPass.h"
+#include "CCSharedQuadState.h"
+#include "FloatRect.h"
+#include "IntRect.h"
+#include <public/WebTransformationMatrix.h>
+
+namespace cc {
+
+class CCDamageTracker;
+class CCDelegatedRendererLayerImpl;
+class CCQuadSink;
+class CCRenderPassSink;
+class CCLayerImpl;
+
+struct CCAppendQuadsData;
+
+class CCRenderSurface {
+public:
+ explicit CCRenderSurface(CCLayerImpl*);
+ virtual ~CCRenderSurface();
+
+ std::string name() const;
+ void dumpSurface(std::string*, int indent) const;
+
+ FloatPoint contentRectCenter() const { return FloatRect(m_contentRect).center(); }
+
+ // Returns the rect that encloses the RenderSurface including any reflection.
+ FloatRect drawableContentRect() const;
+
+ float drawOpacity() const { return m_drawOpacity; }
+ void setDrawOpacity(float opacity) { m_drawOpacity = opacity; }
+
+ void setNearestAncestorThatMovesPixels(CCRenderSurface* surface) { m_nearestAncestorThatMovesPixels = surface; }
+ const CCRenderSurface* nearestAncestorThatMovesPixels() const { return m_nearestAncestorThatMovesPixels; }
+
+ bool drawOpacityIsAnimating() const { return m_drawOpacityIsAnimating; }
+ void setDrawOpacityIsAnimating(bool drawOpacityIsAnimating) { m_drawOpacityIsAnimating = drawOpacityIsAnimating; }
+
+ void setDrawTransform(const WebKit::WebTransformationMatrix& drawTransform) { m_drawTransform = drawTransform; }
+ const WebKit::WebTransformationMatrix& drawTransform() const { return m_drawTransform; }
+
+ void setScreenSpaceTransform(const WebKit::WebTransformationMatrix& screenSpaceTransform) { m_screenSpaceTransform = screenSpaceTransform; }
+ const WebKit::WebTransformationMatrix& screenSpaceTransform() const { return m_screenSpaceTransform; }
+
+ void setReplicaDrawTransform(const WebKit::WebTransformationMatrix& replicaDrawTransform) { m_replicaDrawTransform = replicaDrawTransform; }
+ const WebKit::WebTransformationMatrix& replicaDrawTransform() const { return m_replicaDrawTransform; }
+
+ void setReplicaScreenSpaceTransform(const WebKit::WebTransformationMatrix& replicaScreenSpaceTransform) { m_replicaScreenSpaceTransform = replicaScreenSpaceTransform; }
+ const WebKit::WebTransformationMatrix& replicaScreenSpaceTransform() const { return m_replicaScreenSpaceTransform; }
+
+ bool targetSurfaceTransformsAreAnimating() const { return m_targetSurfaceTransformsAreAnimating; }
+ void setTargetSurfaceTransformsAreAnimating(bool animating) { m_targetSurfaceTransformsAreAnimating = animating; }
+ bool screenSpaceTransformsAreAnimating() const { return m_screenSpaceTransformsAreAnimating; }
+ void setScreenSpaceTransformsAreAnimating(bool animating) { m_screenSpaceTransformsAreAnimating = animating; }
+
+ void setClipRect(const IntRect&);
+ const IntRect& clipRect() const { return m_clipRect; }
+
+ bool contentsChanged() const;
+
+ void setContentRect(const IntRect&);
+ const IntRect& contentRect() const { return m_contentRect; }
+
+ std::vector<CCLayerImpl*>& layerList() { return m_layerList; }
+ void addContributingDelegatedRenderPassLayer(CCLayerImpl*);
+ void clearLayerLists();
+
+ int owningLayerId() const;
+
+ void resetPropertyChangedFlag() { m_surfacePropertyChanged = false; }
+ bool surfacePropertyChanged() const;
+ bool surfacePropertyChangedOnlyFromDescendant() const;
+
+ CCDamageTracker* damageTracker() const { return m_damageTracker.get(); }
+
+ CCRenderPass::Id renderPassId();
+
+ void appendRenderPasses(CCRenderPassSink&);
+ void appendQuads(CCQuadSink&, CCAppendQuadsData&, bool forReplica, CCRenderPass::Id renderPassId);
+
+private:
+ CCLayerImpl* m_owningLayer;
+
+ // Uses this surface's space.
+ IntRect m_contentRect;
+ bool m_surfacePropertyChanged;
+
+ float m_drawOpacity;
+ bool m_drawOpacityIsAnimating;
+ WebKit::WebTransformationMatrix m_drawTransform;
+ WebKit::WebTransformationMatrix m_screenSpaceTransform;
+ WebKit::WebTransformationMatrix m_replicaDrawTransform;
+ WebKit::WebTransformationMatrix m_replicaScreenSpaceTransform;
+ bool m_targetSurfaceTransformsAreAnimating;
+ bool m_screenSpaceTransformsAreAnimating;
+
+ // Uses the space of the surface's target surface.
+ IntRect m_clipRect;
+
+ std::vector<CCLayerImpl*> m_layerList;
+ std::vector<CCDelegatedRendererLayerImpl*> m_contributingDelegatedRenderPassLayerList;
+
+ // The nearest ancestor target surface that will contain the contents of this surface, and that is going
+ // to move pixels within the surface (such as with a blur). This can point to itself.
+ CCRenderSurface* m_nearestAncestorThatMovesPixels;
+
+ scoped_ptr<CCDamageTracker> m_damageTracker;
+
+ // For CCLayerIteratorActions
+ int m_targetRenderSurfaceLayerIndexHistory;
+ int m_currentLayerIndexHistory;
+
+ friend struct CCLayerIteratorActions;
+
+ DISALLOW_COPY_AND_ASSIGN(CCRenderSurface);
+};
+
+}
+#endif // USE(ACCELERATED_COMPOSITING)
+
+#endif
diff --git a/cc/CCRenderer.cpp b/cc/renderer.cc
index 69c04df..69c04df 100644
--- a/cc/CCRenderer.cpp
+++ b/cc/renderer.cc
diff --git a/cc/renderer.h b/cc/renderer.h
index 638cbb2..740ba0b 100644
--- a/cc/renderer.h
+++ b/cc/renderer.h
@@ -1,3 +1,84 @@
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCRenderer_h
+#define CCRenderer_h
+
+#include "base/basictypes.h"
+#include "CCLayerTreeHost.h"
+#include "CCRenderPass.h"
+#include "FloatQuad.h"
+#include "IntRect.h"
+#include <wtf/PassRefPtr.h>
+
+namespace cc {
+
+class CCScopedTexture;
+
+class CCRendererClient {
+public:
+ virtual const IntSize& deviceViewportSize() const = 0;
+ virtual const CCLayerTreeSettings& settings() const = 0;
+ virtual void didLoseContext() = 0;
+ virtual void onSwapBuffersComplete() = 0;
+ virtual void releaseContentsTextures() = 0;
+ virtual void setFullRootLayerDamage() = 0;
+ virtual void setMemoryAllocationLimitBytes(size_t) = 0;
+protected:
+ virtual ~CCRendererClient() { }
+};
+
+class CCRenderer {
+public:
+ // This enum defines the various resource pools for the CCResourceProvider
+ // where textures get allocated.
+ enum ResourcePool {
+ ImplPool = 1, // This pool is for textures that get allocated on the impl thread (e.g. RenderSurfaces).
+ ContentPool // This pool is for textures that get allocated on the main thread (e.g. tiles).
+ };
+
+ virtual ~CCRenderer() { }
+
+ virtual const RendererCapabilities& capabilities() const = 0;
+
+ const CCLayerTreeSettings& settings() const { return m_client->settings(); }
+
+ const IntSize& viewportSize() { return m_client->deviceViewportSize(); }
+ int viewportWidth() { return viewportSize().width(); }
+ int viewportHeight() { return viewportSize().height(); }
+
+ virtual void viewportChanged() { }
+
+ virtual void decideRenderPassAllocationsForFrame(const CCRenderPassList&) { }
+ virtual bool haveCachedResourcesForRenderPassId(CCRenderPass::Id) const;
+
+ virtual void drawFrame(const CCRenderPassList&, const CCRenderPassIdHashMap&) = 0;
+
+ // waits for rendering to finish
+ virtual void finish() = 0;
+
+ virtual void doNoOp() { }
+ // puts backbuffer onscreen
+ virtual bool swapBuffers() = 0;
+
+ virtual void getFramebufferPixels(void *pixels, const IntRect&) = 0;
+
+ virtual bool isContextLost();
+
+ virtual void setVisible(bool) = 0;
+
+protected:
+ explicit CCRenderer(CCRendererClient* client)
+ : m_client(client)
+ {
+ }
+
+ CCRendererClient* m_client;
+
+ DISALLOW_COPY_AND_ASSIGN(CCRenderer);
+};
+
+}
+
+#endif // CCRenderer_h
diff --git a/cc/rendering_stats.h b/cc/rendering_stats.h
index 638cbb2..fb178a8 100644
--- a/cc/rendering_stats.h
+++ b/cc/rendering_stats.h
@@ -1,3 +1,38 @@
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCRenderingStats_h
+#define CCRenderingStats_h
+
+namespace cc {
+
+struct CCRenderingStats {
+ // FIXME: Rename these to animationFrameCount and screenFrameCount, crbug.com/138641.
+ int numAnimationFrames;
+ int numFramesSentToScreen;
+ int droppedFrameCount;
+ double totalPaintTimeInSeconds;
+ double totalRasterizeTimeInSeconds;
+ double totalCommitTimeInSeconds;
+ size_t totalCommitCount;
+ size_t numImplThreadScrolls;
+ size_t numMainThreadScrolls;
+
+ CCRenderingStats()
+ : numAnimationFrames(0)
+ , numFramesSentToScreen(0)
+ , droppedFrameCount(0)
+ , totalPaintTimeInSeconds(0)
+ , totalRasterizeTimeInSeconds(0)
+ , totalCommitTimeInSeconds(0)
+ , totalCommitCount(0)
+ , numImplThreadScrolls(0)
+ , numMainThreadScrolls(0)
+ {
+ }
+};
+
+}
+
+#endif
diff --git a/cc/CCResourceProvider.cpp b/cc/resource_provider.cc
index 29ca7d4..29ca7d4 100644
--- a/cc/CCResourceProvider.cpp
+++ b/cc/resource_provider.cc
diff --git a/cc/resource_provider.h b/cc/resource_provider.h
index 638cbb2..f515c11 100644
--- a/cc/resource_provider.h
+++ b/cc/resource_provider.h
@@ -1,3 +1,275 @@
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCResourceProvider_h
+#define CCResourceProvider_h
+
+#include "base/basictypes.h"
+#include "CCGraphicsContext.h"
+#include "GraphicsContext3D.h"
+#include "IntSize.h"
+#include "SkBitmap.h"
+#include "SkCanvas.h"
+#include "TextureCopier.h"
+#include <wtf/Deque.h>
+#include <wtf/HashMap.h>
+#include <wtf/OwnPtr.h>
+#include <wtf/PassOwnPtr.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
+#include <wtf/Vector.h>
+
+namespace WebKit {
+class WebGraphicsContext3D;
+}
+
+namespace cc {
+
+class IntRect;
+class LayerTextureSubImage;
+class TextureCopier;
+class TextureUploader;
+
+// Thread-safety notes: this class is not thread-safe and can only be called
+// from the thread it was created on (in practice, the compositor thread).
+class CCResourceProvider {
+public:
+ typedef unsigned ResourceId;
+ typedef Vector<ResourceId> ResourceIdArray;
+ typedef HashMap<ResourceId, ResourceId> ResourceIdMap;
+ enum TextureUsageHint { TextureUsageAny, TextureUsageFramebuffer };
+ enum ResourceType {
+ GLTexture = 1,
+ Bitmap,
+ };
+ struct Mailbox {
+ GC3Dbyte name[64];
+ };
+ struct TransferableResource {
+ unsigned id;
+ GC3Denum format;
+ IntSize size;
+ Mailbox mailbox;
+ };
+ typedef Vector<TransferableResource> TransferableResourceArray;
+ struct TransferableResourceList {
+ TransferableResourceList();
+ ~TransferableResourceList();
+
+ TransferableResourceArray resources;
+ unsigned syncPoint;
+ };
+
+ static PassOwnPtr<CCResourceProvider> create(CCGraphicsContext*);
+
+ virtual ~CCResourceProvider();
+
+ WebKit::WebGraphicsContext3D* graphicsContext3D();
+ TextureUploader* textureUploader() const { return m_textureUploader.get(); }
+ TextureCopier* textureCopier() const { return m_textureCopier.get(); }
+ int maxTextureSize() const { return m_maxTextureSize; }
+ unsigned numResources() const { return m_resources.size(); }
+
+ // Checks whether a resource is in use by a consumer.
+ bool inUseByConsumer(ResourceId);
+
+
+ // Producer interface.
+
+ void setDefaultResourceType(ResourceType type) { m_defaultResourceType = type; }
+ ResourceType defaultResourceType() const { return m_defaultResourceType; }
+ ResourceType resourceType(ResourceId);
+
+ // Creates a resource of the default resource type.
+ ResourceId createResource(int pool, const IntSize&, GC3Denum format, TextureUsageHint);
+
+ // You can also explicitly create a specific resource type.
+ ResourceId createGLTexture(int pool, const IntSize&, GC3Denum format, TextureUsageHint);
+ ResourceId createBitmap(int pool, const IntSize&);
+ // Wraps an external texture into a GL resource.
+ ResourceId createResourceFromExternalTexture(unsigned textureId);
+
+ void deleteResource(ResourceId);
+
+ // Deletes all resources owned by a given pool.
+ void deleteOwnedResources(int pool);
+
+ // Upload data from image, copying sourceRect (in image) into destRect (in the resource).
+ void upload(ResourceId, const uint8_t* image, const IntRect& imageRect, const IntRect& sourceRect, const IntSize& destOffset);
+
+ // Flush all context operations, kicking uploads and ensuring ordering with
+ // respect to other contexts.
+ void flush();
+
+ // Only flush the command buffer if supported.
+ // Returns true if the shallow flush occurred, false otherwise.
+ bool shallowFlushIfSupported();
+
+ // Creates accounting for a child, and associate it with a pool. Resources
+ // transfered from that child will go to that pool. Returns a child ID.
+ int createChild(int pool);
+
+ // Destroys accounting for the child, deleting all resources from that pool.
+ void destroyChild(int child);
+
+ // Gets the child->parent resource ID map.
+ const ResourceIdMap& getChildToParentMap(int child) const;
+
+ // Prepares resources to be transfered to the parent, moving them to
+ // mailboxes and serializing meta-data into TransferableResources.
+ // Resources are not removed from the CCResourceProvider, but are markes as
+ // "in use".
+ TransferableResourceList prepareSendToParent(const ResourceIdArray&);
+
+ // Prepares resources to be transfered back to the child, moving them to
+ // mailboxes and serializing meta-data into TransferableResources.
+ // Resources are removed from the CCResourceProvider. Note: the resource IDs
+ // passed are in the parent namespace and will be translated to the child
+ // namespace when returned.
+ TransferableResourceList prepareSendToChild(int child, const ResourceIdArray&);
+
+ // Receives resources from a child, moving them from mailboxes. Resource IDs
+ // passed are in the child namespace, and will be translated to the parent
+ // namespace, added to the child->parent map.
+ // NOTE: if the syncPoint filed in TransferableResourceList is set, this
+ // will wait on it.
+ void receiveFromChild(int child, const TransferableResourceList&);
+
+ // Receives resources from the parent, moving them from mailboxes. Resource IDs
+ // passed are in the child namespace.
+ // NOTE: if the syncPoint filed in TransferableResourceList is set, this
+ // will wait on it.
+ void receiveFromParent(const TransferableResourceList&);
+
+ // Only for testing
+ size_t mailboxCount() const { return m_mailboxes.size(); }
+
+ // The following lock classes are part of the CCResourceProvider API and are
+ // needed to read and write the resource contents. The user must ensure
+ // that they only use GL locks on GL resources, etc, and this is enforced
+ // by assertions.
+ class ScopedReadLockGL {
+ public:
+ ScopedReadLockGL(CCResourceProvider*, CCResourceProvider::ResourceId);
+ ~ScopedReadLockGL();
+
+ unsigned textureId() const { return m_textureId; }
+
+ private:
+ CCResourceProvider* m_resourceProvider;
+ CCResourceProvider::ResourceId m_resourceId;
+ unsigned m_textureId;
+
+ DISALLOW_COPY_AND_ASSIGN(ScopedReadLockGL);
+ };
+
+ class ScopedWriteLockGL {
+ public:
+ ScopedWriteLockGL(CCResourceProvider*, CCResourceProvider::ResourceId);
+ ~ScopedWriteLockGL();
+
+ unsigned textureId() const { return m_textureId; }
+
+ private:
+ CCResourceProvider* m_resourceProvider;
+ CCResourceProvider::ResourceId m_resourceId;
+ unsigned m_textureId;
+
+ DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockGL);
+ };
+
+ class ScopedReadLockSoftware {
+ public:
+ ScopedReadLockSoftware(CCResourceProvider*, CCResourceProvider::ResourceId);
+ ~ScopedReadLockSoftware();
+
+ const SkBitmap* skBitmap() const { return &m_skBitmap; }
+
+ private:
+ CCResourceProvider* m_resourceProvider;
+ CCResourceProvider::ResourceId m_resourceId;
+ SkBitmap m_skBitmap;
+
+ DISALLOW_COPY_AND_ASSIGN(ScopedReadLockSoftware);
+ };
+
+ class ScopedWriteLockSoftware {
+ public:
+ ScopedWriteLockSoftware(CCResourceProvider*, CCResourceProvider::ResourceId);
+ ~ScopedWriteLockSoftware();
+
+ SkCanvas* skCanvas() { return m_skCanvas.get(); }
+
+ private:
+ CCResourceProvider* m_resourceProvider;
+ CCResourceProvider::ResourceId m_resourceId;
+ SkBitmap m_skBitmap;
+ OwnPtr<SkCanvas> m_skCanvas;
+
+ DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockSoftware);
+ };
+
+private:
+ struct Resource {
+ Resource();
+ Resource(unsigned textureId, int pool, const IntSize& size, GC3Denum format);
+ Resource(uint8_t* pixels, int pool, const IntSize& size, GC3Denum format);
+
+ unsigned glId;
+ uint8_t* pixels;
+ int pool;
+ int lockForReadCount;
+ bool lockedForWrite;
+ bool external;
+ bool exported;
+ IntSize size;
+ GC3Denum format;
+ ResourceType type;
+ };
+ typedef HashMap<ResourceId, Resource> ResourceMap;
+ struct Child {
+ Child();
+ ~Child();
+
+ int pool;
+ ResourceIdMap childToParentMap;
+ ResourceIdMap parentToChildMap;
+ };
+ typedef HashMap<int, Child> ChildMap;
+
+ explicit CCResourceProvider(CCGraphicsContext*);
+ bool initialize();
+
+ const Resource* lockForRead(ResourceId);
+ void unlockForRead(ResourceId);
+ const Resource* lockForWrite(ResourceId);
+ void unlockForWrite(ResourceId);
+ static void populateSkBitmapWithResource(SkBitmap*, const Resource*);
+
+ bool transferResource(WebKit::WebGraphicsContext3D*, ResourceId, TransferableResource*);
+ void trimMailboxDeque();
+
+ CCGraphicsContext* m_context;
+ ResourceId m_nextId;
+ ResourceMap m_resources;
+ int m_nextChild;
+ ChildMap m_children;
+
+ Deque<Mailbox> m_mailboxes;
+
+ ResourceType m_defaultResourceType;
+ bool m_useTextureStorageExt;
+ bool m_useTextureUsageHint;
+ bool m_useShallowFlush;
+ OwnPtr<LayerTextureSubImage> m_texSubImage;
+ OwnPtr<TextureUploader> m_textureUploader;
+ OwnPtr<AcceleratedTextureCopier> m_textureCopier;
+ int m_maxTextureSize;
+
+ DISALLOW_COPY_AND_ASSIGN(CCResourceProvider);
+};
+
+}
+
+#endif
diff --git a/cc/CCScheduler.cpp b/cc/scheduler.cc
index 869cd19..869cd19 100644
--- a/cc/CCScheduler.cpp
+++ b/cc/scheduler.cc
diff --git a/cc/scheduler.h b/cc/scheduler.h
index 638cbb2..1b48307 100644
--- a/cc/scheduler.h
+++ b/cc/scheduler.h
@@ -1,3 +1,109 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCScheduler_h
+#define CCScheduler_h
+
+#include "base/basictypes.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/time.h"
+#include "CCFrameRateController.h"
+#include "CCSchedulerStateMachine.h"
+#include <wtf/PassOwnPtr.h>
+
+namespace cc {
+
+class CCThread;
+
+struct CCScheduledActionDrawAndSwapResult {
+ CCScheduledActionDrawAndSwapResult()
+ : didDraw(false)
+ , didSwap(false)
+ {
+ }
+ CCScheduledActionDrawAndSwapResult(bool didDraw, bool didSwap)
+ : didDraw(didDraw)
+ , didSwap(didSwap)
+ {
+ }
+ bool didDraw;
+ bool didSwap;
+};
+
+class CCSchedulerClient {
+public:
+ virtual void scheduledActionBeginFrame() = 0;
+ virtual CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapIfPossible() = 0;
+ virtual CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapForced() = 0;
+ virtual void scheduledActionCommit() = 0;
+ virtual void scheduledActionBeginContextRecreation() = 0;
+ virtual void scheduledActionAcquireLayerTexturesForMainThread() = 0;
+ virtual void didAnticipatedDrawTimeChange(base::TimeTicks) = 0;
+
+protected:
+ virtual ~CCSchedulerClient() { }
+};
+
+class CCScheduler : CCFrameRateControllerClient {
+public:
+ static PassOwnPtr<CCScheduler> create(CCSchedulerClient* client, scoped_ptr<CCFrameRateController> frameRateController)
+ {
+ return adoptPtr(new CCScheduler(client, frameRateController.Pass()));
+ }
+
+ virtual ~CCScheduler();
+
+ void setCanBeginFrame(bool);
+
+ void setVisible(bool);
+ void setCanDraw(bool);
+
+ void setNeedsCommit();
+
+ // Like setNeedsCommit(), but ensures a commit will definitely happen even if we are not visible.
+ void setNeedsForcedCommit();
+
+ void setNeedsRedraw();
+
+ void setMainThreadNeedsLayerTextures();
+
+ // Like setNeedsRedraw(), but ensures the draw will definitely happen even if we are not visible.
+ void setNeedsForcedRedraw();
+
+ void beginFrameComplete();
+ void beginFrameAborted();
+
+ void setMaxFramesPending(int);
+ void setSwapBuffersCompleteSupported(bool);
+ void didSwapBuffersComplete();
+
+ void didLoseContext();
+ void didRecreateContext();
+
+ bool commitPending() const { return m_stateMachine.commitPending(); }
+ bool redrawPending() const { return m_stateMachine.redrawPending(); }
+
+ void setTimebaseAndInterval(base::TimeTicks timebase, base::TimeDelta interval);
+
+ base::TimeTicks anticipatedDrawTime();
+
+ // CCFrameRateControllerClient implementation
+ virtual void vsyncTick(bool throttled) OVERRIDE;
+
+private:
+ CCScheduler(CCSchedulerClient*, scoped_ptr<CCFrameRateController>);
+
+ void processScheduledActions();
+
+ CCSchedulerClient* m_client;
+ scoped_ptr<CCFrameRateController> m_frameRateController;
+ CCSchedulerStateMachine m_stateMachine;
+ bool m_insideProcessScheduledActions;
+
+ DISALLOW_COPY_AND_ASSIGN(CCScheduler);
+};
+
+} // namespace cc
+
+#endif // CCScheduler_h
diff --git a/cc/CCSchedulerStateMachine.cpp b/cc/scheduler_state_machine.cc
index 3eaf5cd..3eaf5cd 100644
--- a/cc/CCSchedulerStateMachine.cpp
+++ b/cc/scheduler_state_machine.cc
diff --git a/cc/scheduler_state_machine.h b/cc/scheduler_state_machine.h
index 638cbb2..092231f 100644
--- a/cc/scheduler_state_machine.h
+++ b/cc/scheduler_state_machine.h
@@ -1,3 +1,161 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCSchedulerStateMachine_h
+#define CCSchedulerStateMachine_h
+
+#include <string>
+
+#include "base/basictypes.h"
+
+namespace cc {
+
+// The CCSchedulerStateMachine decides how to coordinate main thread activites
+// like painting/running javascript with rendering and input activities on the
+// impl thread.
+//
+// The state machine tracks internal state but is also influenced by external state.
+// Internal state includes things like whether a frame has been requested, while
+// external state includes things like the current time being near to the vblank time.
+//
+// The scheduler seperates "what to do next" from the updating of its internal state to
+// make testing cleaner.
+class CCSchedulerStateMachine {
+public:
+ CCSchedulerStateMachine();
+
+ enum CommitState {
+ COMMIT_STATE_IDLE,
+ COMMIT_STATE_FRAME_IN_PROGRESS,
+ COMMIT_STATE_READY_TO_COMMIT,
+ COMMIT_STATE_WAITING_FOR_FIRST_DRAW,
+ };
+
+ enum TextureState {
+ LAYER_TEXTURE_STATE_UNLOCKED,
+ LAYER_TEXTURE_STATE_ACQUIRED_BY_MAIN_THREAD,
+ LAYER_TEXTURE_STATE_ACQUIRED_BY_IMPL_THREAD,
+ };
+
+ enum ContextState {
+ CONTEXT_ACTIVE,
+ CONTEXT_LOST,
+ CONTEXT_RECREATING,
+ };
+
+ bool commitPending() const
+ {
+ return m_commitState != COMMIT_STATE_IDLE;
+ }
+
+ bool redrawPending() const { return m_needsRedraw; }
+
+ enum Action {
+ ACTION_NONE,
+ ACTION_BEGIN_FRAME,
+ ACTION_COMMIT,
+ ACTION_DRAW_IF_POSSIBLE,
+ ACTION_DRAW_FORCED,
+ ACTION_BEGIN_CONTEXT_RECREATION,
+ ACTION_ACQUIRE_LAYER_TEXTURES_FOR_MAIN_THREAD,
+ };
+ Action nextAction() const;
+ void updateState(Action);
+
+ // Indicates whether the scheduler needs a vsync callback in order to make
+ // progress.
+ bool vsyncCallbackNeeded() const;
+
+ // Indicates that the system has entered and left a vsync callback.
+ // The scheduler will not draw more than once in a given vsync callback.
+ void didEnterVSync();
+ void didLeaveVSync();
+
+ // Indicates whether the LayerTreeHostImpl is visible.
+ void setVisible(bool);
+
+ // Indicates that a redraw is required, either due to the impl tree changing
+ // or the screen being damaged and simply needing redisplay.
+ void setNeedsRedraw();
+
+ // As setNeedsRedraw(), but ensures the draw will definitely happen even if
+ // we are not visible.
+ void setNeedsForcedRedraw();
+
+ // Indicates whether ACTION_DRAW_IF_POSSIBLE drew to the screen or not.
+ void didDrawIfPossibleCompleted(bool success);
+
+ // Indicates that a new commit flow needs to be performed, either to pull
+ // updates from the main thread to the impl, or to push deltas from the impl
+ // thread to main.
+ void setNeedsCommit();
+
+ // As setNeedsCommit(), but ensures the beginFrame will definitely happen even if
+ // we are not visible.
+ void setNeedsForcedCommit();
+
+ // Call this only in response to receiving an ACTION_BEGIN_FRAME
+ // from nextState. Indicates that all painting is complete.
+ void beginFrameComplete();
+
+ // Call this only in response to receiving an ACTION_BEGIN_FRAME
+ // from nextState if the client rejects the beginFrame message.
+ void beginFrameAborted();
+
+ // Request exclusive access to the textures that back single buffered
+ // layers on behalf of the main thread. Upon acqusition,
+ // ACTION_DRAW_IF_POSSIBLE will not draw until the main thread releases the
+ // textures to the impl thread by committing the layers.
+ void setMainThreadNeedsLayerTextures();
+
+ // Indicates whether we can successfully begin a frame at this time.
+ void setCanBeginFrame(bool can) { m_canBeginFrame = can; }
+
+ // Indicates whether drawing would, at this time, make sense.
+ // canDraw can be used to supress flashes or checkerboarding
+ // when such behavior would be undesirable.
+ void setCanDraw(bool can) { m_canDraw = can; }
+
+ void didLoseContext();
+ void didRecreateContext();
+
+ // Exposed for testing purposes.
+ void setMaximumNumberOfFailedDrawsBeforeDrawIsForced(int);
+
+ std::string toString();
+
+protected:
+ bool shouldDrawForced() const;
+ bool drawSuspendedUntilCommit() const;
+ bool scheduledToDraw() const;
+ bool shouldDraw() const;
+ bool shouldAcquireLayerTexturesForMainThread() const;
+ bool hasDrawnThisFrame() const;
+
+ CommitState m_commitState;
+
+ int m_currentFrameNumber;
+ int m_lastFrameNumberWhereDrawWasCalled;
+ int m_consecutiveFailedDraws;
+ int m_maximumNumberOfFailedDrawsBeforeDrawIsForced;
+ bool m_needsRedraw;
+ bool m_needsForcedRedraw;
+ bool m_needsForcedRedrawAfterNextCommit;
+ bool m_needsCommit;
+ bool m_needsForcedCommit;
+ bool m_mainThreadNeedsLayerTextures;
+ bool m_insideVSync;
+ bool m_visible;
+ bool m_canBeginFrame;
+ bool m_canDraw;
+ bool m_drawIfPossibleFailed;
+ TextureState m_textureState;
+ ContextState m_contextState;
+
+ DISALLOW_COPY_AND_ASSIGN(CCSchedulerStateMachine);
+};
+
+}
+
+#endif // CCSchedulerStateMachine_h
diff --git a/cc/CCScopedTexture.cpp b/cc/scoped_texture.cc
index d43ebe3..d43ebe3 100644
--- a/cc/CCScopedTexture.cpp
+++ b/cc/scoped_texture.cc
diff --git a/cc/scoped_texture.h b/cc/scoped_texture.h
index 638cbb2..a5b615c 100644
--- a/cc/scoped_texture.h
+++ b/cc/scoped_texture.h
@@ -1,3 +1,46 @@
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCScopedTexture_h
+#define CCScopedTexture_h
+
+#include "base/basictypes.h"
+#include "CCTexture.h"
+
+#if !ASSERT_DISABLED
+#include "base/threading/platform_thread.h"
+#endif
+
+namespace cc {
+
+class CCScopedTexture : protected CCTexture {
+public:
+ static PassOwnPtr<CCScopedTexture> create(CCResourceProvider* resourceProvider) { return adoptPtr(new CCScopedTexture(resourceProvider)); }
+ virtual ~CCScopedTexture();
+
+ using CCTexture::id;
+ using CCTexture::size;
+ using CCTexture::format;
+ using CCTexture::bytes;
+
+ bool allocate(int pool, const IntSize&, GC3Denum format, CCResourceProvider::TextureUsageHint);
+ void free();
+ void leak();
+
+protected:
+ explicit CCScopedTexture(CCResourceProvider*);
+
+private:
+ CCResourceProvider* m_resourceProvider;
+
+#if !ASSERT_DISABLED
+ base::PlatformThreadId m_allocateThreadIdentifier;
+#endif
+
+ DISALLOW_COPY_AND_ASSIGN(CCScopedTexture);
+};
+
+}
+
+#endif
diff --git a/cc/CCScopedThreadProxy.cpp b/cc/scoped_thread_proxy.cc
index c2f1b13..c2f1b13 100644
--- a/cc/CCScopedThreadProxy.cpp
+++ b/cc/scoped_thread_proxy.cc
diff --git a/cc/scoped_thread_proxy.h b/cc/scoped_thread_proxy.h
index 638cbb2..802046d 100644
--- a/cc/scoped_thread_proxy.h
+++ b/cc/scoped_thread_proxy.h
@@ -1,3 +1,74 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCScopedThreadProxy_h
+#define CCScopedThreadProxy_h
+
+#include "CCThreadTask.h"
+#include "base/threading/platform_thread.h"
+#include <wtf/OwnPtr.h>
+#include <wtf/PassOwnPtr.h>
+#include <wtf/ThreadSafeRefCounted.h>
+
+namespace cc {
+
+// This class is a proxy used to post tasks to an target thread from any other thread. The proxy may be shut down at
+// any point from the target thread after which no more tasks posted to the proxy will run. In other words, all
+// tasks posted via a proxy are scoped to the lifecycle of the proxy. Use this when posting tasks to an object that
+// might die with tasks in flight.
+//
+// The proxy must be created and shut down from the target thread, tasks may be posted from any thread.
+//
+// Implementation note: Unlike ScopedRunnableMethodFactory in Chromium, pending tasks are not cancelled by actually
+// destroying the proxy. Instead each pending task holds a reference to the proxy to avoid maintaining an explicit
+// list of outstanding tasks.
+class CCScopedThreadProxy : public ThreadSafeRefCounted<CCScopedThreadProxy> {
+public:
+ static PassRefPtr<CCScopedThreadProxy> create(CCThread* targetThread)
+ {
+ ASSERT(base::PlatformThread::CurrentId() == targetThread->threadID());
+ return adoptRef(new CCScopedThreadProxy(targetThread));
+ }
+
+ ~CCScopedThreadProxy();
+
+ // Can be called from any thread. Posts a task to the target thread that runs unless
+ // shutdown() is called before it runs.
+ void postTask(PassOwnPtr<CCThread::Task> task)
+ {
+ ref();
+ m_targetThread->postTask(createCCThreadTask(this, &CCScopedThreadProxy::runTaskIfNotShutdown, task));
+ }
+
+ void shutdown()
+ {
+ ASSERT(base::PlatformThread::CurrentId() == m_targetThread->threadID());
+ ASSERT(!m_shutdown);
+ m_shutdown = true;
+ }
+
+private:
+ explicit CCScopedThreadProxy(CCThread* targetThread);
+
+ void runTaskIfNotShutdown(PassOwnPtr<CCThread::Task> popTask)
+ {
+ OwnPtr<CCThread::Task> task = popTask;
+ // If our shutdown flag is set, it's possible that m_targetThread has already been destroyed so don't
+ // touch it.
+ if (m_shutdown) {
+ deref();
+ return;
+ }
+ ASSERT(base::PlatformThread::CurrentId() == m_targetThread->threadID());
+ task->performTask();
+ deref();
+ }
+
+ CCThread* m_targetThread;
+ bool m_shutdown; // Only accessed on the target thread
+};
+
+}
+
+#endif
diff --git a/cc/CCScrollbarAnimationController.cpp b/cc/scrollbar_animation_controller.cc
index 89f74cb..89f74cb 100644
--- a/cc/CCScrollbarAnimationController.cpp
+++ b/cc/scrollbar_animation_controller.cc
diff --git a/cc/scrollbar_animation_controller.h b/cc/scrollbar_animation_controller.h
index 638cbb2..bb387d7 100644
--- a/cc/scrollbar_animation_controller.h
+++ b/cc/scrollbar_animation_controller.h
@@ -1,3 +1,64 @@
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCScrollbarAnimationController_h
+#define CCScrollbarAnimationController_h
+
+#include "FloatPoint.h"
+#include "IntSize.h"
+#include <wtf/PassOwnPtr.h>
+
+namespace cc {
+
+class CCLayerImpl;
+class CCScrollbarLayerImpl;
+
+// This abstract class represents the compositor-side analogy of ScrollbarAnimator.
+// Individual platforms should subclass it to provide specialized implementation.
+class CCScrollbarAnimationController {
+public:
+ // Implemented by subclass.
+ static PassOwnPtr<CCScrollbarAnimationController> create(CCLayerImpl* scrollLayer);
+
+ virtual ~CCScrollbarAnimationController();
+
+ virtual bool animate(double monotonicTime);
+ void didPinchGestureBegin();
+ void didPinchGestureUpdate();
+ void didPinchGestureEnd();
+ void updateScrollOffset(CCLayerImpl* scrollLayer);
+
+ void setHorizontalScrollbarLayer(CCScrollbarLayerImpl* layer) { m_horizontalScrollbarLayer = layer; }
+ CCScrollbarLayerImpl* horizontalScrollbarLayer() const { return m_horizontalScrollbarLayer; }
+
+ void setVerticalScrollbarLayer(CCScrollbarLayerImpl* layer) { m_verticalScrollbarLayer = layer; }
+ CCScrollbarLayerImpl* verticalScrollbarLayer() const { return m_verticalScrollbarLayer; }
+
+ FloatPoint currentPos() const { return m_currentPos; }
+ IntSize totalSize() const { return m_totalSize; }
+ IntSize maximum() const { return m_maximum; }
+
+ virtual void didPinchGestureBeginAtTime(double monotonicTime) { }
+ virtual void didPinchGestureUpdateAtTime(double monotonicTime) { }
+ virtual void didPinchGestureEndAtTime(double monotonicTime) { }
+ virtual void updateScrollOffsetAtTime(CCLayerImpl* scrollLayer, double monotonicTime);
+
+protected:
+ explicit CCScrollbarAnimationController(CCLayerImpl* scrollLayer);
+
+private:
+ static IntSize getScrollLayerBounds(const CCLayerImpl*);
+
+ // Beware of dangling pointer. Always update these during tree synchronization.
+ CCScrollbarLayerImpl* m_horizontalScrollbarLayer;
+ CCScrollbarLayerImpl* m_verticalScrollbarLayer;
+
+ FloatPoint m_currentPos;
+ IntSize m_totalSize;
+ IntSize m_maximum;
+};
+
+} // namespace cc
+
+#endif // CCScrollbarAnimationController_h
diff --git a/cc/CCScrollbarAnimationControllerLinearFade.cpp b/cc/scrollbar_animation_controller_linear_fade.cc
index 95ad198..95ad198 100644
--- a/cc/CCScrollbarAnimationControllerLinearFade.cpp
+++ b/cc/scrollbar_animation_controller_linear_fade.cc
diff --git a/cc/scrollbar_animation_controller_linear_fade.h b/cc/scrollbar_animation_controller_linear_fade.h
index 638cbb2..749dca5 100644
--- a/cc/scrollbar_animation_controller_linear_fade.h
+++ b/cc/scrollbar_animation_controller_linear_fade.h
@@ -1,3 +1,39 @@
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCScrollbarAnimationControllerLinearFade_h
+#define CCScrollbarAnimationControllerLinearFade_h
+
+#include "CCScrollbarAnimationController.h"
+
+namespace cc {
+
+class CCScrollbarAnimationControllerLinearFade : public CCScrollbarAnimationController {
+public:
+ static PassOwnPtr<CCScrollbarAnimationControllerLinearFade> create(CCLayerImpl* scrollLayer, double fadeoutDelay, double fadeoutLength);
+
+ virtual ~CCScrollbarAnimationControllerLinearFade();
+
+ virtual bool animate(double monotonicTime) OVERRIDE;
+
+ virtual void didPinchGestureUpdateAtTime(double monotonicTime) OVERRIDE;
+ virtual void didPinchGestureEndAtTime(double monotonicTime) OVERRIDE;
+ virtual void updateScrollOffsetAtTime(CCLayerImpl* scrollLayer, double monotonicTime) OVERRIDE;
+
+protected:
+ CCScrollbarAnimationControllerLinearFade(CCLayerImpl* scrollLayer, double fadeoutDelay, double fadeoutLength);
+
+private:
+ float opacityAtTime(double monotonicTime);
+
+ double m_lastAwakenTime;
+ bool m_pinchGestureInEffect;
+
+ double m_fadeoutDelay;
+ double m_fadeoutLength;
+};
+
+} // namespace cc
+
+#endif // CCScrollbarAnimationControllerLinearFade_h
diff --git a/cc/CCScrollbarGeometryFixedThumb.cpp b/cc/scrollbar_geometry_fixed_thumb.cc
index dc55829..dc55829 100644
--- a/cc/CCScrollbarGeometryFixedThumb.cpp
+++ b/cc/scrollbar_geometry_fixed_thumb.cc
diff --git a/cc/scrollbar_geometry_fixed_thumb.h b/cc/scrollbar_geometry_fixed_thumb.h
index 638cbb2..fe0db12 100644
--- a/cc/scrollbar_geometry_fixed_thumb.h
+++ b/cc/scrollbar_geometry_fixed_thumb.h
@@ -1,3 +1,39 @@
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCScrollbarGeometryFixedThumb_h
+#define CCScrollbarGeometryFixedThumb_h
+
+#include "CCScrollbarGeometryStub.h"
+#include "IntSize.h"
+
+namespace cc {
+
+// This scrollbar geometry class behaves exactly like a normal geometry except
+// it always returns a fixed thumb length. This allows a page to zoom (changing
+// the total size of the scrollable area, changing the thumb length) while not
+// requiring the thumb resource to be repainted.
+class CCScrollbarGeometryFixedThumb : public CCScrollbarGeometryStub {
+public:
+ static PassOwnPtr<CCScrollbarGeometryFixedThumb> create(PassOwnPtr<WebKit::WebScrollbarThemeGeometry>);
+ virtual ~CCScrollbarGeometryFixedThumb();
+
+ // Update thumb length from scrollbar
+ void update(WebKit::WebScrollbar*);
+
+ // WebScrollbarThemeGeometry interface
+ virtual WebKit::WebScrollbarThemeGeometry* clone() const OVERRIDE;
+ virtual int thumbLength(WebKit::WebScrollbar*) OVERRIDE;
+ virtual int thumbPosition(WebKit::WebScrollbar*) OVERRIDE;
+ virtual void splitTrack(WebKit::WebScrollbar*, const WebKit::WebRect& track, WebKit::WebRect& startTrack, WebKit::WebRect& thumb, WebKit::WebRect& endTrack) OVERRIDE;
+
+private:
+ explicit CCScrollbarGeometryFixedThumb(PassOwnPtr<WebKit::WebScrollbarThemeGeometry>);
+
+ IntSize m_thumbSize;
+};
+
+}
+
+#endif
diff --git a/cc/CCScrollbarGeometryStub.cpp b/cc/scrollbar_geometry_stub.cc
index 7be7b15..7be7b15 100644
--- a/cc/CCScrollbarGeometryStub.cpp
+++ b/cc/scrollbar_geometry_stub.cc
diff --git a/cc/scrollbar_geometry_stub.h b/cc/scrollbar_geometry_stub.h
index 638cbb2..0d23a4e 100644
--- a/cc/scrollbar_geometry_stub.h
+++ b/cc/scrollbar_geometry_stub.h
@@ -1,3 +1,52 @@
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCScrollbarGeometryStub_h
+#define CCScrollbarGeometryStub_h
+
+#include <public/WebScrollbarThemeGeometry.h>
+#include <wtf/OwnPtr.h>
+#include <wtf/PassOwnPtr.h>
+
+namespace cc {
+
+// This subclass wraps an existing scrollbar geometry class so that
+// another class can derive from it and override specific functions, while
+// passing through the remaining ones.
+class CCScrollbarGeometryStub : public WebKit::WebScrollbarThemeGeometry {
+public:
+ virtual ~CCScrollbarGeometryStub();
+
+ // Allow derived classes to update themselves from a scrollbar.
+ void update(WebKit::WebScrollbar*) { }
+
+ // WebScrollbarThemeGeometry interface
+ virtual WebKit::WebScrollbarThemeGeometry* clone() const OVERRIDE;
+ virtual int thumbPosition(WebKit::WebScrollbar*) OVERRIDE;
+ virtual int thumbLength(WebKit::WebScrollbar*) OVERRIDE;
+ virtual int trackPosition(WebKit::WebScrollbar*) OVERRIDE;
+ virtual int trackLength(WebKit::WebScrollbar*) OVERRIDE;
+ virtual bool hasButtons(WebKit::WebScrollbar*) OVERRIDE;
+ virtual bool hasThumb(WebKit::WebScrollbar*) OVERRIDE;
+ virtual WebKit::WebRect trackRect(WebKit::WebScrollbar*) OVERRIDE;
+ virtual WebKit::WebRect thumbRect(WebKit::WebScrollbar*) OVERRIDE;
+ virtual int minimumThumbLength(WebKit::WebScrollbar*) OVERRIDE;
+ virtual int scrollbarThickness(WebKit::WebScrollbar*) OVERRIDE;
+ virtual WebKit::WebRect backButtonStartRect(WebKit::WebScrollbar*) OVERRIDE;
+ virtual WebKit::WebRect backButtonEndRect(WebKit::WebScrollbar*) OVERRIDE;
+ virtual WebKit::WebRect forwardButtonStartRect(WebKit::WebScrollbar*) OVERRIDE;
+ virtual WebKit::WebRect forwardButtonEndRect(WebKit::WebScrollbar*) OVERRIDE;
+ virtual WebKit::WebRect constrainTrackRectToTrackPieces(WebKit::WebScrollbar*, const WebKit::WebRect&) OVERRIDE;
+ virtual void splitTrack(WebKit::WebScrollbar*, const WebKit::WebRect& track, WebKit::WebRect& startTrack, WebKit::WebRect& thumb, WebKit::WebRect& endTrack) OVERRIDE;
+
+protected:
+ explicit CCScrollbarGeometryStub(PassOwnPtr<WebKit::WebScrollbarThemeGeometry>);
+
+private:
+ OwnPtr<WebKit::WebScrollbarThemeGeometry> m_geometry;
+};
+
+}
+
+#endif
diff --git a/cc/ScrollbarLayerChromium.cpp b/cc/scrollbar_layer.cc
index 4259b7b..4259b7b 100644
--- a/cc/ScrollbarLayerChromium.cpp
+++ b/cc/scrollbar_layer.cc
diff --git a/cc/scrollbar_layer.h b/cc/scrollbar_layer.h
index 638cbb2..5c7cc5c 100644
--- a/cc/scrollbar_layer.h
+++ b/cc/scrollbar_layer.h
@@ -1,3 +1,70 @@
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+
+#ifndef ScrollbarLayerChromium_h
+#define ScrollbarLayerChromium_h
+
+#if USE(ACCELERATED_COMPOSITING)
+
+#include "LayerChromium.h"
+#include "caching_bitmap_canvas_layer_texture_updater.h"
+#include <public/WebScrollbar.h>
+#include <public/WebScrollbarThemeGeometry.h>
+#include <public/WebScrollbarThemePainter.h>
+
+namespace cc {
+
+class Scrollbar;
+class ScrollbarThemeComposite;
+class CCTextureUpdateQueue;
+
+class ScrollbarLayerChromium : public LayerChromium {
+public:
+ virtual scoped_ptr<CCLayerImpl> createCCLayerImpl() OVERRIDE;
+
+ static scoped_refptr<ScrollbarLayerChromium> create(PassOwnPtr<WebKit::WebScrollbar>, WebKit::WebScrollbarThemePainter, PassOwnPtr<WebKit::WebScrollbarThemeGeometry>, int scrollLayerId);
+
+ // LayerChromium interface
+ virtual bool needsContentsScale() const OVERRIDE;
+ virtual IntSize contentBounds() const OVERRIDE;
+ virtual void setTexturePriorities(const CCPriorityCalculator&) OVERRIDE;
+ virtual void update(CCTextureUpdateQueue&, const CCOcclusionTracker*, CCRenderingStats&) OVERRIDE;
+ virtual void setLayerTreeHost(CCLayerTreeHost*) OVERRIDE;
+ virtual void pushPropertiesTo(CCLayerImpl*) OVERRIDE;
+
+ int scrollLayerId() const { return m_scrollLayerId; }
+ void setScrollLayerId(int id) { m_scrollLayerId = id; }
+
+ virtual ScrollbarLayerChromium* toScrollbarLayerChromium() OVERRIDE;
+
+protected:
+ ScrollbarLayerChromium(PassOwnPtr<WebKit::WebScrollbar>, WebKit::WebScrollbarThemePainter, PassOwnPtr<WebKit::WebScrollbarThemeGeometry>, int scrollLayerId);
+ virtual ~ScrollbarLayerChromium();
+
+private:
+ void updatePart(CachingBitmapCanvasLayerTextureUpdater*, LayerTextureUpdater::Texture*, const IntRect&, CCTextureUpdateQueue&, CCRenderingStats&);
+ void createTextureUpdaterIfNeeded();
+
+ OwnPtr<WebKit::WebScrollbar> m_scrollbar;
+ WebKit::WebScrollbarThemePainter m_painter;
+ OwnPtr<WebKit::WebScrollbarThemeGeometry> m_geometry;
+ int m_scrollLayerId;
+
+ GC3Denum m_textureFormat;
+
+ RefPtr<CachingBitmapCanvasLayerTextureUpdater> m_backTrackUpdater;
+ RefPtr<CachingBitmapCanvasLayerTextureUpdater> m_foreTrackUpdater;
+ RefPtr<CachingBitmapCanvasLayerTextureUpdater> m_thumbUpdater;
+
+ // All the parts of the scrollbar except the thumb
+ OwnPtr<LayerTextureUpdater::Texture> m_backTrack;
+ OwnPtr<LayerTextureUpdater::Texture> m_foreTrack;
+ OwnPtr<LayerTextureUpdater::Texture> m_thumb;
+};
+
+}
+#endif // USE(ACCELERATED_COMPOSITING)
+
+#endif
diff --git a/cc/CCScrollbarLayerImpl.cpp b/cc/scrollbar_layer_impl.cc
index 8a832e7..8a832e7 100644
--- a/cc/CCScrollbarLayerImpl.cpp
+++ b/cc/scrollbar_layer_impl.cc
diff --git a/cc/scrollbar_layer_impl.h b/cc/scrollbar_layer_impl.h
index 638cbb2..e7cf584 100644
--- a/cc/scrollbar_layer_impl.h
+++ b/cc/scrollbar_layer_impl.h
@@ -1,3 +1,112 @@
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCScrollbarLayerImpl_h
+#define CCScrollbarLayerImpl_h
+
+#if USE(ACCELERATED_COMPOSITING)
+
+#include "CCLayerImpl.h"
+#include "CCScrollbarGeometryFixedThumb.h"
+#include <public/WebRect.h>
+#include <public/WebScrollbar.h>
+#include <public/WebVector.h>
+
+namespace cc {
+
+class ScrollView;
+
+class CCScrollbarLayerImpl : public CCLayerImpl {
+public:
+ static scoped_ptr<CCScrollbarLayerImpl> create(int id);
+ virtual ~CCScrollbarLayerImpl();
+
+ CCScrollbarGeometryFixedThumb* scrollbarGeometry() const { return m_geometry.get(); }
+ void setScrollbarGeometry(PassOwnPtr<CCScrollbarGeometryFixedThumb>);
+ void setScrollbarData(WebKit::WebScrollbar*);
+
+ void setBackTrackResourceId(CCResourceProvider::ResourceId id) { m_backTrackResourceId = id; }
+ void setForeTrackResourceId(CCResourceProvider::ResourceId id) { m_foreTrackResourceId = id; }
+ void setThumbResourceId(CCResourceProvider::ResourceId id) { m_thumbResourceId = id; }
+
+ float currentPos() const { return m_currentPos; }
+ void setCurrentPos(float currentPos) { m_currentPos = currentPos; }
+
+ int totalSize() const { return m_totalSize; }
+ void setTotalSize(int totalSize) { m_totalSize = totalSize; }
+
+ int maximum() const { return m_maximum; }
+ void setMaximum(int maximum) { m_maximum = maximum; }
+
+ WebKit::WebScrollbar::Orientation orientation() const { return m_orientation; }
+
+ virtual void appendQuads(CCQuadSink&, CCAppendQuadsData&) OVERRIDE;
+
+ virtual void didLoseContext() OVERRIDE;
+
+protected:
+ explicit CCScrollbarLayerImpl(int id);
+
+private:
+ // nested class only to avoid namespace problem
+ class CCScrollbar : public WebKit::WebScrollbar {
+ public:
+ explicit CCScrollbar(CCScrollbarLayerImpl* owner) : m_owner(owner) { }
+
+ // WebScrollbar implementation
+ virtual bool isOverlay() const;
+ virtual int value() const;
+ virtual WebKit::WebPoint location() const;
+ virtual WebKit::WebSize size() const;
+ virtual bool enabled() const;
+ virtual int maximum() const;
+ virtual int totalSize() const;
+ virtual bool isScrollViewScrollbar() const;
+ virtual bool isScrollableAreaActive() const;
+ virtual void getTickmarks(WebKit::WebVector<WebKit::WebRect>& tickmarks) const;
+ virtual WebScrollbar::ScrollbarControlSize controlSize() const;
+ virtual WebScrollbar::ScrollbarPart pressedPart() const;
+ virtual WebScrollbar::ScrollbarPart hoveredPart() const;
+ virtual WebScrollbar::ScrollbarOverlayStyle scrollbarOverlayStyle() const;
+ virtual WebScrollbar::Orientation orientation() const;
+ virtual bool isCustomScrollbar() const;
+
+ private:
+ CCScrollbarLayerImpl* m_owner;
+
+ };
+
+ virtual const char* layerTypeAsString() const OVERRIDE;
+
+ CCScrollbar m_scrollbar;
+
+ CCResourceProvider::ResourceId m_backTrackResourceId;
+ CCResourceProvider::ResourceId m_foreTrackResourceId;
+ CCResourceProvider::ResourceId m_thumbResourceId;
+
+ OwnPtr<CCScrollbarGeometryFixedThumb> m_geometry;
+
+ // Data to implement CCScrollbar
+ WebKit::WebScrollbar::ScrollbarOverlayStyle m_scrollbarOverlayStyle;
+ WebKit::WebVector<WebKit::WebRect> m_tickmarks;
+ WebKit::WebScrollbar::Orientation m_orientation;
+ WebKit::WebScrollbar::ScrollbarControlSize m_controlSize;
+ WebKit::WebScrollbar::ScrollbarPart m_pressedPart;
+ WebKit::WebScrollbar::ScrollbarPart m_hoveredPart;
+
+ float m_currentPos;
+ int m_totalSize;
+ int m_maximum;
+
+ bool m_isScrollableAreaActive;
+ bool m_isScrollViewScrollbar;
+ bool m_enabled;
+ bool m_isCustomScrollbar;
+ bool m_isOverlayScrollbar;
+};
+
+}
+#endif // USE(ACCELERATED_COMPOSITING)
+
+#endif
diff --git a/cc/CCSettings.cpp b/cc/settings.cc
index cfdc258..cfdc258 100644
--- a/cc/CCSettings.cpp
+++ b/cc/settings.cc
diff --git a/cc/settings.h b/cc/settings.h
index 638cbb2..cde48ca 100644
--- a/cc/settings.h
+++ b/cc/settings.h
@@ -1,3 +1,40 @@
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCSettings_h
+#define CCSettings_h
+
+#include "IntSize.h"
+
+namespace cc {
+
+// This file is for settings that apply to all compositors. Add settings to
+// CCLayerTreeSettings if a ui and renderer compositor might not want the same
+// setting.
+
+class CCSettings {
+public:
+ static bool perTilePaintingEnabled();
+ static bool partialSwapEnabled();
+ static bool acceleratedAnimationEnabled();
+ static bool pageScalePinchZoomEnabled();
+
+ static bool jankInsteadOfCheckerboard();
+ static bool backgroundColorInsteadOfCheckerboard();
+
+ // These setters should only be used on the main thread before the layer
+ // renderer is initialized.
+ static void setPerTilePaintingEnabled(bool);
+ static void setPartialSwapEnabled(bool);
+ static void setAcceleratedAnimationEnabled(bool);
+ static void setPageScalePinchZoomEnabled(bool);
+
+ // These settings are meant to be set only once, and only read thereafter.
+ // This function is only for resetting settings in tests.
+ static void reset();
+};
+
+} // namespace cc
+
+#endif // CCSettings_h
diff --git a/cc/ShaderChromium.cpp b/cc/shader.cc
index cf485c1..cf485c1 100644
--- a/cc/ShaderChromium.cpp
+++ b/cc/shader.cc
diff --git a/cc/shader.h b/cc/shader.h
index 638cbb2..2518382 100644
--- a/cc/shader.h
+++ b/cc/shader.h
@@ -1,3 +1,353 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef ShaderChromium_h
+#define ShaderChromium_h
+
+#if USE(ACCELERATED_COMPOSITING)
+
+#include "SkColorPriv.h"
+#include <string>
+
+namespace WebKit {
+class WebGraphicsContext3D;
+}
+
+namespace cc {
+
+class VertexShaderPosTex {
+public:
+ VertexShaderPosTex();
+
+ void init(WebKit::WebGraphicsContext3D*, unsigned program, bool usingBindUniform, int* baseUniformIndex);
+ std::string getShaderString() const;
+
+ int matrixLocation() const { return m_matrixLocation; }
+
+private:
+ int m_matrixLocation;
+};
+
+class VertexShaderPosTexYUVStretch {
+public:
+ VertexShaderPosTexYUVStretch();
+
+ void init(WebKit::WebGraphicsContext3D*, unsigned program, bool usingBindUniform, int* baseUniformIndex);
+ std::string getShaderString() const;
+
+ int matrixLocation() const { return m_matrixLocation; }
+ int yWidthScaleFactorLocation() const { return m_yWidthScaleFactorLocation; }
+ int uvWidthScaleFactorLocation() const { return m_uvWidthScaleFactorLocation; }
+
+private:
+ int m_matrixLocation;
+ int m_yWidthScaleFactorLocation;
+ int m_uvWidthScaleFactorLocation;
+};
+
+class VertexShaderPos {
+public:
+ VertexShaderPos();
+
+ void init(WebKit::WebGraphicsContext3D*, unsigned program, bool usingBindUniform, int* baseUniformIndex);
+ std::string getShaderString() const;
+
+ int matrixLocation() const { return m_matrixLocation; }
+
+private:
+ int m_matrixLocation;
+};
+
+class VertexShaderPosTexIdentity {
+public:
+ void init(WebKit::WebGraphicsContext3D*, unsigned program, bool usingBindUniform, int* baseUniformIndex) { }
+ std::string getShaderString() const;
+};
+
+class VertexShaderPosTexTransform {
+public:
+ VertexShaderPosTexTransform();
+
+ void init(WebKit::WebGraphicsContext3D*, unsigned program, bool usingBindUniform, int* baseUniformIndex);
+ std::string getShaderString() const;
+
+ int matrixLocation() const { return m_matrixLocation; }
+ int texTransformLocation() const { return m_texTransformLocation; }
+
+private:
+ int m_matrixLocation;
+ int m_texTransformLocation;
+};
+
+class VertexShaderQuad {
+public:
+ VertexShaderQuad();
+
+ void init(WebKit::WebGraphicsContext3D*, unsigned program, bool usingBindUniform, int* baseUniformIndex);
+ std::string getShaderString() const;
+
+ int matrixLocation() const { return m_matrixLocation; }
+ int pointLocation() const { return m_pointLocation; }
+
+private:
+ int m_matrixLocation;
+ int m_pointLocation;
+};
+
+class VertexShaderTile {
+public:
+ VertexShaderTile();
+
+ void init(WebKit::WebGraphicsContext3D*, unsigned program, bool usingBindUniform, int* baseUniformIndex);
+ std::string getShaderString() const;
+
+ int matrixLocation() const { return m_matrixLocation; }
+ int pointLocation() const { return m_pointLocation; }
+ int vertexTexTransformLocation() const { return m_vertexTexTransformLocation; }
+
+private:
+ int m_matrixLocation;
+ int m_pointLocation;
+ int m_vertexTexTransformLocation;
+};
+
+class VertexShaderVideoTransform {
+public:
+ VertexShaderVideoTransform();
+
+ bool init(WebKit::WebGraphicsContext3D*, unsigned program, bool usingBindUniform, int* baseUniformIndex);
+ std::string getShaderString() const;
+
+ int matrixLocation() const { return m_matrixLocation; }
+ int texMatrixLocation() const { return m_texMatrixLocation; }
+
+private:
+ int m_matrixLocation;
+ int m_texMatrixLocation;
+};
+
+class FragmentTexAlphaBinding {
+public:
+ FragmentTexAlphaBinding();
+
+ void init(WebKit::WebGraphicsContext3D*, unsigned program, bool usingBindUniform, int* baseUniformIndex);
+ int alphaLocation() const { return m_alphaLocation; }
+ int edgeLocation() const { return -1; }
+ int fragmentTexTransformLocation() const { return -1; }
+ int samplerLocation() const { return m_samplerLocation; }
+
+private:
+ int m_samplerLocation;
+ int m_alphaLocation;
+};
+
+class FragmentTexOpaqueBinding {
+public:
+ FragmentTexOpaqueBinding();
+
+ void init(WebKit::WebGraphicsContext3D*, unsigned program, bool usingBindUniform, int* baseUniformIndex);
+ int alphaLocation() const { return -1; }
+ int edgeLocation() const { return -1; }
+ int fragmentTexTransformLocation() const { return -1; }
+ int samplerLocation() const { return m_samplerLocation; }
+
+private:
+ int m_samplerLocation;
+};
+
+class FragmentShaderRGBATexFlipAlpha : public FragmentTexAlphaBinding {
+public:
+ std::string getShaderString() const;
+};
+
+class FragmentShaderRGBATexAlpha : public FragmentTexAlphaBinding {
+public:
+ std::string getShaderString() const;
+};
+
+class FragmentShaderRGBATexRectFlipAlpha : public FragmentTexAlphaBinding {
+public:
+ std::string getShaderString() const;
+};
+
+class FragmentShaderRGBATexRectAlpha : public FragmentTexAlphaBinding {
+public:
+ std::string getShaderString() const;
+};
+
+class FragmentShaderRGBATexOpaque : public FragmentTexOpaqueBinding {
+public:
+ std::string getShaderString() const;
+};
+
+class FragmentShaderRGBATex : public FragmentTexOpaqueBinding {
+public:
+ std::string getShaderString() const;
+};
+
+// Swizzles the red and blue component of sampled texel with alpha.
+class FragmentShaderRGBATexSwizzleAlpha : public FragmentTexAlphaBinding {
+public:
+ std::string getShaderString() const;
+};
+
+// Swizzles the red and blue component of sampled texel without alpha.
+class FragmentShaderRGBATexSwizzleOpaque : public FragmentTexOpaqueBinding {
+public:
+ std::string getShaderString() const;
+};
+
+// Fragment shader for external textures.
+class FragmentShaderOESImageExternal : public FragmentTexAlphaBinding {
+public:
+ std::string getShaderString() const;
+ bool init(WebKit::WebGraphicsContext3D*, unsigned program, bool usingBindUniform, int* baseUniformIndex);
+private:
+ int m_samplerLocation;
+};
+
+class FragmentShaderRGBATexAlphaAA {
+public:
+ FragmentShaderRGBATexAlphaAA();
+
+ void init(WebKit::WebGraphicsContext3D*, unsigned program, bool usingBindUniform, int* baseUniformIndex);
+ std::string getShaderString() const;
+
+ int alphaLocation() const { return m_alphaLocation; }
+ int samplerLocation() const { return m_samplerLocation; }
+ int edgeLocation() const { return m_edgeLocation; }
+
+private:
+ int m_samplerLocation;
+ int m_alphaLocation;
+ int m_edgeLocation;
+};
+
+class FragmentTexClampAlphaAABinding {
+public:
+ FragmentTexClampAlphaAABinding();
+
+ void init(WebKit::WebGraphicsContext3D*, unsigned program, bool usingBindUniform, int* baseUniformIndex);
+ int alphaLocation() const { return m_alphaLocation; }
+ int samplerLocation() const { return m_samplerLocation; }
+ int fragmentTexTransformLocation() const { return m_fragmentTexTransformLocation; }
+ int edgeLocation() const { return m_edgeLocation; }
+
+private:
+ int m_samplerLocation;
+ int m_alphaLocation;
+ int m_fragmentTexTransformLocation;
+ int m_edgeLocation;
+};
+
+class FragmentShaderRGBATexClampAlphaAA : public FragmentTexClampAlphaAABinding {
+public:
+ std::string getShaderString() const;
+};
+
+// Swizzles the red and blue component of sampled texel.
+class FragmentShaderRGBATexClampSwizzleAlphaAA : public FragmentTexClampAlphaAABinding {
+public:
+ std::string getShaderString() const;
+};
+
+class FragmentShaderRGBATexAlphaMask {
+public:
+ FragmentShaderRGBATexAlphaMask();
+ std::string getShaderString() const;
+
+ void init(WebKit::WebGraphicsContext3D*, unsigned program, bool usingBindUniform, int* baseUniformIndex);
+ int alphaLocation() const { return m_alphaLocation; }
+ int samplerLocation() const { return m_samplerLocation; }
+ int maskSamplerLocation() const { return m_maskSamplerLocation; }
+ int maskTexCoordScaleLocation() const { return m_maskTexCoordScaleLocation; }
+ int maskTexCoordOffsetLocation() const { return m_maskTexCoordOffsetLocation; }
+
+private:
+ int m_samplerLocation;
+ int m_maskSamplerLocation;
+ int m_alphaLocation;
+ int m_maskTexCoordScaleLocation;
+ int m_maskTexCoordOffsetLocation;
+};
+
+class FragmentShaderRGBATexAlphaMaskAA {
+public:
+ FragmentShaderRGBATexAlphaMaskAA();
+ std::string getShaderString() const;
+
+ void init(WebKit::WebGraphicsContext3D*, unsigned program, bool usingBindUniform, int* baseUniformIndex);
+ int alphaLocation() const { return m_alphaLocation; }
+ int samplerLocation() const { return m_samplerLocation; }
+ int maskSamplerLocation() const { return m_maskSamplerLocation; }
+ int edgeLocation() const { return m_edgeLocation; }
+ int maskTexCoordScaleLocation() const { return m_maskTexCoordScaleLocation; }
+ int maskTexCoordOffsetLocation() const { return m_maskTexCoordOffsetLocation; }
+
+private:
+ int m_samplerLocation;
+ int m_maskSamplerLocation;
+ int m_alphaLocation;
+ int m_edgeLocation;
+ int m_maskTexCoordScaleLocation;
+ int m_maskTexCoordOffsetLocation;
+};
+
+class FragmentShaderYUVVideo {
+public:
+ FragmentShaderYUVVideo();
+ std::string getShaderString() const;
+
+ void init(WebKit::WebGraphicsContext3D*, unsigned program, bool usingBindUniform, int* baseUniformIndex);
+
+ int yTextureLocation() const { return m_yTextureLocation; }
+ int uTextureLocation() const { return m_uTextureLocation; }
+ int vTextureLocation() const { return m_vTextureLocation; }
+ int alphaLocation() const { return m_alphaLocation; }
+ int ccMatrixLocation() const { return m_ccMatrixLocation; }
+ int yuvAdjLocation() const { return m_yuvAdjLocation; }
+
+private:
+ int m_yTextureLocation;
+ int m_uTextureLocation;
+ int m_vTextureLocation;
+ int m_alphaLocation;
+ int m_ccMatrixLocation;
+ int m_yuvAdjLocation;
+};
+
+class FragmentShaderColor {
+public:
+ FragmentShaderColor();
+ std::string getShaderString() const;
+
+ void init(WebKit::WebGraphicsContext3D*, unsigned program, bool usingBindUniform, int* baseUniformIndex);
+ int colorLocation() const { return m_colorLocation; }
+
+private:
+ int m_colorLocation;
+};
+
+class FragmentShaderCheckerboard {
+public:
+ FragmentShaderCheckerboard();
+ std::string getShaderString() const;
+
+ void init(WebKit::WebGraphicsContext3D*, unsigned program, bool usingBindUniform, int* baseUniformIndex);
+ int alphaLocation() const { return m_alphaLocation; }
+ int texTransformLocation() const { return m_texTransformLocation; }
+ int frequencyLocation() const { return m_frequencyLocation; }
+ int colorLocation() const { return m_colorLocation; }
+private:
+ int m_alphaLocation;
+ int m_texTransformLocation;
+ int m_frequencyLocation;
+ int m_colorLocation;
+};
+
+} // namespace cc
+
+#endif // USE(ACCELERATED_COMPOSITING)
+
+#endif
diff --git a/cc/CCSharedQuadState.cpp b/cc/shared_quad_state.cc
index ede07a5..ede07a5 100644
--- a/cc/CCSharedQuadState.cpp
+++ b/cc/shared_quad_state.cc
diff --git a/cc/shared_quad_state.h b/cc/shared_quad_state.h
index 638cbb2..0f5e386 100644
--- a/cc/shared_quad_state.h
+++ b/cc/shared_quad_state.h
@@ -1,3 +1,33 @@
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCSharedQuadState_h
+#define CCSharedQuadState_h
+
+#include "IntRect.h"
+#include "base/memory/scoped_ptr.h"
+#include <public/WebTransformationMatrix.h>
+
+namespace cc {
+
+struct CCSharedQuadState {
+ int id;
+
+ // Transforms from quad's original content space to its target content space.
+ WebKit::WebTransformationMatrix quadTransform;
+ // This rect lives in the content space for the quad's originating layer.
+ IntRect visibleContentRect;
+ IntRect clippedRectInTarget;
+ float opacity;
+ bool opaque;
+
+ static scoped_ptr<CCSharedQuadState> create(const WebKit::WebTransformationMatrix& quadTransform, const IntRect& visibleContentRect, const IntRect& clippedRectInTarget, float opacity, bool opaque);
+ CCSharedQuadState(const WebKit::WebTransformationMatrix& quadTransform, const IntRect& visibleContentRect, const IntRect& clippedRectInTarget, float opacity, bool opaque);
+
+ scoped_ptr<CCSharedQuadState> copy() const;
+};
+
+}
+
+#endif
diff --git a/cc/CCSingleThreadProxy.cpp b/cc/single_thread_proxy.cc
index 7f89cf5..7f89cf5 100644
--- a/cc/CCSingleThreadProxy.cpp
+++ b/cc/single_thread_proxy.cc
diff --git a/cc/single_thread_proxy.h b/cc/single_thread_proxy.h
index 638cbb2..979dbb3 100644
--- a/cc/single_thread_proxy.h
+++ b/cc/single_thread_proxy.h
@@ -1,3 +1,134 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCSingleThreadProxy_h
+#define CCSingleThreadProxy_h
+
+#include "CCAnimationEvents.h"
+#include "CCLayerTreeHostImpl.h"
+#include "CCProxy.h"
+#include <base/time.h>
+#include <limits>
+
+namespace cc {
+
+class CCLayerTreeHost;
+
+class CCSingleThreadProxy : public CCProxy, CCLayerTreeHostImplClient {
+public:
+ static scoped_ptr<CCProxy> create(CCLayerTreeHost*);
+ virtual ~CCSingleThreadProxy();
+
+ // CCProxy implementation
+ virtual bool compositeAndReadback(void *pixels, const IntRect&) OVERRIDE;
+ virtual void startPageScaleAnimation(const IntSize& targetPosition, bool useAnchor, float scale, double duration) OVERRIDE;
+ virtual void finishAllRendering() OVERRIDE;
+ virtual bool isStarted() const OVERRIDE;
+ virtual bool initializeContext() OVERRIDE;
+ virtual void setSurfaceReady() OVERRIDE;
+ virtual void setVisible(bool) OVERRIDE;
+ virtual bool initializeRenderer() OVERRIDE;
+ virtual bool recreateContext() OVERRIDE;
+ virtual void renderingStats(CCRenderingStats*) OVERRIDE;
+ virtual const RendererCapabilities& rendererCapabilities() const OVERRIDE;
+ virtual void loseContext() OVERRIDE;
+ virtual void setNeedsAnimate() OVERRIDE;
+ virtual void setNeedsCommit() OVERRIDE;
+ virtual void setNeedsRedraw() OVERRIDE;
+ virtual bool commitRequested() const OVERRIDE;
+ virtual void didAddAnimation() OVERRIDE;
+ virtual void start() OVERRIDE;
+ virtual void stop() OVERRIDE;
+ virtual size_t maxPartialTextureUpdates() const OVERRIDE;
+ virtual void acquireLayerTextures() OVERRIDE { }
+ virtual void forceSerializeOnSwapBuffers() OVERRIDE;
+
+ // CCLayerTreeHostImplClient implementation
+ virtual void didLoseContextOnImplThread() OVERRIDE { }
+ virtual void onSwapBuffersCompleteOnImplThread() OVERRIDE;
+ virtual void onVSyncParametersChanged(double monotonicTimebase, double intervalInSeconds) OVERRIDE { }
+ virtual void onCanDrawStateChanged(bool canDraw) OVERRIDE { }
+ virtual void setNeedsRedrawOnImplThread() OVERRIDE;
+ virtual void setNeedsCommitOnImplThread() OVERRIDE;
+ virtual void postAnimationEventsToMainThreadOnImplThread(scoped_ptr<CCAnimationEventsVector>, double wallClockTime) OVERRIDE;
+ virtual void releaseContentsTexturesOnImplThread() OVERRIDE;
+
+ // Called by the legacy path where RenderWidget does the scheduling.
+ void compositeImmediately();
+
+private:
+ explicit CCSingleThreadProxy(CCLayerTreeHost*);
+
+ bool commitAndComposite();
+ void doCommit(PassOwnPtr<CCTextureUpdateQueue>);
+ bool doComposite();
+ void didSwapFrame();
+
+ // Accessed on main thread only.
+ CCLayerTreeHost* m_layerTreeHost;
+ bool m_contextLost;
+
+ // Holds on to the context between initializeContext() and initializeRenderer() calls. Shouldn't
+ // be used for anything else.
+ scoped_ptr<CCGraphicsContext> m_contextBeforeInitialization;
+
+ // Used on the CCThread, but checked on main thread during initialization/shutdown.
+ scoped_ptr<CCLayerTreeHostImpl> m_layerTreeHostImpl;
+ bool m_rendererInitialized;
+ RendererCapabilities m_RendererCapabilitiesForMainThread;
+
+ bool m_nextFrameIsNewlyCommittedFrame;
+
+ base::TimeDelta m_totalCommitTime;
+ size_t m_totalCommitCount;
+};
+
+// For use in the single-threaded case. In debug builds, it pretends that the
+// code is running on the impl thread to satisfy assertion checks.
+class DebugScopedSetImplThread {
+public:
+ DebugScopedSetImplThread()
+ {
+#if !ASSERT_DISABLED
+ CCProxy::setCurrentThreadIsImplThread(true);
+#endif
+ }
+ ~DebugScopedSetImplThread()
+ {
+#if !ASSERT_DISABLED
+ CCProxy::setCurrentThreadIsImplThread(false);
+#endif
+ }
+};
+
+// For use in the single-threaded case. In debug builds, it pretends that the
+// code is running on the main thread to satisfy assertion checks.
+class DebugScopedSetMainThread {
+public:
+ DebugScopedSetMainThread()
+ {
+#if !ASSERT_DISABLED
+ CCProxy::setCurrentThreadIsImplThread(false);
+#endif
+ }
+ ~DebugScopedSetMainThread()
+ {
+#if !ASSERT_DISABLED
+ CCProxy::setCurrentThreadIsImplThread(true);
+#endif
+ }
+};
+
+// For use in the single-threaded case. In debug builds, it pretends that the
+// code is running on the impl thread and that the main thread is blocked to
+// satisfy assertion checks
+class DebugScopedSetImplThreadAndMainThreadBlocked {
+private:
+ DebugScopedSetImplThread m_implThread;
+ DebugScopedSetMainThreadBlocked m_mainThreadBlocked;
+};
+
+} // namespace cc
+
+#endif
diff --git a/cc/SkPictureCanvasLayerTextureUpdater.cpp b/cc/skpicture_canvas_layer_texture_updater.cc
index 62026d7..62026d7 100644
--- a/cc/SkPictureCanvasLayerTextureUpdater.cpp
+++ b/cc/skpicture_canvas_layer_texture_updater.cc
diff --git a/cc/skpicture_canvas_layer_texture_updater.h b/cc/skpicture_canvas_layer_texture_updater.h
index 638cbb2..fd9bb5f 100644
--- a/cc/skpicture_canvas_layer_texture_updater.h
+++ b/cc/skpicture_canvas_layer_texture_updater.h
@@ -1,3 +1,48 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+
+#ifndef SkPictureCanvasLayerTextureUpdater_h
+#define SkPictureCanvasLayerTextureUpdater_h
+
+#if USE(ACCELERATED_COMPOSITING)
+
+#include "CanvasLayerTextureUpdater.h"
+#include "SkPicture.h"
+
+class SkCanvas;
+
+namespace cc {
+
+class LayerPainterChromium;
+
+// This class records the contentRect into an SkPicture. Subclasses, provide
+// different implementations of tile updating based on this recorded picture.
+// The BitmapSkPictureCanvasLayerTextureUpdater and
+// FrameBufferSkPictureCanvasLayerTextureUpdater are two examples of such
+// implementations.
+class SkPictureCanvasLayerTextureUpdater : public CanvasLayerTextureUpdater {
+public:
+ virtual ~SkPictureCanvasLayerTextureUpdater();
+
+ virtual void setOpaque(bool) OVERRIDE;
+
+protected:
+ explicit SkPictureCanvasLayerTextureUpdater(PassOwnPtr<LayerPainterChromium>);
+
+ virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpaqueRect, CCRenderingStats&) OVERRIDE;
+ void drawPicture(SkCanvas*);
+
+ bool layerIsOpaque() const { return m_layerIsOpaque; }
+
+private:
+ // Recording canvas.
+ SkPicture m_picture;
+ // True when it is known that all output pixels will be opaque.
+ bool m_layerIsOpaque;
+};
+
+} // namespace cc
+#endif // USE(ACCELERATED_COMPOSITING)
+#endif // SkPictureCanvasLayerTextureUpdater_h
diff --git a/cc/CCRendererSoftware.cpp b/cc/software_renderer.cc
index e833780..e833780 100644
--- a/cc/CCRendererSoftware.cpp
+++ b/cc/software_renderer.cc
diff --git a/cc/software_renderer.h b/cc/software_renderer.h
index 638cbb2..2ad688f 100644
--- a/cc/software_renderer.h
+++ b/cc/software_renderer.h
@@ -1,3 +1,76 @@
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCRendererSoftware_h
+#define CCRendererSoftware_h
+
+#include "base/basictypes.h"
+#include "CCDirectRenderer.h"
+#include "CCLayerTreeHost.h"
+#include <public/WebCompositorSoftwareOutputDevice.h>
+
+namespace cc {
+
+class CCDebugBorderDrawQuad;
+class CCRendererClient;
+class CCResourceProvider;
+class CCSolidColorDrawQuad;
+class CCTextureDrawQuad;
+class CCTileDrawQuad;
+
+class CCRendererSoftware : public CCDirectRenderer {
+public:
+ static PassOwnPtr<CCRendererSoftware> create(CCRendererClient*, CCResourceProvider*, WebKit::WebCompositorSoftwareOutputDevice*);
+ virtual ~CCRendererSoftware();
+
+ virtual const RendererCapabilities& capabilities() const OVERRIDE;
+
+ virtual void viewportChanged() OVERRIDE;
+
+ virtual void finish() OVERRIDE;
+
+ virtual bool swapBuffers() OVERRIDE;
+
+ virtual void getFramebufferPixels(void *pixels, const IntRect&) OVERRIDE;
+
+ virtual void setVisible(bool) OVERRIDE;
+
+protected:
+ virtual void bindFramebufferToOutputSurface(DrawingFrame&) OVERRIDE;
+ virtual bool bindFramebufferToTexture(DrawingFrame&, const CCScopedTexture*, const IntRect& framebufferRect) OVERRIDE;
+ virtual void setDrawViewportSize(const IntSize&) OVERRIDE;
+ virtual void enableScissorTestRect(const IntRect& scissorRect) OVERRIDE;
+ virtual void disableScissorTest() OVERRIDE;
+ virtual void clearFramebuffer(DrawingFrame&) OVERRIDE;
+ virtual void drawQuad(DrawingFrame&, const CCDrawQuad*) OVERRIDE;
+ virtual void beginDrawingFrame(DrawingFrame&) OVERRIDE;
+ virtual void finishDrawingFrame(DrawingFrame&) OVERRIDE;
+ virtual bool flippedFramebuffer() const OVERRIDE;
+
+private:
+ CCRendererSoftware(CCRendererClient*, CCResourceProvider*, WebKit::WebCompositorSoftwareOutputDevice*);
+
+ bool isSoftwareResource(CCResourceProvider::ResourceId) const;
+
+ void drawDebugBorderQuad(const DrawingFrame&, const CCDebugBorderDrawQuad*);
+ void drawSolidColorQuad(const DrawingFrame&, const CCSolidColorDrawQuad*);
+ void drawTextureQuad(const DrawingFrame&, const CCTextureDrawQuad*);
+ void drawTileQuad(const DrawingFrame&, const CCTileDrawQuad*);
+ void drawUnsupportedQuad(const DrawingFrame&, const CCDrawQuad*);
+
+ RendererCapabilities m_capabilities;
+ bool m_visible;
+
+ WebKit::WebCompositorSoftwareOutputDevice* m_outputDevice;
+ OwnPtr<SkCanvas> m_skRootCanvas;
+ SkCanvas* m_skCurrentCanvas;
+ SkPaint m_skCurrentPaint;
+ OwnPtr<CCResourceProvider::ScopedWriteLockSoftware> m_currentFramebufferLock;
+
+ DISALLOW_COPY_AND_ASSIGN(CCRendererSoftware);
+};
+
+}
+
+#endif
diff --git a/cc/CCSolidColorDrawQuad.cpp b/cc/solid_color_draw_quad.cc
index 157acd9..157acd9 100644
--- a/cc/CCSolidColorDrawQuad.cpp
+++ b/cc/solid_color_draw_quad.cc
diff --git a/cc/solid_color_draw_quad.h b/cc/solid_color_draw_quad.h
index 638cbb2..6825612 100644
--- a/cc/solid_color_draw_quad.h
+++ b/cc/solid_color_draw_quad.h
@@ -1,3 +1,33 @@
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCSolidColorDrawQuad_h
+#define CCSolidColorDrawQuad_h
+
+#include "CCDrawQuad.h"
+#include "SkColor.h"
+#include "base/memory/scoped_ptr.h"
+
+namespace cc {
+
+#pragma pack(push, 4)
+
+class CCSolidColorDrawQuad : public CCDrawQuad {
+public:
+ static scoped_ptr<CCSolidColorDrawQuad> create(const CCSharedQuadState*, const IntRect&, SkColor);
+
+ SkColor color() const { return m_color; };
+
+ static const CCSolidColorDrawQuad* materialCast(const CCDrawQuad*);
+private:
+ CCSolidColorDrawQuad(const CCSharedQuadState*, const IntRect&, SkColor);
+
+ SkColor m_color;
+};
+
+#pragma pack(pop)
+
+}
+
+#endif
diff --git a/cc/SolidColorLayerChromium.cpp b/cc/solid_color_layer.cc
index d5c0b42..d5c0b42 100644
--- a/cc/SolidColorLayerChromium.cpp
+++ b/cc/solid_color_layer.cc
diff --git a/cc/solid_color_layer.h b/cc/solid_color_layer.h
index 638cbb2..9123484 100644
--- a/cc/solid_color_layer.h
+++ b/cc/solid_color_layer.h
@@ -1,3 +1,33 @@
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+
+#ifndef SolidColorLayerChromium_h
+#define SolidColorLayerChromium_h
+
+#if USE(ACCELERATED_COMPOSITING)
+
+#include "LayerChromium.h"
+
+namespace cc {
+
+// A Layer that renders a solid color. The color is specified by using
+// setBackgroundColor() on the base class.
+class SolidColorLayerChromium : public LayerChromium {
+public:
+ static scoped_refptr<SolidColorLayerChromium> create();
+
+ virtual scoped_ptr<CCLayerImpl> createCCLayerImpl() OVERRIDE;
+
+protected:
+ SolidColorLayerChromium();
+
+private:
+ virtual ~SolidColorLayerChromium();
+};
+
+}
+#endif // USE(ACCELERATED_COMPOSITING)
+
+#endif
diff --git a/cc/CCSolidColorLayerImpl.cpp b/cc/solid_color_layer_impl.cc
index abf8d48..abf8d48 100644
--- a/cc/CCSolidColorLayerImpl.cpp
+++ b/cc/solid_color_layer_impl.cc
diff --git a/cc/solid_color_layer_impl.h b/cc/solid_color_layer_impl.h
index 638cbb2..72beb25 100644
--- a/cc/solid_color_layer_impl.h
+++ b/cc/solid_color_layer_impl.h
@@ -1,3 +1,34 @@
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCSolidColorLayerImpl_h
+#define CCSolidColorLayerImpl_h
+
+#include "CCLayerImpl.h"
+#include <public/WebTransformationMatrix.h>
+
+namespace cc {
+
+class CCSolidColorLayerImpl : public CCLayerImpl {
+public:
+ static scoped_ptr<CCSolidColorLayerImpl> create(int id)
+ {
+ return make_scoped_ptr(new CCSolidColorLayerImpl(id));
+ }
+ virtual ~CCSolidColorLayerImpl();
+
+ virtual void appendQuads(CCQuadSink&, CCAppendQuadsData&) OVERRIDE;
+
+protected:
+ explicit CCSolidColorLayerImpl(int id);
+
+private:
+ virtual const char* layerTypeAsString() const OVERRIDE;
+
+ const int m_tileSize;
+};
+
+}
+
+#endif // CCSolidColorLayerImpl_h
diff --git a/cc/CCStreamVideoDrawQuad.cpp b/cc/stream_video_draw_quad.cc
index e92d98a..e92d98a 100644
--- a/cc/CCStreamVideoDrawQuad.cpp
+++ b/cc/stream_video_draw_quad.cc
diff --git a/cc/stream_video_draw_quad.h b/cc/stream_video_draw_quad.h
index 638cbb2..6a1b6c4 100644
--- a/cc/stream_video_draw_quad.h
+++ b/cc/stream_video_draw_quad.h
@@ -1,3 +1,35 @@
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCStreamVideoDrawQuad_h
+#define CCStreamVideoDrawQuad_h
+
+#include "CCDrawQuad.h"
+#include "base/memory/scoped_ptr.h"
+#include <public/WebTransformationMatrix.h>
+
+namespace cc {
+
+#pragma pack(push, 4)
+
+class CCStreamVideoDrawQuad : public CCDrawQuad {
+public:
+ static scoped_ptr<CCStreamVideoDrawQuad> create(const CCSharedQuadState*, const IntRect&, unsigned textureId, const WebKit::WebTransformationMatrix&);
+
+ unsigned textureId() const { return m_textureId; }
+ const WebKit::WebTransformationMatrix& matrix() const { return m_matrix; }
+
+ static const CCStreamVideoDrawQuad* materialCast(const CCDrawQuad*);
+private:
+ CCStreamVideoDrawQuad(const CCSharedQuadState*, const IntRect&, unsigned textureId, const WebKit::WebTransformationMatrix&);
+
+ unsigned m_textureId;
+ WebKit::WebTransformationMatrix m_matrix;
+};
+
+#pragma pack(pop)
+
+}
+
+#endif
diff --git a/cc/stubs/Extensions3D.h b/cc/stubs/Extensions3D.h
index bbeb9e6..77f010e 100644
--- a/cc/stubs/Extensions3D.h
+++ b/cc/stubs/Extensions3D.h
@@ -1,25 +1,6 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CC_STUBS_EXTENSIONS3D_H_
-#define CC_STUBS_EXTENSIONS3D_H_
-
-#include "third_party/khronos/GLES2/gl2.h"
-#include "third_party/khronos/GLES2/gl2ext.h"
-
-namespace cc {
-
-class Extensions3D {
-public:
- enum {
- TEXTURE_RECTANGLE_ARB = GL_TEXTURE_RECTANGLE_ARB,
- BGRA_EXT = GL_BGRA_EXT,
- RGBA8_OES = GL_RGBA8_OES,
- };
-};
-
-}
-
-
-#endif // CC_STUBS_EXTENSIONS3D_H_
+// Temporary forwarding header
+#include "cc/stubs/extensions_3d.h"
diff --git a/cc/stubs/Extensions3DChromium.h b/cc/stubs/Extensions3DChromium.h
index f5d36d2..f3c6fa9 100644
--- a/cc/stubs/Extensions3DChromium.h
+++ b/cc/stubs/Extensions3DChromium.h
@@ -1,54 +1,6 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CC_STUBS_EXTENSIONS3DCHROMIUM_H_
-#define CC_STUBS_EXTENSIONS3DCHROMIUM_H_
-
-#include "Extensions3D.h"
-
-// These enum names collides with gl2ext.h, so we just redefine them.
-#ifdef GL_TEXTURE_EXTERNAL_OES
-#undef GL_TEXTURE_EXTERNAL_OES
-#endif
-#ifdef GL_TEXTURE_USAGE_ANGLE
-#undef GL_TEXTURE_USAGE_ANGLE
-#endif
-#ifdef GL_FRAMEBUFFER_ATTACHMENT_ANGLE
-#undef GL_FRAMEBUFFER_ATTACHMENT_ANGLE
-#endif
-
-namespace cc {
-
-class Extensions3DChromium {
-public:
- enum {
- // GL_OES_EGL_image_external
- GL_TEXTURE_EXTERNAL_OES = 0x8D65,
-
- // GL_CHROMIUM_map_sub (enums inherited from GL_ARB_vertex_buffer_object)
- READ_ONLY = 0x88B8,
- WRITE_ONLY = 0x88B9,
-
- // GL_ANGLE_texture_usage
- GL_TEXTURE_USAGE_ANGLE = 0x93A2,
- GL_FRAMEBUFFER_ATTACHMENT_ANGLE = 0x93A3,
-
- // GL_EXT_texture_storage
- BGRA8_EXT = 0x93A1,
-
- // GL_EXT_occlusion_query_boolean
- ANY_SAMPLES_PASSED_EXT = 0x8C2F,
- ANY_SAMPLES_PASSED_CONSERVATIVE_EXT = 0x8D6A,
- CURRENT_QUERY_EXT = 0x8865,
- QUERY_RESULT_EXT = 0x8866,
- QUERY_RESULT_AVAILABLE_EXT = 0x8867,
-
- // GL_CHROMIUM_command_buffer_query
- COMMANDS_ISSUED_CHROMIUM = 0x84F2
- };
-};
-
-}
-
-#endif // CC_STUBS_EXTENSIONS3DCHROMIUM_H_
+// Temporary forwarding header
+#include "cc/stubs/extensions_3d_chromium.h"
diff --git a/cc/stubs/FloatPoint.h b/cc/stubs/FloatPoint.h
index 4ce2681..df1fe9f 100644
--- a/cc/stubs/FloatPoint.h
+++ b/cc/stubs/FloatPoint.h
@@ -1,51 +1,6 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CC_STUBS_FLOATPOINT_H_
-#define CC_STUBS_FLOATPOINT_H_
-
-#include "FloatSize.h"
-#include "IntPoint.h"
-#if INSIDE_WEBKIT_BUILD
-#include "Source/WebCore/platform/graphics/FloatPoint.h"
-#else
-#include "third_party/WebKit/Source/WebCore/platform/graphics/FloatPoint.h"
-#endif
-
-namespace cc {
-
-class FloatPoint : public WebCore::FloatPoint {
-public:
- FloatPoint() { }
-
- FloatPoint(float width, float height)
- : WebCore::FloatPoint(width, height)
- {
- }
-
- FloatPoint(FloatSize size)
- : WebCore::FloatPoint(size)
- {
- }
-
- FloatPoint(IntPoint point)
- : WebCore::FloatPoint(point)
- {
- }
-
- FloatPoint(WebCore::IntPoint point)
- : WebCore::FloatPoint(point)
- {
- }
-
- FloatPoint(WebCore::FloatPoint point)
- : WebCore::FloatPoint(point.x(), point.y())
- {
-
- }
-};
-
-}
-
-#endif
+// Temporary forwarding header
+#include "cc/stubs/float_point.h"
diff --git a/cc/stubs/FloatPoint3D.h b/cc/stubs/FloatPoint3D.h
index 02ff076..3d5f90c 100644
--- a/cc/stubs/FloatPoint3D.h
+++ b/cc/stubs/FloatPoint3D.h
@@ -1,50 +1,6 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CC_STUBS_FLOATPOINT3D_H_
-#define CC_STUBS_FLOATPOINT3D_H_
-
-#include "FloatPoint.h"
-
-#if INSIDE_WEBKIT_BUILD
-#include "Source/WebCore/platform/graphics/FloatPoint3D.h"
-#else
-#include "third_party/WebKit/Source/WebCore/platform/graphics/FloatPoint3D.h"
-#endif
-
-namespace cc {
-
-class FloatPoint3D : public WebCore::FloatPoint3D {
-public:
- FloatPoint3D() { }
-
- FloatPoint3D(float x, float y, float z)
- : WebCore::FloatPoint3D(x, y, z)
- {
- }
-
- FloatPoint3D(FloatPoint point)
- : WebCore::FloatPoint3D(point.x(), point.y(), 0)
- {
- }
-
- FloatPoint3D(const FloatPoint3D& point)
- : WebCore::FloatPoint3D(point)
- {
- }
-
- FloatPoint3D(WebCore::FloatPoint3D point)
- : WebCore::FloatPoint3D(point)
- {
- }
-
- FloatPoint3D(WebCore::FloatPoint point)
- : WebCore::FloatPoint3D(point)
- {
- }
-};
-
-}
-
-#endif
+// Temporary forwarding header
+#include "cc/stubs/float_point_3d.h"
diff --git a/cc/stubs/FloatQuad.h b/cc/stubs/FloatQuad.h
index f2f45ed..4495a84 100644
--- a/cc/stubs/FloatQuad.h
+++ b/cc/stubs/FloatQuad.h
@@ -1,56 +1,6 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CC_STUBS_FLOATQUAD_H_
-#define CC_STUBS_FLOATQUAD_H_
-
-#include "FloatPoint.h"
-#include "FloatRect.h"
-#if INSIDE_WEBKIT_BUILD
-#include "Source/WebCore/platform/graphics/FloatQuad.h"
-#else
-#include "third_party/WebKit/Source/WebCore/platform/graphics/FloatQuad.h"
-#endif
-
-namespace cc {
-
-class FloatQuad : public WebCore::FloatQuad
-{
-public:
- FloatQuad() { }
-
- FloatQuad(const FloatPoint& p1, const FloatPoint& p2, const FloatPoint& p3, const FloatPoint& p4)
- : WebCore::FloatQuad(p1, p2, p3, p4)
- {
- }
-
- FloatQuad(const FloatRect& rect)
- : WebCore::FloatQuad(rect)
- {
- }
-
- FloatQuad(const IntRect& rect)
- : WebCore::FloatQuad(rect)
- {
- }
-
- FloatQuad(const WebCore::FloatRect& rect)
- : WebCore::FloatQuad(rect)
- {
- }
-
- FloatQuad(const WebCore::IntRect& rect)
- : WebCore::FloatQuad(rect)
- {
- }
-
- FloatQuad(const WebCore::FloatQuad& quad)
- : WebCore::FloatQuad(quad)
- {
- }
-};
-
-}
-
-#endif
+// Temporary forwarding header
+#include "cc/stubs/float_quad.h"
diff --git a/cc/stubs/FloatRect.h b/cc/stubs/FloatRect.h
index 2eb03e2..1957e86 100644
--- a/cc/stubs/FloatRect.h
+++ b/cc/stubs/FloatRect.h
@@ -1,56 +1,6 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CC_STUBS_FLOATRECT_H_
-#define CC_STUBS_FLOATRECT_H_
-
-#include "FloatPoint.h"
-#include "FloatSize.h"
-#include "IntRect.h"
-#if INSIDE_WEBKIT_BUILD
-#include "Source/WebCore/platform/graphics/FloatRect.h"
-#else
-#include "third_party/WebKit/Source/WebCore/platform/graphics/FloatRect.h"
-#endif
-
-namespace cc {
-
-class FloatRect : public WebCore::FloatRect {
-public:
- FloatRect() { }
-
- FloatRect(const FloatPoint& location, const FloatSize& size)
- : WebCore::FloatRect(location, size)
- {
- }
-
- FloatRect(const IntPoint& location, const IntSize& size)
- : WebCore::FloatRect(location, size)
- {
- }
-
- FloatRect(float x, float y, float width, float height)
- : WebCore::FloatRect(x, y, width, height)
- {
- }
-
- FloatRect(const IntRect& rect)
- : WebCore::FloatRect(rect)
- {
- }
-
- FloatRect(const WebCore::IntRect& rect)
- : WebCore::FloatRect(rect)
- {
- }
-
- FloatRect(const WebCore::FloatRect& rect)
- :WebCore::FloatRect(rect)
- {
- }
-};
-
-}
-
-#endif
+// Temporary forwarding header
+#include "cc/stubs/float_rect.h"
diff --git a/cc/stubs/FloatSize.h b/cc/stubs/FloatSize.h
index 9db5978..f5d5c4e 100644
--- a/cc/stubs/FloatSize.h
+++ b/cc/stubs/FloatSize.h
@@ -1,43 +1,6 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CC_STUBS_FLOATSIZE_H_
-#define CC_STUBS_FLOATSIZE_H_
-
-#include "IntSize.h"
-#if INSIDE_WEBKIT_BUILD
-#include "Source/WebCore/platform/graphics/FloatSize.h"
-#else
-#include "third_party/WebKit/Source/WebCore/platform/graphics/FloatSize.h"
-#endif
-
-namespace cc {
-class FloatSize : public WebCore::FloatSize {
-public:
- FloatSize() { }
-
- FloatSize(float width, float height)
- : WebCore::FloatSize(width, height)
- {
- }
-
- FloatSize(IntSize size)
- : WebCore::FloatSize(size.width(), size.height())
- {
- }
-
- FloatSize(WebCore::FloatSize size)
- : WebCore::FloatSize(size.width(), size.height())
- {
- }
-
- FloatSize(WebCore::IntSize size)
- : WebCore::FloatSize(size.width(), size.height())
- {
- }
-};
-
-}
-
-#endif
+// Temporary forwarding header
+#include "cc/stubs/float_size.h"
diff --git a/cc/stubs/GraphicsContext3D.h b/cc/stubs/GraphicsContext3D.h
index e7f7a60..3460a30 100644
--- a/cc/stubs/GraphicsContext3D.h
+++ b/cc/stubs/GraphicsContext3D.h
@@ -1,74 +1,6 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CC_STUBS_GRAPHICSCONTEXT3D_H_
-#define CC_STUBS_GRAPHICSCONTEXT3D_H_
-
-#include "GraphicsTypes3D.h"
-#include "IntSize.h"
-#include "third_party/khronos/GLES2/gl2.h"
-
-#ifdef NO_ERROR
-#undef NO_ERROR
-#endif
-
-namespace cc {
-
-class GraphicsContext3D {
-public:
- enum SourceDataFormat { SourceFormatRGBA8, SourceFormatBGRA8 };
- static bool computeFormatAndTypeParameters(unsigned, unsigned, unsigned* componentsPerPixel, unsigned* bytesPerComponent);
-
- enum {
- ARRAY_BUFFER = GL_ARRAY_BUFFER,
- BLEND = GL_BLEND,
- CLAMP_TO_EDGE = GL_CLAMP_TO_EDGE,
- COLOR_ATTACHMENT0 = GL_COLOR_ATTACHMENT0,
- COLOR_BUFFER_BIT = GL_COLOR_BUFFER_BIT,
- COMPILE_STATUS = GL_COMPILE_STATUS,
- CULL_FACE = GL_CULL_FACE,
- DEPTH_TEST = GL_DEPTH_TEST,
- ELEMENT_ARRAY_BUFFER = GL_ELEMENT_ARRAY_BUFFER,
- EXTENSIONS = GL_EXTENSIONS,
- FLOAT = GL_FLOAT,
- FRAGMENT_SHADER = GL_FRAGMENT_SHADER,
- FRAMEBUFFER_COMPLETE = GL_FRAMEBUFFER_COMPLETE,
- FRAMEBUFFER = GL_FRAMEBUFFER,
- INVALID_ENUM = GL_INVALID_ENUM,
- INVALID_VALUE = GL_INVALID_VALUE,
- LINEAR = GL_LINEAR,
- LINE_LOOP = GL_LINE_LOOP ,
- LINK_STATUS = GL_LINK_STATUS,
- LUMINANCE = GL_LUMINANCE,
- MAX_TEXTURE_SIZE = GL_MAX_TEXTURE_SIZE,
- NEAREST = GL_NEAREST,
- NO_ERROR = GL_NO_ERROR,
- ONE = GL_ONE,
- ONE_MINUS_SRC_ALPHA = GL_ONE_MINUS_SRC_ALPHA,
- RGBA = GL_RGBA,
- RGB = GL_RGB,
- SCISSOR_TEST = GL_SCISSOR_TEST,
- SRC_ALPHA = GL_SRC_ALPHA,
- STATIC_DRAW = GL_STATIC_DRAW,
- TEXTURE0 = GL_TEXTURE0,
- TEXTURE1 = GL_TEXTURE1,
- TEXTURE_2D = GL_TEXTURE_2D,
- TEXTURE2 = GL_TEXTURE2,
- TEXTURE3 = GL_TEXTURE3,
- TEXTURE_MAG_FILTER = GL_TEXTURE_MAG_FILTER,
- TEXTURE_MIN_FILTER = GL_TEXTURE_MIN_FILTER,
- TEXTURE_WRAP_S = GL_TEXTURE_WRAP_S,
- TEXTURE_WRAP_T = GL_TEXTURE_WRAP_T,
- TRIANGLES = GL_TRIANGLES,
- TRIANGLE_FAN = GL_TRIANGLE_FAN,
- UNSIGNED_BYTE = GL_UNSIGNED_BYTE,
- UNSIGNED_SHORT = GL_UNSIGNED_SHORT,
- VERTEX_SHADER = GL_VERTEX_SHADER,
- ZERO = GL_ZERO,
- };
-};
-
-}
-
-#endif // CC_STUBS_GRAPHICSCONTEXT3D_H_
+// Temporary forwarding header
+#include "cc/stubs/graphics_context_3d.h"
diff --git a/cc/stubs/GraphicsTypes3D.h b/cc/stubs/GraphicsTypes3D.h
index a01414e..8d08bb3 100644
--- a/cc/stubs/GraphicsTypes3D.h
+++ b/cc/stubs/GraphicsTypes3D.h
@@ -1,18 +1,6 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CC_STUBS_GRAPHICSTYPES3D_H_
-#define CC_STUBS_GRAPHICSTYPES3D_H_
-
-#define NullPlatform3DObject 0
-
-typedef unsigned char GC3Dboolean;
-typedef unsigned GC3Denum;
-typedef unsigned GC3Duint;
-typedef unsigned Platform3DObject;
-typedef int GC3Dint;
-typedef signed char GC3Dbyte;
-
-#endif // CC_STUBS_GRAPHICSTYPES3D_H_
-
+// Temporary forwarding header
+#include "cc/stubs/graphics_types_3d.h"
diff --git a/cc/stubs/IntPoint.h b/cc/stubs/IntPoint.h
index fa12dea..d996ea8 100644
--- a/cc/stubs/IntPoint.h
+++ b/cc/stubs/IntPoint.h
@@ -1,40 +1,6 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CC_STUBS_INTPOINT_H_
-#define CC_STUBS_INTPOINT_H_
-
-#include "IntSize.h"
-#if INSIDE_WEBKIT_BUILD
-#include "Source/WebCore/platform/graphics/IntPoint.h"
-#else
-#include "third_party/WebKit/Source/WebCore/platform/graphics/IntPoint.h"
-#endif
-
-namespace cc {
-
-class IntPoint : public WebCore::IntPoint {
-public:
- IntPoint() { }
-
- IntPoint(int width, int height)
- : WebCore::IntPoint(width, height)
- {
- }
-
- IntPoint(IntSize size)
- : WebCore::IntPoint(size.width(), size.height())
- {
- }
-
- IntPoint(WebCore::IntPoint point)
- : WebCore::IntPoint(point.x(), point.y())
- {
-
- }
-};
-
-}
-
-#endif
+// Temporary forwarding header
+#include "cc/stubs/int_point.h"
diff --git a/cc/stubs/IntRect.h b/cc/stubs/IntRect.h
index 1599967..1d136ed 100644
--- a/cc/stubs/IntRect.h
+++ b/cc/stubs/IntRect.h
@@ -1,41 +1,6 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CC_STUBS_INTRECT_H_
-#define CC_STUBS_INTRECT_H_
-
-#include "IntPoint.h"
-#include "IntSize.h"
-#if INSIDE_WEBKIT_BUILD
-#include "Source/WebCore/platform/graphics/IntRect.h"
-#else
-#include "third_party/WebKit/Source/WebCore/platform/graphics/IntRect.h"
-#endif
-
-namespace cc {
-
-class IntRect : public WebCore::IntRect {
-public:
- IntRect() { }
-
- IntRect(const IntPoint& location, const IntSize& size)
- : WebCore::IntRect(location, size)
- {
- }
-
- IntRect(int x, int y, int width, int height)
- : WebCore::IntRect(x, y, width, height)
- {
- }
-
- IntRect(WebCore::IntRect rect)
- : WebCore::IntRect(rect.x(), rect.y(), rect.width(), rect.height())
- {
-
- }
-};
-
-}
-
-#endif
+// Temporary forwarding header
+#include "cc/stubs/int_rect.h"
diff --git a/cc/stubs/IntSize.h b/cc/stubs/IntSize.h
index c53f4f1..4508c69 100644
--- a/cc/stubs/IntSize.h
+++ b/cc/stubs/IntSize.h
@@ -1,34 +1,6 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CC_STUBS_INTSIZE_H_
-#define CC_STUBS_INTSIZE_H_
-
-#if INSIDE_WEBKIT_BUILD
-#include "Source/WebCore/platform/graphics/IntSize.h"
-#else
-#include "third_party/WebKit/Source/WebCore/platform/graphics/IntSize.h"
-#endif
-
-namespace cc {
-
-class IntSize : public WebCore::IntSize {
-public:
- IntSize() { }
-
- IntSize(int width, int height)
- : WebCore::IntSize(width, height)
- {
- }
-
- IntSize(WebCore::IntSize size)
- : WebCore::IntSize(size.width(), size.height())
- {
-
- }
-};
-
-}
-
-#endif
+// Temporary forwarding header
+#include "cc/stubs/int_size.h"
diff --git a/cc/stubs/NotImplemented.h b/cc/stubs/NotImplemented.h
index 7c6bba5..4ac19a5 100644
--- a/cc/stubs/NotImplemented.h
+++ b/cc/stubs/NotImplemented.h
@@ -1,10 +1,6 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CC_STUBS_NOTIMPLEMENTED_H
-#define CC_STUBS_NOTIMPLEMENTED_H
-
-#define notImplemented() do { } while(0)
-
-#endif // CC_STUBS_NOTIMPLEMENTED_H
+// Temporary forwarding header
+#include "cc/stubs/not_implemented.h"
diff --git a/cc/stubs/SkiaUtils.h b/cc/stubs/SkiaUtils.h
index fb81f3e..c3bbf89 100644
--- a/cc/stubs/SkiaUtils.h
+++ b/cc/stubs/SkiaUtils.h
@@ -1,17 +1,6 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CC_STUBS_SKIAUTILS_H_
-#define CC_STUBS_SKIAUTILS_H_
-
-namespace cc {
-
-inline SkScalar CCFloatToSkScalar(float f)
-{
- return SkFloatToScalar(isfinite(f) ? f : 0);
-}
-
-}
-
-#endif // CC_STUBS_SKIAUTILS_H_
+// Temporary forwarding header
+#include "cc/stubs/skia_utils.h"
diff --git a/cc/stubs/TilingData.h b/cc/stubs/TilingData.h
index 0221500..e6507e3 100644
--- a/cc/stubs/TilingData.h
+++ b/cc/stubs/TilingData.h
@@ -1,18 +1,6 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CC_STUBS_TILINGDATA_H_
-#define CC_STUBS_TILINGDATA_H_
-
-#if INSIDE_WEBKIT_BUILD
-#include "Source/WebCore/platform/graphics/gpu/TilingData.h"
-#else
-#include "third_party/WebKit/Source/WebCore/platform/graphics/gpu/TilingData.h"
-#endif
-
-namespace cc {
- typedef WebCore::TilingData TilingData;
-}
-
-#endif // CC_STUBS_TILINGDATA_H_
+// Temporary forwarding header
+#include "cc/stubs/tiling_data.h"
diff --git a/cc/stubs/TraceEvent.h b/cc/stubs/TraceEvent.h
index 75587a3..27e4089 100644
--- a/cc/stubs/TraceEvent.h
+++ b/cc/stubs/TraceEvent.h
@@ -1,10 +1,6 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Chromium's LOG() macro collides with one from WTF.
-#ifdef LOG
-#undef LOG
-#endif
-
-#include "base/debug/trace_event.h"
+// Temporary forwarding header
+#include "cc/stubs/trace_event.h"
diff --git a/cc/stubs/UnitBezier.h b/cc/stubs/UnitBezier.h
index 1ff5da9..d6a792d 100644
--- a/cc/stubs/UnitBezier.h
+++ b/cc/stubs/UnitBezier.h
@@ -1,14 +1,6 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// TODO(jamesr): Remove or refactor this dependency.
-#if INSIDE_WEBKIT_BUILD
-#include "Source/WebCore/platform/graphics/UnitBezier.h"
-#else
-#include "third_party/WebKit/Source/WebCore/platform/graphics/UnitBezier.h"
-#endif
-
-namespace cc {
-typedef WebCore::UnitBezier UnitBezier;
-}
+// Temporary forwarding header
+#include "cc/stubs/unit_bezier.h"
diff --git a/cc/stubs/extensions_3d.h b/cc/stubs/extensions_3d.h
index 638cbb2..bbeb9e6 100644
--- a/cc/stubs/extensions_3d.h
+++ b/cc/stubs/extensions_3d.h
@@ -1,3 +1,25 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CC_STUBS_EXTENSIONS3D_H_
+#define CC_STUBS_EXTENSIONS3D_H_
+
+#include "third_party/khronos/GLES2/gl2.h"
+#include "third_party/khronos/GLES2/gl2ext.h"
+
+namespace cc {
+
+class Extensions3D {
+public:
+ enum {
+ TEXTURE_RECTANGLE_ARB = GL_TEXTURE_RECTANGLE_ARB,
+ BGRA_EXT = GL_BGRA_EXT,
+ RGBA8_OES = GL_RGBA8_OES,
+ };
+};
+
+}
+
+
+#endif // CC_STUBS_EXTENSIONS3D_H_
diff --git a/cc/stubs/extensions_3d_chromium.h b/cc/stubs/extensions_3d_chromium.h
index 638cbb2..f5d36d2 100644
--- a/cc/stubs/extensions_3d_chromium.h
+++ b/cc/stubs/extensions_3d_chromium.h
@@ -1,3 +1,54 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CC_STUBS_EXTENSIONS3DCHROMIUM_H_
+#define CC_STUBS_EXTENSIONS3DCHROMIUM_H_
+
+#include "Extensions3D.h"
+
+// These enum names collides with gl2ext.h, so we just redefine them.
+#ifdef GL_TEXTURE_EXTERNAL_OES
+#undef GL_TEXTURE_EXTERNAL_OES
+#endif
+#ifdef GL_TEXTURE_USAGE_ANGLE
+#undef GL_TEXTURE_USAGE_ANGLE
+#endif
+#ifdef GL_FRAMEBUFFER_ATTACHMENT_ANGLE
+#undef GL_FRAMEBUFFER_ATTACHMENT_ANGLE
+#endif
+
+namespace cc {
+
+class Extensions3DChromium {
+public:
+ enum {
+ // GL_OES_EGL_image_external
+ GL_TEXTURE_EXTERNAL_OES = 0x8D65,
+
+ // GL_CHROMIUM_map_sub (enums inherited from GL_ARB_vertex_buffer_object)
+ READ_ONLY = 0x88B8,
+ WRITE_ONLY = 0x88B9,
+
+ // GL_ANGLE_texture_usage
+ GL_TEXTURE_USAGE_ANGLE = 0x93A2,
+ GL_FRAMEBUFFER_ATTACHMENT_ANGLE = 0x93A3,
+
+ // GL_EXT_texture_storage
+ BGRA8_EXT = 0x93A1,
+
+ // GL_EXT_occlusion_query_boolean
+ ANY_SAMPLES_PASSED_EXT = 0x8C2F,
+ ANY_SAMPLES_PASSED_CONSERVATIVE_EXT = 0x8D6A,
+ CURRENT_QUERY_EXT = 0x8865,
+ QUERY_RESULT_EXT = 0x8866,
+ QUERY_RESULT_AVAILABLE_EXT = 0x8867,
+
+ // GL_CHROMIUM_command_buffer_query
+ COMMANDS_ISSUED_CHROMIUM = 0x84F2
+ };
+};
+
+}
+
+#endif // CC_STUBS_EXTENSIONS3DCHROMIUM_H_
diff --git a/cc/stubs/float_point.h b/cc/stubs/float_point.h
index 638cbb2..4ce2681 100644
--- a/cc/stubs/float_point.h
+++ b/cc/stubs/float_point.h
@@ -1,3 +1,51 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CC_STUBS_FLOATPOINT_H_
+#define CC_STUBS_FLOATPOINT_H_
+
+#include "FloatSize.h"
+#include "IntPoint.h"
+#if INSIDE_WEBKIT_BUILD
+#include "Source/WebCore/platform/graphics/FloatPoint.h"
+#else
+#include "third_party/WebKit/Source/WebCore/platform/graphics/FloatPoint.h"
+#endif
+
+namespace cc {
+
+class FloatPoint : public WebCore::FloatPoint {
+public:
+ FloatPoint() { }
+
+ FloatPoint(float width, float height)
+ : WebCore::FloatPoint(width, height)
+ {
+ }
+
+ FloatPoint(FloatSize size)
+ : WebCore::FloatPoint(size)
+ {
+ }
+
+ FloatPoint(IntPoint point)
+ : WebCore::FloatPoint(point)
+ {
+ }
+
+ FloatPoint(WebCore::IntPoint point)
+ : WebCore::FloatPoint(point)
+ {
+ }
+
+ FloatPoint(WebCore::FloatPoint point)
+ : WebCore::FloatPoint(point.x(), point.y())
+ {
+
+ }
+};
+
+}
+
+#endif
diff --git a/cc/stubs/float_point_3d.h b/cc/stubs/float_point_3d.h
index 638cbb2..02ff076 100644
--- a/cc/stubs/float_point_3d.h
+++ b/cc/stubs/float_point_3d.h
@@ -1,3 +1,50 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CC_STUBS_FLOATPOINT3D_H_
+#define CC_STUBS_FLOATPOINT3D_H_
+
+#include "FloatPoint.h"
+
+#if INSIDE_WEBKIT_BUILD
+#include "Source/WebCore/platform/graphics/FloatPoint3D.h"
+#else
+#include "third_party/WebKit/Source/WebCore/platform/graphics/FloatPoint3D.h"
+#endif
+
+namespace cc {
+
+class FloatPoint3D : public WebCore::FloatPoint3D {
+public:
+ FloatPoint3D() { }
+
+ FloatPoint3D(float x, float y, float z)
+ : WebCore::FloatPoint3D(x, y, z)
+ {
+ }
+
+ FloatPoint3D(FloatPoint point)
+ : WebCore::FloatPoint3D(point.x(), point.y(), 0)
+ {
+ }
+
+ FloatPoint3D(const FloatPoint3D& point)
+ : WebCore::FloatPoint3D(point)
+ {
+ }
+
+ FloatPoint3D(WebCore::FloatPoint3D point)
+ : WebCore::FloatPoint3D(point)
+ {
+ }
+
+ FloatPoint3D(WebCore::FloatPoint point)
+ : WebCore::FloatPoint3D(point)
+ {
+ }
+};
+
+}
+
+#endif
diff --git a/cc/stubs/float_quad.h b/cc/stubs/float_quad.h
index 638cbb2..f2f45ed 100644
--- a/cc/stubs/float_quad.h
+++ b/cc/stubs/float_quad.h
@@ -1,3 +1,56 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CC_STUBS_FLOATQUAD_H_
+#define CC_STUBS_FLOATQUAD_H_
+
+#include "FloatPoint.h"
+#include "FloatRect.h"
+#if INSIDE_WEBKIT_BUILD
+#include "Source/WebCore/platform/graphics/FloatQuad.h"
+#else
+#include "third_party/WebKit/Source/WebCore/platform/graphics/FloatQuad.h"
+#endif
+
+namespace cc {
+
+class FloatQuad : public WebCore::FloatQuad
+{
+public:
+ FloatQuad() { }
+
+ FloatQuad(const FloatPoint& p1, const FloatPoint& p2, const FloatPoint& p3, const FloatPoint& p4)
+ : WebCore::FloatQuad(p1, p2, p3, p4)
+ {
+ }
+
+ FloatQuad(const FloatRect& rect)
+ : WebCore::FloatQuad(rect)
+ {
+ }
+
+ FloatQuad(const IntRect& rect)
+ : WebCore::FloatQuad(rect)
+ {
+ }
+
+ FloatQuad(const WebCore::FloatRect& rect)
+ : WebCore::FloatQuad(rect)
+ {
+ }
+
+ FloatQuad(const WebCore::IntRect& rect)
+ : WebCore::FloatQuad(rect)
+ {
+ }
+
+ FloatQuad(const WebCore::FloatQuad& quad)
+ : WebCore::FloatQuad(quad)
+ {
+ }
+};
+
+}
+
+#endif
diff --git a/cc/stubs/float_rect.h b/cc/stubs/float_rect.h
index 638cbb2..2eb03e2 100644
--- a/cc/stubs/float_rect.h
+++ b/cc/stubs/float_rect.h
@@ -1,3 +1,56 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CC_STUBS_FLOATRECT_H_
+#define CC_STUBS_FLOATRECT_H_
+
+#include "FloatPoint.h"
+#include "FloatSize.h"
+#include "IntRect.h"
+#if INSIDE_WEBKIT_BUILD
+#include "Source/WebCore/platform/graphics/FloatRect.h"
+#else
+#include "third_party/WebKit/Source/WebCore/platform/graphics/FloatRect.h"
+#endif
+
+namespace cc {
+
+class FloatRect : public WebCore::FloatRect {
+public:
+ FloatRect() { }
+
+ FloatRect(const FloatPoint& location, const FloatSize& size)
+ : WebCore::FloatRect(location, size)
+ {
+ }
+
+ FloatRect(const IntPoint& location, const IntSize& size)
+ : WebCore::FloatRect(location, size)
+ {
+ }
+
+ FloatRect(float x, float y, float width, float height)
+ : WebCore::FloatRect(x, y, width, height)
+ {
+ }
+
+ FloatRect(const IntRect& rect)
+ : WebCore::FloatRect(rect)
+ {
+ }
+
+ FloatRect(const WebCore::IntRect& rect)
+ : WebCore::FloatRect(rect)
+ {
+ }
+
+ FloatRect(const WebCore::FloatRect& rect)
+ :WebCore::FloatRect(rect)
+ {
+ }
+};
+
+}
+
+#endif
diff --git a/cc/stubs/float_size.h b/cc/stubs/float_size.h
index 638cbb2..9db5978 100644
--- a/cc/stubs/float_size.h
+++ b/cc/stubs/float_size.h
@@ -1,3 +1,43 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CC_STUBS_FLOATSIZE_H_
+#define CC_STUBS_FLOATSIZE_H_
+
+#include "IntSize.h"
+#if INSIDE_WEBKIT_BUILD
+#include "Source/WebCore/platform/graphics/FloatSize.h"
+#else
+#include "third_party/WebKit/Source/WebCore/platform/graphics/FloatSize.h"
+#endif
+
+namespace cc {
+class FloatSize : public WebCore::FloatSize {
+public:
+ FloatSize() { }
+
+ FloatSize(float width, float height)
+ : WebCore::FloatSize(width, height)
+ {
+ }
+
+ FloatSize(IntSize size)
+ : WebCore::FloatSize(size.width(), size.height())
+ {
+ }
+
+ FloatSize(WebCore::FloatSize size)
+ : WebCore::FloatSize(size.width(), size.height())
+ {
+ }
+
+ FloatSize(WebCore::IntSize size)
+ : WebCore::FloatSize(size.width(), size.height())
+ {
+ }
+};
+
+}
+
+#endif
diff --git a/cc/stubs/graphics_context_3d.h b/cc/stubs/graphics_context_3d.h
index 638cbb2..e7f7a60 100644
--- a/cc/stubs/graphics_context_3d.h
+++ b/cc/stubs/graphics_context_3d.h
@@ -1,3 +1,74 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CC_STUBS_GRAPHICSCONTEXT3D_H_
+#define CC_STUBS_GRAPHICSCONTEXT3D_H_
+
+#include "GraphicsTypes3D.h"
+#include "IntSize.h"
+#include "third_party/khronos/GLES2/gl2.h"
+
+#ifdef NO_ERROR
+#undef NO_ERROR
+#endif
+
+namespace cc {
+
+class GraphicsContext3D {
+public:
+ enum SourceDataFormat { SourceFormatRGBA8, SourceFormatBGRA8 };
+ static bool computeFormatAndTypeParameters(unsigned, unsigned, unsigned* componentsPerPixel, unsigned* bytesPerComponent);
+
+ enum {
+ ARRAY_BUFFER = GL_ARRAY_BUFFER,
+ BLEND = GL_BLEND,
+ CLAMP_TO_EDGE = GL_CLAMP_TO_EDGE,
+ COLOR_ATTACHMENT0 = GL_COLOR_ATTACHMENT0,
+ COLOR_BUFFER_BIT = GL_COLOR_BUFFER_BIT,
+ COMPILE_STATUS = GL_COMPILE_STATUS,
+ CULL_FACE = GL_CULL_FACE,
+ DEPTH_TEST = GL_DEPTH_TEST,
+ ELEMENT_ARRAY_BUFFER = GL_ELEMENT_ARRAY_BUFFER,
+ EXTENSIONS = GL_EXTENSIONS,
+ FLOAT = GL_FLOAT,
+ FRAGMENT_SHADER = GL_FRAGMENT_SHADER,
+ FRAMEBUFFER_COMPLETE = GL_FRAMEBUFFER_COMPLETE,
+ FRAMEBUFFER = GL_FRAMEBUFFER,
+ INVALID_ENUM = GL_INVALID_ENUM,
+ INVALID_VALUE = GL_INVALID_VALUE,
+ LINEAR = GL_LINEAR,
+ LINE_LOOP = GL_LINE_LOOP ,
+ LINK_STATUS = GL_LINK_STATUS,
+ LUMINANCE = GL_LUMINANCE,
+ MAX_TEXTURE_SIZE = GL_MAX_TEXTURE_SIZE,
+ NEAREST = GL_NEAREST,
+ NO_ERROR = GL_NO_ERROR,
+ ONE = GL_ONE,
+ ONE_MINUS_SRC_ALPHA = GL_ONE_MINUS_SRC_ALPHA,
+ RGBA = GL_RGBA,
+ RGB = GL_RGB,
+ SCISSOR_TEST = GL_SCISSOR_TEST,
+ SRC_ALPHA = GL_SRC_ALPHA,
+ STATIC_DRAW = GL_STATIC_DRAW,
+ TEXTURE0 = GL_TEXTURE0,
+ TEXTURE1 = GL_TEXTURE1,
+ TEXTURE_2D = GL_TEXTURE_2D,
+ TEXTURE2 = GL_TEXTURE2,
+ TEXTURE3 = GL_TEXTURE3,
+ TEXTURE_MAG_FILTER = GL_TEXTURE_MAG_FILTER,
+ TEXTURE_MIN_FILTER = GL_TEXTURE_MIN_FILTER,
+ TEXTURE_WRAP_S = GL_TEXTURE_WRAP_S,
+ TEXTURE_WRAP_T = GL_TEXTURE_WRAP_T,
+ TRIANGLES = GL_TRIANGLES,
+ TRIANGLE_FAN = GL_TRIANGLE_FAN,
+ UNSIGNED_BYTE = GL_UNSIGNED_BYTE,
+ UNSIGNED_SHORT = GL_UNSIGNED_SHORT,
+ VERTEX_SHADER = GL_VERTEX_SHADER,
+ ZERO = GL_ZERO,
+ };
+};
+
+}
+
+#endif // CC_STUBS_GRAPHICSCONTEXT3D_H_
diff --git a/cc/stubs/graphics_types_3d.h b/cc/stubs/graphics_types_3d.h
index 638cbb2..a01414e 100644
--- a/cc/stubs/graphics_types_3d.h
+++ b/cc/stubs/graphics_types_3d.h
@@ -1,3 +1,18 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CC_STUBS_GRAPHICSTYPES3D_H_
+#define CC_STUBS_GRAPHICSTYPES3D_H_
+
+#define NullPlatform3DObject 0
+
+typedef unsigned char GC3Dboolean;
+typedef unsigned GC3Denum;
+typedef unsigned GC3Duint;
+typedef unsigned Platform3DObject;
+typedef int GC3Dint;
+typedef signed char GC3Dbyte;
+
+#endif // CC_STUBS_GRAPHICSTYPES3D_H_
+
diff --git a/cc/stubs/int_point.h b/cc/stubs/int_point.h
index 638cbb2..fa12dea 100644
--- a/cc/stubs/int_point.h
+++ b/cc/stubs/int_point.h
@@ -1,3 +1,40 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CC_STUBS_INTPOINT_H_
+#define CC_STUBS_INTPOINT_H_
+
+#include "IntSize.h"
+#if INSIDE_WEBKIT_BUILD
+#include "Source/WebCore/platform/graphics/IntPoint.h"
+#else
+#include "third_party/WebKit/Source/WebCore/platform/graphics/IntPoint.h"
+#endif
+
+namespace cc {
+
+class IntPoint : public WebCore::IntPoint {
+public:
+ IntPoint() { }
+
+ IntPoint(int width, int height)
+ : WebCore::IntPoint(width, height)
+ {
+ }
+
+ IntPoint(IntSize size)
+ : WebCore::IntPoint(size.width(), size.height())
+ {
+ }
+
+ IntPoint(WebCore::IntPoint point)
+ : WebCore::IntPoint(point.x(), point.y())
+ {
+
+ }
+};
+
+}
+
+#endif
diff --git a/cc/stubs/int_rect.h b/cc/stubs/int_rect.h
index 638cbb2..1599967 100644
--- a/cc/stubs/int_rect.h
+++ b/cc/stubs/int_rect.h
@@ -1,3 +1,41 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CC_STUBS_INTRECT_H_
+#define CC_STUBS_INTRECT_H_
+
+#include "IntPoint.h"
+#include "IntSize.h"
+#if INSIDE_WEBKIT_BUILD
+#include "Source/WebCore/platform/graphics/IntRect.h"
+#else
+#include "third_party/WebKit/Source/WebCore/platform/graphics/IntRect.h"
+#endif
+
+namespace cc {
+
+class IntRect : public WebCore::IntRect {
+public:
+ IntRect() { }
+
+ IntRect(const IntPoint& location, const IntSize& size)
+ : WebCore::IntRect(location, size)
+ {
+ }
+
+ IntRect(int x, int y, int width, int height)
+ : WebCore::IntRect(x, y, width, height)
+ {
+ }
+
+ IntRect(WebCore::IntRect rect)
+ : WebCore::IntRect(rect.x(), rect.y(), rect.width(), rect.height())
+ {
+
+ }
+};
+
+}
+
+#endif
diff --git a/cc/stubs/int_size.h b/cc/stubs/int_size.h
index 638cbb2..c53f4f1 100644
--- a/cc/stubs/int_size.h
+++ b/cc/stubs/int_size.h
@@ -1,3 +1,34 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CC_STUBS_INTSIZE_H_
+#define CC_STUBS_INTSIZE_H_
+
+#if INSIDE_WEBKIT_BUILD
+#include "Source/WebCore/platform/graphics/IntSize.h"
+#else
+#include "third_party/WebKit/Source/WebCore/platform/graphics/IntSize.h"
+#endif
+
+namespace cc {
+
+class IntSize : public WebCore::IntSize {
+public:
+ IntSize() { }
+
+ IntSize(int width, int height)
+ : WebCore::IntSize(width, height)
+ {
+ }
+
+ IntSize(WebCore::IntSize size)
+ : WebCore::IntSize(size.width(), size.height())
+ {
+
+ }
+};
+
+}
+
+#endif
diff --git a/cc/stubs/not_implemented.h b/cc/stubs/not_implemented.h
index 638cbb2..7c6bba5 100644
--- a/cc/stubs/not_implemented.h
+++ b/cc/stubs/not_implemented.h
@@ -1,3 +1,10 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CC_STUBS_NOTIMPLEMENTED_H
+#define CC_STUBS_NOTIMPLEMENTED_H
+
+#define notImplemented() do { } while(0)
+
+#endif // CC_STUBS_NOTIMPLEMENTED_H
diff --git a/cc/stubs/skia_utils.h b/cc/stubs/skia_utils.h
index 638cbb2..fb81f3e 100644
--- a/cc/stubs/skia_utils.h
+++ b/cc/stubs/skia_utils.h
@@ -1,3 +1,17 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CC_STUBS_SKIAUTILS_H_
+#define CC_STUBS_SKIAUTILS_H_
+
+namespace cc {
+
+inline SkScalar CCFloatToSkScalar(float f)
+{
+ return SkFloatToScalar(isfinite(f) ? f : 0);
+}
+
+}
+
+#endif // CC_STUBS_SKIAUTILS_H_
diff --git a/cc/stubs/tiling_data.h b/cc/stubs/tiling_data.h
index 638cbb2..0221500 100644
--- a/cc/stubs/tiling_data.h
+++ b/cc/stubs/tiling_data.h
@@ -1,3 +1,18 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CC_STUBS_TILINGDATA_H_
+#define CC_STUBS_TILINGDATA_H_
+
+#if INSIDE_WEBKIT_BUILD
+#include "Source/WebCore/platform/graphics/gpu/TilingData.h"
+#else
+#include "third_party/WebKit/Source/WebCore/platform/graphics/gpu/TilingData.h"
+#endif
+
+namespace cc {
+ typedef WebCore::TilingData TilingData;
+}
+
+#endif // CC_STUBS_TILINGDATA_H_
diff --git a/cc/stubs/trace_event.h b/cc/stubs/trace_event.h
index 638cbb2..75587a3 100644
--- a/cc/stubs/trace_event.h
+++ b/cc/stubs/trace_event.h
@@ -1,3 +1,10 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+// Chromium's LOG() macro collides with one from WTF.
+#ifdef LOG
+#undef LOG
+#endif
+
+#include "base/debug/trace_event.h"
diff --git a/cc/stubs/unit_bezier.h b/cc/stubs/unit_bezier.h
index 638cbb2..1ff5da9 100644
--- a/cc/stubs/unit_bezier.h
+++ b/cc/stubs/unit_bezier.h
@@ -1,3 +1,14 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+// TODO(jamesr): Remove or refactor this dependency.
+#if INSIDE_WEBKIT_BUILD
+#include "Source/WebCore/platform/graphics/UnitBezier.h"
+#else
+#include "third_party/WebKit/Source/WebCore/platform/graphics/UnitBezier.h"
+#endif
+
+namespace cc {
+typedef WebCore::UnitBezier UnitBezier;
+}
diff --git a/cc/CCTexture.cpp b/cc/texture.cc
index add8429..add8429 100644
--- a/cc/CCTexture.cpp
+++ b/cc/texture.cc
diff --git a/cc/texture.h b/cc/texture.h
index 638cbb2..8d0def3 100644
--- a/cc/texture.h
+++ b/cc/texture.h
@@ -1,3 +1,42 @@
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCTexture_h
+#define CCTexture_h
+
+#include "CCResourceProvider.h"
+#include "CCTexture.h"
+#include "GraphicsContext3D.h"
+#include "IntSize.h"
+
+namespace cc {
+
+class CCTexture {
+public:
+ CCTexture() : m_id(0) { }
+ CCTexture(unsigned id, IntSize size, GC3Denum format)
+ : m_id(id)
+ , m_size(size)
+ , m_format(format) { }
+
+ CCResourceProvider::ResourceId id() const { return m_id; }
+ const IntSize& size() const { return m_size; }
+ GC3Denum format() const { return m_format; }
+
+ void setId(CCResourceProvider::ResourceId id) { m_id = id; }
+ void setDimensions(const IntSize&, GC3Denum format);
+
+ size_t bytes() const;
+
+ static size_t memorySizeBytes(const IntSize&, GC3Denum format);
+
+private:
+ CCResourceProvider::ResourceId m_id;
+ IntSize m_size;
+ GC3Denum m_format;
+};
+
+}
+
+#endif
diff --git a/cc/TextureCopier.cpp b/cc/texture_copier.cc
index b0db144..b0db144 100644
--- a/cc/TextureCopier.cpp
+++ b/cc/texture_copier.cc
diff --git a/cc/texture_copier.h b/cc/texture_copier.h
index 638cbb2..ba8d7bf 100644
--- a/cc/texture_copier.h
+++ b/cc/texture_copier.h
@@ -1,3 +1,70 @@
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef TextureCopier_h
+#define TextureCopier_h
+
+#include "base/basictypes.h"
+#include "GraphicsContext3D.h"
+#include "ProgramBinding.h"
+#include "ShaderChromium.h"
+#include <wtf/OwnPtr.h>
+#include <wtf/PassOwnPtr.h>
+
+namespace WebKit {
+class WebGraphicsContext3D;
+}
+
+namespace cc {
+class IntSize;
+
+class TextureCopier {
+public:
+ struct Parameters {
+ unsigned sourceTexture;
+ unsigned destTexture;
+ IntSize size;
+ };
+ // Copy the base level contents of |sourceTexture| to |destTexture|. Both texture objects
+ // must be complete and have a base level of |size| dimensions. The color formats do not need
+ // to match, but |destTexture| must have a renderable format.
+ virtual void copyTexture(Parameters) = 0;
+ virtual void flush() = 0;
+
+ virtual ~TextureCopier() { }
+};
+
+#if USE(ACCELERATED_COMPOSITING)
+
+class AcceleratedTextureCopier : public TextureCopier {
+public:
+ static PassOwnPtr<AcceleratedTextureCopier> create(WebKit::WebGraphicsContext3D* context, bool usingBindUniforms)
+ {
+ return adoptPtr(new AcceleratedTextureCopier(context, usingBindUniforms));
+ }
+ virtual ~AcceleratedTextureCopier();
+
+ virtual void copyTexture(Parameters) OVERRIDE;
+ virtual void flush() OVERRIDE;
+
+protected:
+ AcceleratedTextureCopier(WebKit::WebGraphicsContext3D*, bool usingBindUniforms);
+
+private:
+ typedef ProgramBinding<VertexShaderPosTexIdentity, FragmentShaderRGBATex> BlitProgram;
+
+ WebKit::WebGraphicsContext3D* m_context;
+ Platform3DObject m_fbo;
+ Platform3DObject m_positionBuffer;
+ OwnPtr<BlitProgram> m_blitProgram;
+ bool m_usingBindUniforms;
+
+ DISALLOW_COPY_AND_ASSIGN(AcceleratedTextureCopier);
+};
+
+#endif // USE(ACCELERATED_COMPOSITING)
+
+}
+
+#endif
diff --git a/cc/CCTextureDrawQuad.cpp b/cc/texture_draw_quad.cc
index db985ad..db985ad 100644
--- a/cc/CCTextureDrawQuad.cpp
+++ b/cc/texture_draw_quad.cc
diff --git a/cc/texture_draw_quad.h b/cc/texture_draw_quad.h
index 638cbb2..daa600f 100644
--- a/cc/texture_draw_quad.h
+++ b/cc/texture_draw_quad.h
@@ -1,3 +1,41 @@
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCTextureDrawQuad_h
+#define CCTextureDrawQuad_h
+
+#include "CCDrawQuad.h"
+#include "FloatRect.h"
+#include "base/memory/scoped_ptr.h"
+
+namespace cc {
+
+#pragma pack(push, 4)
+
+class CCTextureDrawQuad : public CCDrawQuad {
+public:
+ static scoped_ptr<CCTextureDrawQuad> create(const CCSharedQuadState*, const IntRect&, unsigned resourceId, bool premultipliedAlpha, const FloatRect& uvRect, bool flipped);
+ FloatRect uvRect() const { return m_uvRect; }
+
+ unsigned resourceId() const { return m_resourceId; }
+ bool premultipliedAlpha() const { return m_premultipliedAlpha; }
+ bool flipped() const { return m_flipped; }
+
+ void setNeedsBlending();
+
+ static const CCTextureDrawQuad* materialCast(const CCDrawQuad*);
+private:
+ CCTextureDrawQuad(const CCSharedQuadState*, const IntRect&, unsigned resourceId, bool premultipliedAlpha, const FloatRect& uvRect, bool flipped);
+
+ unsigned m_resourceId;
+ bool m_premultipliedAlpha;
+ FloatRect m_uvRect;
+ bool m_flipped;
+};
+
+#pragma pack(pop)
+
+}
+
+#endif
diff --git a/cc/TextureLayerChromium.cpp b/cc/texture_layer.cc
index e1b4851..e1b4851 100644
--- a/cc/TextureLayerChromium.cpp
+++ b/cc/texture_layer.cc
diff --git a/cc/texture_layer.h b/cc/texture_layer.h
index 638cbb2..124f845 100644
--- a/cc/texture_layer.h
+++ b/cc/texture_layer.h
@@ -1,3 +1,77 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef TextureLayerChromium_h
+#define TextureLayerChromium_h
+
+#if USE(ACCELERATED_COMPOSITING)
+
+#include "LayerChromium.h"
+
+namespace WebKit {
+class WebGraphicsContext3D;
+}
+
+namespace cc {
+
+class TextureLayerChromiumClient;
+
+// A Layer containing a the rendered output of a plugin instance.
+class TextureLayerChromium : public LayerChromium {
+public:
+ // If this texture layer requires special preparation logic for each frame driven by
+ // the compositor, pass in a non-nil client. Pass in a nil client pointer if texture updates
+ // are driven by an external process.
+ static scoped_refptr<TextureLayerChromium> create(TextureLayerChromiumClient*);
+
+ void clearClient() { m_client = 0; }
+
+ virtual scoped_ptr<CCLayerImpl> createCCLayerImpl() OVERRIDE;
+
+ // Sets whether this texture should be Y-flipped at draw time. Defaults to true.
+ void setFlipped(bool);
+
+ // Sets a UV transform to be used at draw time. Defaults to (0, 0, 1, 1).
+ void setUVRect(const FloatRect&);
+
+ // Sets whether the alpha channel is premultiplied or unpremultiplied. Defaults to true.
+ void setPremultipliedAlpha(bool);
+
+ // Sets whether this context should rate limit on damage to prevent too many frames from
+ // being queued up before the compositor gets a chance to run. Requires a non-nil client.
+ // Defaults to false.
+ void setRateLimitContext(bool);
+
+ // Code path for plugins which supply their own texture ID.
+ void setTextureId(unsigned);
+
+ void willModifyTexture();
+
+ virtual void setNeedsDisplayRect(const FloatRect&) OVERRIDE;
+
+ virtual void setLayerTreeHost(CCLayerTreeHost*) OVERRIDE;
+ virtual bool drawsContent() const OVERRIDE;
+ virtual void update(CCTextureUpdateQueue&, const CCOcclusionTracker*, CCRenderingStats&) OVERRIDE;
+ virtual void pushPropertiesTo(CCLayerImpl*) OVERRIDE;
+
+protected:
+ explicit TextureLayerChromium(TextureLayerChromiumClient*);
+ virtual ~TextureLayerChromium();
+
+private:
+ TextureLayerChromiumClient* m_client;
+
+ bool m_flipped;
+ FloatRect m_uvRect;
+ bool m_premultipliedAlpha;
+ bool m_rateLimitContext;
+ bool m_contextLost;
+
+ unsigned m_textureId;
+};
+
+}
+#endif // USE(ACCELERATED_COMPOSITING)
+
+#endif
diff --git a/cc/texture_layer_client.h b/cc/texture_layer_client.h
index 638cbb2..4edbe9f 100644
--- a/cc/texture_layer_client.h
+++ b/cc/texture_layer_client.h
@@ -1,3 +1,31 @@
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef TextureLayerChromiumClient_h
+#define TextureLayerChromiumClient_h
+
+namespace WebKit {
+class WebGraphicsContext3D;
+}
+
+namespace cc {
+class CCTextureUpdateQueue;
+
+class TextureLayerChromiumClient {
+public:
+ // Called to prepare this layer's texture for compositing. The client may queue a texture
+ // upload or copy on the CCTextureUpdateQueue.
+ // Returns the texture ID to be used for compositing.
+ virtual unsigned prepareTexture(CCTextureUpdateQueue&) = 0;
+
+ // Returns the context that is providing the texture. Used for rate limiting and detecting lost context.
+ virtual WebKit::WebGraphicsContext3D* context() = 0;
+
+protected:
+ virtual ~TextureLayerChromiumClient() { }
+};
+
+}
+
+#endif // TextureLayerChromiumClient_h
diff --git a/cc/CCTextureLayerImpl.cpp b/cc/texture_layer_impl.cc
index 441265f..441265f 100644
--- a/cc/CCTextureLayerImpl.cpp
+++ b/cc/texture_layer_impl.cc
diff --git a/cc/texture_layer_impl.h b/cc/texture_layer_impl.h
index 638cbb2..ff88ff3 100644
--- a/cc/texture_layer_impl.h
+++ b/cc/texture_layer_impl.h
@@ -1,3 +1,48 @@
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCTextureLayerImpl_h
+#define CCTextureLayerImpl_h
+
+#include "CCLayerImpl.h"
+
+namespace cc {
+
+class CCTextureLayerImpl : public CCLayerImpl {
+public:
+ static scoped_ptr<CCTextureLayerImpl> create(int id)
+ {
+ return make_scoped_ptr(new CCTextureLayerImpl(id));
+ }
+ virtual ~CCTextureLayerImpl();
+
+ virtual void willDraw(CCResourceProvider*) OVERRIDE;
+ virtual void appendQuads(CCQuadSink&, CCAppendQuadsData&) OVERRIDE;
+ virtual void didDraw(CCResourceProvider*) OVERRIDE;
+
+ virtual void didLoseContext() OVERRIDE;
+
+ virtual void dumpLayerProperties(std::string*, int indent) const OVERRIDE;
+
+ unsigned textureId() const { return m_textureId; }
+ void setTextureId(unsigned id) { m_textureId = id; }
+ void setPremultipliedAlpha(bool premultipliedAlpha) { m_premultipliedAlpha = premultipliedAlpha; }
+ void setFlipped(bool flipped) { m_flipped = flipped; }
+ void setUVRect(const FloatRect& rect) { m_uvRect = rect; }
+
+private:
+ explicit CCTextureLayerImpl(int);
+
+ virtual const char* layerTypeAsString() const OVERRIDE;
+
+ unsigned m_textureId;
+ CCResourceProvider::ResourceId m_externalTextureResource;
+ bool m_premultipliedAlpha;
+ bool m_flipped;
+ FloatRect m_uvRect;
+};
+
+}
+
+#endif // CCTextureLayerImpl_h
diff --git a/cc/CCTextureUpdateController.cpp b/cc/texture_update_controller.cc
index 200948d..200948d 100644
--- a/cc/CCTextureUpdateController.cpp
+++ b/cc/texture_update_controller.cc
diff --git a/cc/texture_update_controller.h b/cc/texture_update_controller.h
index 638cbb2..74bb8ca 100644
--- a/cc/texture_update_controller.h
+++ b/cc/texture_update_controller.h
@@ -1,3 +1,77 @@
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCTextureUpdateController_h
+#define CCTextureUpdateController_h
+
+#include "base/basictypes.h"
+#include "base/time.h"
+#include "CCTextureUpdateQueue.h"
+#include "CCTimer.h"
+#include <wtf/OwnPtr.h>
+
+namespace cc {
+
+class TextureUploader;
+
+class CCTextureUpdateControllerClient {
+public:
+ virtual void readyToFinalizeTextureUpdates() = 0;
+
+protected:
+ virtual ~CCTextureUpdateControllerClient() { }
+};
+
+class CCTextureUpdateController : public CCTimerClient {
+public:
+ static PassOwnPtr<CCTextureUpdateController> create(CCTextureUpdateControllerClient* client, CCThread* thread, PassOwnPtr<CCTextureUpdateQueue> queue, CCResourceProvider* resourceProvider, TextureUploader* uploader)
+ {
+ return adoptPtr(new CCTextureUpdateController(client, thread, queue, resourceProvider, uploader));
+ }
+ static size_t maxPartialTextureUpdates();
+
+ virtual ~CCTextureUpdateController();
+
+ // Discard uploads to textures that were evicted on the impl thread.
+ void discardUploadsToEvictedResources();
+
+ void performMoreUpdates(base::TimeTicks timeLimit);
+ void finalize();
+
+ // CCTimerClient implementation.
+ virtual void onTimerFired() OVERRIDE;
+
+ // Virtual for testing.
+ virtual base::TimeTicks now() const;
+ virtual base::TimeDelta updateMoreTexturesTime() const;
+ virtual size_t updateMoreTexturesSize() const;
+
+protected:
+ CCTextureUpdateController(CCTextureUpdateControllerClient*, CCThread*, PassOwnPtr<CCTextureUpdateQueue>, CCResourceProvider*, TextureUploader*);
+
+ static size_t maxFullUpdatesPerTick(TextureUploader*);
+
+ size_t maxBlockingUpdates() const;
+
+ // This returns true when there were textures left to update.
+ bool updateMoreTexturesIfEnoughTimeRemaining();
+ void updateMoreTexturesNow();
+
+ CCTextureUpdateControllerClient* m_client;
+ OwnPtr<CCTimer> m_timer;
+ OwnPtr<CCTextureUpdateQueue> m_queue;
+ bool m_contentsTexturesPurged;
+ CCResourceProvider* m_resourceProvider;
+ TextureUploader* m_uploader;
+ base::TimeTicks m_timeLimit;
+ size_t m_textureUpdatesPerTick;
+ bool m_firstUpdateAttempt;
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(CCTextureUpdateController);
+};
+
+}
+
+#endif // CCTextureUpdateController_h
diff --git a/cc/CCTextureUpdateQueue.cpp b/cc/texture_update_queue.cc
index b5ebdf5..b5ebdf5 100644
--- a/cc/CCTextureUpdateQueue.cpp
+++ b/cc/texture_update_queue.cc
diff --git a/cc/texture_update_queue.h b/cc/texture_update_queue.h
index 638cbb2..4cf29338 100644
--- a/cc/texture_update_queue.h
+++ b/cc/texture_update_queue.h
@@ -1,3 +1,47 @@
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCTextureUpdateQueue_h
+#define CCTextureUpdateQueue_h
+
+#include "base/basictypes.h"
+#include "TextureCopier.h"
+#include "TextureUploader.h"
+#include <wtf/Deque.h>
+
+namespace cc {
+
+class CCTextureUpdateQueue {
+public:
+ CCTextureUpdateQueue();
+ virtual ~CCTextureUpdateQueue();
+
+ void appendFullUpload(TextureUploader::Parameters);
+ void appendPartialUpload(TextureUploader::Parameters);
+ void appendCopy(TextureCopier::Parameters);
+
+ void clearUploadsToEvictedResources();
+
+ TextureUploader::Parameters takeFirstFullUpload();
+ TextureUploader::Parameters takeFirstPartialUpload();
+ TextureCopier::Parameters takeFirstCopy();
+
+ size_t fullUploadSize() const { return m_fullEntries.size(); }
+ size_t partialUploadSize() const { return m_partialEntries.size(); }
+ size_t copySize() const { return m_copyEntries.size(); }
+
+ bool hasMoreUpdates() const;
+
+private:
+ void clearUploadsToEvictedResources(Deque<TextureUploader::Parameters>& entryQueue);
+ Deque<TextureUploader::Parameters> m_fullEntries;
+ Deque<TextureUploader::Parameters> m_partialEntries;
+ Deque<TextureCopier::Parameters> m_copyEntries;
+
+ DISALLOW_COPY_AND_ASSIGN(CCTextureUpdateQueue);
+};
+
+}
+
+#endif // CCTextureUpdateQueue_h
diff --git a/cc/texture_uploader.h b/cc/texture_uploader.h
index 638cbb2..5505204 100644
--- a/cc/texture_uploader.h
+++ b/cc/texture_uploader.h
@@ -1,3 +1,32 @@
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef TextureUploader_h
+#define TextureUploader_h
+
+#include "LayerTextureUpdater.h"
+
+namespace cc {
+
+class TextureUploader {
+public:
+ struct Parameters {
+ LayerTextureUpdater::Texture* texture;
+ IntRect sourceRect;
+ IntSize destOffset;
+ };
+
+ virtual ~TextureUploader() { }
+
+ virtual size_t numBlockingUploads() = 0;
+ virtual void markPendingUploadsAsNonBlocking() = 0;
+
+ // Returns our throughput on the GPU process
+ virtual double estimatedTexturesPerSecond() = 0;
+ virtual void uploadTexture(CCResourceProvider*, Parameters) = 0;
+};
+
+}
+
+#endif
diff --git a/cc/thread.h b/cc/thread.h
index 638cbb2..1ac4946 100644
--- a/cc/thread.h
+++ b/cc/thread.h
@@ -1,3 +1,43 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCThread_h
+#define CCThread_h
+
+#include "base/basictypes.h"
+#include "base/threading/platform_thread.h"
+#include <wtf/PassOwnPtr.h>
+
+namespace cc {
+
+// CCThread provides basic infrastructure for messaging with the compositor in a
+// platform-neutral way.
+class CCThread {
+public:
+ virtual ~CCThread() { }
+
+ class Task {
+ public:
+ virtual ~Task() { }
+ virtual void performTask() = 0;
+ void* instance() const { return m_instance; }
+ protected:
+ Task(void* instance) : m_instance(instance) { }
+ void* m_instance;
+ private:
+ DISALLOW_COPY_AND_ASSIGN(Task);
+ };
+
+ // Executes the task on context's thread asynchronously.
+ virtual void postTask(PassOwnPtr<Task>) = 0;
+
+ // Executes the task after the specified delay.
+ virtual void postDelayedTask(PassOwnPtr<Task>, long long delayMs) = 0;
+
+ virtual base::PlatformThreadId threadID() const = 0;
+};
+
+}
+
+#endif
diff --git a/cc/CCThreadProxy.cpp b/cc/thread_proxy.cc
index 1d3f2d3..1d3f2d3 100644
--- a/cc/CCThreadProxy.cpp
+++ b/cc/thread_proxy.cc
diff --git a/cc/thread_proxy.h b/cc/thread_proxy.h
index 638cbb2..a6ea6ac 100644
--- a/cc/thread_proxy.h
+++ b/cc/thread_proxy.h
@@ -1,3 +1,185 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCThreadProxy_h
+#define CCThreadProxy_h
+
+#include "CCAnimationEvents.h"
+#include "CCCompletionEvent.h"
+#include "CCLayerTreeHostImpl.h"
+#include "CCProxy.h"
+#include "CCScheduler.h"
+#include "CCTextureUpdateController.h"
+#include <base/time.h>
+#include <wtf/OwnPtr.h>
+
+namespace cc {
+
+class CCInputHandler;
+class CCLayerTreeHost;
+class CCScheduler;
+class CCScopedThreadProxy;
+class CCTextureUpdateQueue;
+class CCThread;
+class CCThreadProxyContextRecreationTimer;
+
+class CCThreadProxy : public CCProxy, CCLayerTreeHostImplClient, CCSchedulerClient, CCTextureUpdateControllerClient {
+public:
+ static scoped_ptr<CCProxy> create(CCLayerTreeHost*);
+
+ virtual ~CCThreadProxy();
+
+ // CCProxy implementation
+ virtual bool compositeAndReadback(void *pixels, const IntRect&) OVERRIDE;
+ virtual void startPageScaleAnimation(const IntSize& targetPosition, bool useAnchor, float scale, double duration) OVERRIDE;
+ virtual void finishAllRendering() OVERRIDE;
+ virtual bool isStarted() const OVERRIDE;
+ virtual bool initializeContext() OVERRIDE;
+ virtual void setSurfaceReady() OVERRIDE;
+ virtual void setVisible(bool) OVERRIDE;
+ virtual bool initializeRenderer() OVERRIDE;
+ virtual bool recreateContext() OVERRIDE;
+ virtual void renderingStats(CCRenderingStats*) OVERRIDE;
+ virtual const RendererCapabilities& rendererCapabilities() const OVERRIDE;
+ virtual void loseContext() OVERRIDE;
+ virtual void setNeedsAnimate() OVERRIDE;
+ virtual void setNeedsCommit() OVERRIDE;
+ virtual void setNeedsRedraw() OVERRIDE;
+ virtual bool commitRequested() const OVERRIDE;
+ virtual void didAddAnimation() OVERRIDE { }
+ virtual void start() OVERRIDE;
+ virtual void stop() OVERRIDE;
+ virtual size_t maxPartialTextureUpdates() const OVERRIDE;
+ virtual void acquireLayerTextures() OVERRIDE;
+ virtual void forceSerializeOnSwapBuffers() OVERRIDE;
+
+ // CCLayerTreeHostImplClient implementation
+ virtual void didLoseContextOnImplThread() OVERRIDE;
+ virtual void onSwapBuffersCompleteOnImplThread() OVERRIDE;
+ virtual void onVSyncParametersChanged(double monotonicTimebase, double intervalInSeconds) OVERRIDE;
+ virtual void onCanDrawStateChanged(bool canDraw) OVERRIDE;
+ virtual void setNeedsRedrawOnImplThread() OVERRIDE;
+ virtual void setNeedsCommitOnImplThread() OVERRIDE;
+ virtual void postAnimationEventsToMainThreadOnImplThread(scoped_ptr<CCAnimationEventsVector>, double wallClockTime) OVERRIDE;
+ virtual void releaseContentsTexturesOnImplThread() OVERRIDE;
+
+ // CCSchedulerClient implementation
+ virtual void scheduledActionBeginFrame() OVERRIDE;
+ virtual CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapIfPossible() OVERRIDE;
+ virtual CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapForced() OVERRIDE;
+ virtual void scheduledActionCommit() OVERRIDE;
+ virtual void scheduledActionBeginContextRecreation() OVERRIDE;
+ virtual void scheduledActionAcquireLayerTexturesForMainThread() OVERRIDE;
+ virtual void didAnticipatedDrawTimeChange(base::TimeTicks) OVERRIDE;
+
+ // CCTextureUpdateControllerClient implementation
+ virtual void readyToFinalizeTextureUpdates() OVERRIDE;
+
+private:
+ explicit CCThreadProxy(CCLayerTreeHost*);
+ friend class CCThreadProxyContextRecreationTimer;
+
+ // Set on impl thread, read on main thread.
+ struct BeginFrameAndCommitState {
+ BeginFrameAndCommitState();
+ ~BeginFrameAndCommitState();
+
+ double monotonicFrameBeginTime;
+ scoped_ptr<CCScrollAndScaleSet> scrollInfo;
+ WebKit::WebTransformationMatrix implTransform;
+ CCPrioritizedTextureManager::BackingVector evictedContentsTexturesBackings;
+ size_t memoryAllocationLimitBytes;
+ };
+ OwnPtr<BeginFrameAndCommitState> m_pendingBeginFrameRequest;
+
+ // Called on main thread
+ void beginFrame();
+ void didCommitAndDrawFrame();
+ void didCompleteSwapBuffers();
+ void setAnimationEvents(CCAnimationEventsVector*, double wallClockTime);
+ void beginContextRecreation();
+ void tryToRecreateContext();
+
+ // Called on impl thread
+ struct ReadbackRequest {
+ CCCompletionEvent completion;
+ bool success;
+ void* pixels;
+ IntRect rect;
+ };
+ void forceBeginFrameOnImplThread(CCCompletionEvent*);
+ void beginFrameCompleteOnImplThread(CCCompletionEvent*, PassOwnPtr<CCTextureUpdateQueue>);
+ void beginFrameAbortedOnImplThread();
+ void requestReadbackOnImplThread(ReadbackRequest*);
+ void requestStartPageScaleAnimationOnImplThread(IntSize targetPosition, bool useAnchor, float scale, double durationSec);
+ void finishAllRenderingOnImplThread(CCCompletionEvent*);
+ void initializeImplOnImplThread(CCCompletionEvent*, CCInputHandler*);
+ void setSurfaceReadyOnImplThread();
+ void setVisibleOnImplThread(CCCompletionEvent*, bool);
+ void initializeContextOnImplThread(CCGraphicsContext*);
+ void initializeRendererOnImplThread(CCCompletionEvent*, bool* initializeSucceeded, RendererCapabilities*);
+ void layerTreeHostClosedOnImplThread(CCCompletionEvent*);
+ void setFullRootLayerDamageOnImplThread();
+ void acquireLayerTexturesForMainThreadOnImplThread(CCCompletionEvent*);
+ void recreateContextOnImplThread(CCCompletionEvent*, CCGraphicsContext*, bool* recreateSucceeded, RendererCapabilities*);
+ void renderingStatsOnImplThread(CCCompletionEvent*, CCRenderingStats*);
+ CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapInternal(bool forcedDraw);
+ void forceSerializeOnSwapBuffersOnImplThread(CCCompletionEvent*);
+ void setNeedsForcedCommitOnImplThread();
+
+ // Accessed on main thread only.
+ bool m_animateRequested; // Set only when setNeedsAnimate is called.
+ bool m_commitRequested; // Set only when setNeedsCommit is called.
+ bool m_commitRequestSentToImplThread; // Set by setNeedsCommit and setNeedsAnimate.
+ bool m_forcedCommitRequested;
+ OwnPtr<CCThreadProxyContextRecreationTimer> m_contextRecreationTimer;
+ CCLayerTreeHost* m_layerTreeHost;
+ bool m_rendererInitialized;
+ RendererCapabilities m_RendererCapabilitiesMainThreadCopy;
+ bool m_started;
+ bool m_texturesAcquired;
+ bool m_inCompositeAndReadback;
+
+ scoped_ptr<CCLayerTreeHostImpl> m_layerTreeHostImpl;
+
+ scoped_ptr<CCInputHandler> m_inputHandlerOnImplThread;
+
+ OwnPtr<CCScheduler> m_schedulerOnImplThread;
+
+ RefPtr<CCScopedThreadProxy> m_mainThreadProxy;
+
+ // Holds on to the context we might use for compositing in between initializeContext()
+ // and initializeRenderer() calls.
+ scoped_ptr<CCGraphicsContext> m_contextBeforeInitializationOnImplThread;
+
+ // Set when the main thread is waiting on a scheduledActionBeginFrame to be issued.
+ CCCompletionEvent* m_beginFrameCompletionEventOnImplThread;
+
+ // Set when the main thread is waiting on a readback.
+ ReadbackRequest* m_readbackRequestOnImplThread;
+
+ // Set when the main thread is waiting on a commit to complete.
+ CCCompletionEvent* m_commitCompletionEventOnImplThread;
+
+ // Set when the main thread is waiting on layers to be drawn.
+ CCCompletionEvent* m_textureAcquisitionCompletionEventOnImplThread;
+
+ OwnPtr<CCTextureUpdateController> m_currentTextureUpdateControllerOnImplThread;
+
+ // Set when we need to reset the contentsTexturesPurged flag after the
+ // commit.
+ bool m_resetContentsTexturesPurgedAfterCommitOnImplThread;
+
+ // Set when the next draw should post didCommitAndDrawFrame to the main thread.
+ bool m_nextFrameIsNewlyCommittedFrameOnImplThread;
+
+ bool m_renderVSyncEnabled;
+
+ base::TimeDelta m_totalCommitTime;
+ size_t m_totalCommitCount;
+};
+
+}
+
+#endif
diff --git a/cc/thread_task.h b/cc/thread_task.h
index 638cbb2..25c5509 100644
--- a/cc/thread_task.h
+++ b/cc/thread_task.h
@@ -1,3 +1,305 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#ifndef CCThreadTask_h
+#define CCThreadTask_h
+
+#include "CCThread.h"
+#include <wtf/PassOwnPtr.h>
+#include <wtf/PassRefPtr.h>
+
+namespace cc {
+
+template<typename T>
+class CCThreadTask0 : public CCThread::Task {
+public:
+ typedef void (T::*Method)();
+ typedef CCThreadTask0<T> CCThreadTaskImpl;
+
+ static PassOwnPtr<CCThreadTaskImpl> create(T* instance, Method method)
+ {
+ return adoptPtr(new CCThreadTaskImpl(instance, method));
+ }
+
+private:
+ CCThreadTask0(T* instance, Method method)
+ : CCThread::Task(instance)
+ , m_method(method)
+ {
+ }
+
+ virtual void performTask() OVERRIDE
+ {
+ (*static_cast<T*>(instance()).*m_method)();
+ }
+
+private:
+ Method m_method;
+};
+
+template<typename T, typename P1, typename MP1>
+class CCThreadTask1 : public CCThread::Task {
+public:
+ typedef void (T::*Method)(MP1);
+ typedef CCThreadTask1<T, P1, MP1> CCThreadTaskImpl;
+
+ static PassOwnPtr<CCThreadTaskImpl> create(T* instance, Method method, P1 parameter1)
+ {
+ return adoptPtr(new CCThreadTaskImpl(instance, method, parameter1));
+ }
+
+private:
+ CCThreadTask1(T* instance, Method method, P1 parameter1)
+ : CCThread::Task(instance)
+ , m_method(method)
+ , m_parameter1(parameter1)
+ {
+ }
+
+ virtual void performTask() OVERRIDE
+ {
+ (*static_cast<T*>(instance()).*m_method)(m_parameter1);
+ }
+
+private:
+ Method m_method;
+ P1 m_parameter1;
+};
+
+template<typename T, typename P1, typename MP1, typename P2, typename MP2>
+class CCThreadTask2 : public CCThread::Task {
+public:
+ typedef void (T::*Method)(MP1, MP2);
+ typedef CCThreadTask2<T, P1, MP1, P2, MP2> CCThreadTaskImpl;
+
+ static PassOwnPtr<CCThreadTaskImpl> create(T* instance, Method method, P1 parameter1, P2 parameter2)
+ {
+ return adoptPtr(new CCThreadTaskImpl(instance, method, parameter1, parameter2));
+ }
+
+private:
+ CCThreadTask2(T* instance, Method method, P1 parameter1, P2 parameter2)
+ : CCThread::Task(instance)
+ , m_method(method)
+ , m_parameter1(parameter1)
+ , m_parameter2(parameter2)
+ {
+ }
+
+ virtual void performTask() OVERRIDE
+ {
+ (*static_cast<T*>(instance()).*m_method)(m_parameter1, m_parameter2);
+ }
+
+private:
+ Method m_method;
+ P1 m_parameter1;
+ P2 m_parameter2;
+};
+
+template<typename T, typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3>
+class CCThreadTask3 : public CCThread::Task {
+public:
+ typedef void (T::*Method)(MP1, MP2, MP3);
+ typedef CCThreadTask3<T, P1, MP1, P2, MP2, P3, MP3> CCThreadTaskImpl;
+
+ static PassOwnPtr<CCThreadTaskImpl> create(T* instance, Method method, P1 parameter1, P2 parameter2, P3 parameter3)
+ {
+ return adoptPtr(new CCThreadTaskImpl(instance, method, parameter1, parameter2, parameter3));
+ }
+
+private:
+ CCThreadTask3(T* instance, Method method, P1 parameter1, P2 parameter2, P3 parameter3)
+ : CCThread::Task(instance)
+ , m_method(method)
+ , m_parameter1(parameter1)
+ , m_parameter2(parameter2)
+ , m_parameter3(parameter3)
+ {
+ }
+
+ virtual void performTask() OVERRIDE
+ {
+ (*static_cast<T*>(instance()).*m_method)(m_parameter1, m_parameter2, m_parameter3);
+ }
+
+private:
+ Method m_method;
+ P1 m_parameter1;
+ P2 m_parameter2;
+ P3 m_parameter3;
+};
+
+
+template<typename T, typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3, typename P4, typename MP4>
+class CCThreadTask4 : public CCThread::Task {
+public:
+ typedef void (T::*Method)(MP1, MP2, MP3, MP4);
+ typedef CCThreadTask4<T, P1, MP1, P2, MP2, P3, MP3, P4, MP4> CCThreadTaskImpl;
+
+ static PassOwnPtr<CCThreadTaskImpl> create(T* instance, Method method, P1 parameter1, P2 parameter2, P3 parameter3, P4 parameter4)
+ {
+ return adoptPtr(new CCThreadTaskImpl(instance, method, parameter1, parameter2, parameter3, parameter4));
+ }
+
+private:
+ CCThreadTask4(T* instance, Method method, P1 parameter1, P2 parameter2, P3 parameter3, P4 parameter4)
+ : CCThread::Task(instance)
+ , m_method(method)
+ , m_parameter1(parameter1)
+ , m_parameter2(parameter2)
+ , m_parameter3(parameter3)
+ , m_parameter4(parameter4)
+ {
+ }
+
+ virtual void performTask() OVERRIDE
+ {
+ (*static_cast<T*>(instance()).*m_method)(m_parameter1, m_parameter2, m_parameter3, m_parameter4);
+ }
+
+private:
+ Method m_method;
+ P1 m_parameter1;
+ P2 m_parameter2;
+ P3 m_parameter3;
+ P4 m_parameter4;
+};
+
+template<typename T, typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3, typename P4, typename MP4, typename P5, typename MP5>
+class CCThreadTask5 : public CCThread::Task {
+public:
+ typedef void (T::*Method)(MP1, MP2, MP3, MP4, MP5);
+ typedef CCThreadTask5<T, P1, MP1, P2, MP2, P3, MP3, P4, MP4, P5, MP5> CCThreadTaskImpl;
+
+ static PassOwnPtr<CCThreadTaskImpl> create(T* instance, Method method, P1 parameter1, P2 parameter2, P3 parameter3, P4 parameter4, P5 parameter5)
+ {
+ return adoptPtr(new CCThreadTaskImpl(instance, method, parameter1, parameter2, parameter3, parameter4, parameter5));
+ }
+
+private:
+ CCThreadTask5(T* instance, Method method, P1 parameter1, P2 parameter2, P3 parameter3, P4 parameter4, P5 parameter5)
+ : CCThread::Task(instance)
+ , m_method(method)
+ , m_parameter1(parameter1)
+ , m_parameter2(parameter2)
+ , m_parameter3(parameter3)
+ , m_parameter4(parameter4)
+ , m_parameter5(parameter5)
+ {
+ }
+
+ virtual void performTask() OVERRIDE
+ {
+ (*static_cast<T*>(instance()).*m_method)(m_parameter1, m_parameter2, m_parameter3, m_parameter4, m_parameter5);
+ }
+
+private:
+ Method m_method;
+ P1 m_parameter1;
+ P2 m_parameter2;
+ P3 m_parameter3;
+ P4 m_parameter4;
+ P5 m_parameter5;
+};
+
+template<typename T>
+PassOwnPtr<CCThread::Task> createCCThreadTask(
+ T* const callee,
+ void (T::*method)());
+
+template<typename T>
+PassOwnPtr<CCThread::Task> createCCThreadTask(
+ T* const callee,
+ void (T::*method)())
+{
+ return CCThreadTask0<T>::create(
+ callee,
+ method);
+}
+
+template<typename T, typename P1, typename MP1>
+PassOwnPtr<CCThread::Task> createCCThreadTask(
+ T* const callee,
+ void (T::*method)(MP1),
+ const P1& parameter1)
+{
+ return CCThreadTask1<T, P1, MP1>::create(
+ callee,
+ method,
+ parameter1);
+}
+
+template<typename T, typename P1, typename MP1, typename P2, typename MP2>
+PassOwnPtr<CCThread::Task> createCCThreadTask(
+ T* const callee,
+ void (T::*method)(MP1, MP2),
+ const P1& parameter1,
+ const P2& parameter2)
+{
+ return CCThreadTask2<T, P1, MP1, P2, MP2>::create(
+ callee,
+ method,
+ parameter1,
+ parameter2);
+}
+
+template<typename T, typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3>
+PassOwnPtr<CCThread::Task> createCCThreadTask(
+ T* const callee,
+ void (T::*method)(MP1, MP2, MP3),
+ const P1& parameter1,
+ const P2& parameter2,
+ const P3& parameter3)
+{
+ return CCThreadTask3<T, P1, MP1, P2, MP2, P3, MP3>::create(
+ callee,
+ method,
+ parameter1,
+ parameter2,
+ parameter3);
+}
+
+template<typename T, typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3, typename P4, typename MP4>
+PassOwnPtr<CCThread::Task> createCCThreadTask(
+ T* const callee,
+ void (T::*method)(MP1, MP2, MP3, MP4),
+ const P1& parameter1,
+ const P2& parameter2,
+ const P3& parameter3,
+ const P4& parameter4)
+{
+ return CCThreadTask4<T, P1, MP1, P2, MP2, P3, MP3, P4, MP4>::create(
+ callee,
+ method,
+ parameter1,
+ parameter2,
+ parameter3,
+ parameter4);
+
+}
+
+template<typename T, typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3, typename P4, typename MP4, typename P5, typename MP5>
+PassOwnPtr<CCThread::Task> createCCThreadTask(
+ T* const callee,
+ void (T::*method)(MP1, MP2, MP3, MP4, MP5),
+ const P1& parameter1,
+ const P2& parameter2,
+ const P3& parameter3,
+ const P4& parameter4,
+ const P5& parameter5)
+{
+ return CCThreadTask5<T, P1, MP1, P2, MP2, P3, MP3, P4, MP4, P5, MP5>::create(
+ callee,
+ method,
+ parameter1,
+ parameter2,
+ parameter3,
+ parameter4,
+ parameter5);
+
+}
+
+} // namespace cc
+
+#endif // CCThreadTask_h
diff --git a/cc/ThrottledTextureUploader.cpp b/cc/throttled_texture_uploader.cc
index 179f2b6..179f2b6 100644
--- a/cc/ThrottledTextureUploader.cpp
+++ b/cc/throttled_texture_uploader.cc
diff --git a/cc/throttled_texture_uploader.h b/cc/throttled_texture_uploader.h
index 638cbb2..f517401 100644
--- a/cc/throttled_texture_uploader.h
+++ b/cc/throttled_texture_uploader.h
@@ -1,3 +1,76 @@
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef ThrottledTextureUploader_h
+#define ThrottledTextureUploader_h
+
+#include "TextureUploader.h"
+
+#include "base/basictypes.h"
+#include <deque>
+#include <wtf/Deque.h>
+
+namespace WebKit {
+class WebGraphicsContext3D;
+}
+
+namespace cc {
+
+class ThrottledTextureUploader : public TextureUploader {
+public:
+ static PassOwnPtr<ThrottledTextureUploader> create(WebKit::WebGraphicsContext3D* context)
+ {
+ return adoptPtr(new ThrottledTextureUploader(context));
+ }
+ virtual ~ThrottledTextureUploader();
+
+ virtual size_t numBlockingUploads() OVERRIDE;
+ virtual void markPendingUploadsAsNonBlocking() OVERRIDE;
+ virtual double estimatedTexturesPerSecond() OVERRIDE;
+ virtual void uploadTexture(CCResourceProvider*, Parameters) OVERRIDE;
+
+private:
+ class Query {
+ public:
+ static PassOwnPtr<Query> create(WebKit::WebGraphicsContext3D* context) { return adoptPtr(new Query(context)); }
+
+ virtual ~Query();
+
+ void begin();
+ void end();
+ bool isPending();
+ void wait();
+ unsigned value();
+ size_t texturesUploaded();
+ void markAsNonBlocking();
+ bool isNonBlocking();
+
+ private:
+ explicit Query(WebKit::WebGraphicsContext3D*);
+
+ WebKit::WebGraphicsContext3D* m_context;
+ unsigned m_queryId;
+ unsigned m_value;
+ bool m_hasValue;
+ bool m_isNonBlocking;
+ };
+
+ ThrottledTextureUploader(WebKit::WebGraphicsContext3D*);
+
+ void beginQuery();
+ void endQuery();
+ void processQueries();
+
+ WebKit::WebGraphicsContext3D* m_context;
+ Deque<OwnPtr<Query> > m_pendingQueries;
+ Deque<OwnPtr<Query> > m_availableQueries;
+ std::deque<double> m_texturesPerSecondHistory;
+ size_t m_numBlockingTextureUploads;
+
+ DISALLOW_COPY_AND_ASSIGN(ThrottledTextureUploader);
+};
+
+}
+
+#endif
diff --git a/cc/CCTileDrawQuad.cpp b/cc/tile_draw_quad.cc
index a5ac33d..a5ac33d 100644
--- a/cc/CCTileDrawQuad.cpp
+++ b/cc/tile_draw_quad.cc
diff --git a/cc/tile_draw_quad.h b/cc/tile_draw_quad.h
index 638cbb2..21a98cf 100644
--- a/cc/tile_draw_quad.h
+++ b/cc/tile_draw_quad.h
@@ -1,3 +1,54 @@
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCTileDrawQuad_h
+#define CCTileDrawQuad_h
+
+#include "CCDrawQuad.h"
+#include "GraphicsTypes3D.h"
+#include "IntPoint.h"
+#include "IntSize.h"
+#include "base/memory/scoped_ptr.h"
+
+namespace cc {
+
+#pragma pack(push, 4)
+
+class CCTileDrawQuad : public CCDrawQuad {
+public:
+ static scoped_ptr<CCTileDrawQuad> create(const CCSharedQuadState*, const IntRect& quadRect, const IntRect& opaqueRect, unsigned resourceId, const IntPoint& textureOffset, const IntSize& textureSize, GC3Dint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA);
+
+ unsigned resourceId() const { return m_resourceId; }
+ IntPoint textureOffset() const { return m_textureOffset; }
+ IntSize textureSize() const { return m_textureSize; }
+ GC3Dint textureFilter() const { return m_textureFilter; }
+ bool swizzleContents() const { return m_swizzleContents; }
+
+ bool leftEdgeAA() const { return m_leftEdgeAA; }
+ bool topEdgeAA() const { return m_topEdgeAA; }
+ bool rightEdgeAA() const { return m_rightEdgeAA; }
+ bool bottomEdgeAA() const { return m_bottomEdgeAA; }
+
+ bool isAntialiased() const { return leftEdgeAA() || topEdgeAA() || rightEdgeAA() || bottomEdgeAA(); }
+
+ static const CCTileDrawQuad* materialCast(const CCDrawQuad*);
+private:
+ CCTileDrawQuad(const CCSharedQuadState*, const IntRect& quadRect, const IntRect& opaqueRect, unsigned resourceId, const IntPoint& textureOffset, const IntSize& textureSize, GC3Dint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA);
+
+ unsigned m_resourceId;
+ IntPoint m_textureOffset;
+ IntSize m_textureSize;
+ GC3Dint m_textureFilter;
+ bool m_swizzleContents;
+ bool m_leftEdgeAA;
+ bool m_topEdgeAA;
+ bool m_rightEdgeAA;
+ bool m_bottomEdgeAA;
+};
+
+#pragma pack(pop)
+
+}
+
+#endif
diff --git a/cc/TiledLayerChromium.cpp b/cc/tiled_layer.cc
index f2219e6..f2219e6 100644
--- a/cc/TiledLayerChromium.cpp
+++ b/cc/tiled_layer.cc
diff --git a/cc/tiled_layer.h b/cc/tiled_layer.h
index 638cbb2..3c27382 100644
--- a/cc/tiled_layer.h
+++ b/cc/tiled_layer.h
@@ -1,3 +1,105 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef TiledLayerChromium_h
+#define TiledLayerChromium_h
+
+#if USE(ACCELERATED_COMPOSITING)
+
+#include "CCLayerTilingData.h"
+#include "LayerChromium.h"
+#include "LayerTextureUpdater.h"
+
+namespace cc {
+class UpdatableTile;
+
+class TiledLayerChromium : public LayerChromium {
+public:
+ enum TilingOption { AlwaysTile, NeverTile, AutoTile };
+
+ virtual void setIsMask(bool) OVERRIDE;
+
+ virtual void pushPropertiesTo(CCLayerImpl*) OVERRIDE;
+
+ virtual bool drawsContent() const OVERRIDE;
+ virtual bool needsContentsScale() const OVERRIDE;
+
+ virtual IntSize contentBounds() const OVERRIDE;
+
+ virtual void setNeedsDisplayRect(const FloatRect&) OVERRIDE;
+
+ virtual void setUseLCDText(bool) OVERRIDE;
+
+ virtual void setLayerTreeHost(CCLayerTreeHost*) OVERRIDE;
+
+ virtual void setTexturePriorities(const CCPriorityCalculator&) OVERRIDE;
+
+ virtual Region visibleContentOpaqueRegion() const OVERRIDE;
+
+ virtual void update(CCTextureUpdateQueue&, const CCOcclusionTracker*, CCRenderingStats&) OVERRIDE;
+
+protected:
+ TiledLayerChromium();
+ virtual ~TiledLayerChromium();
+
+ void updateTileSizeAndTilingOption();
+ void updateBounds();
+
+ // Exposed to subclasses for testing.
+ void setTileSize(const IntSize&);
+ void setTextureFormat(GC3Denum textureFormat) { m_textureFormat = textureFormat; }
+ void setBorderTexelOption(CCLayerTilingData::BorderTexelOption);
+ void setSampledTexelFormat(LayerTextureUpdater::SampledTexelFormat sampledTexelFormat) { m_sampledTexelFormat = sampledTexelFormat; }
+ size_t numPaintedTiles() { return m_tiler->tiles().size(); }
+
+ virtual LayerTextureUpdater* textureUpdater() const = 0;
+ virtual void createTextureUpdaterIfNeeded() = 0;
+
+ // Set invalidations to be potentially repainted during update().
+ void invalidateContentRect(const IntRect& contentRect);
+
+ // Reset state on tiles that will be used for updating the layer.
+ void resetUpdateState();
+
+ // After preparing an update, returns true if more painting is needed.
+ bool needsIdlePaint();
+ IntRect idlePaintRect();
+
+ bool skipsDraw() const { return m_skipsDraw; }
+
+ // Virtual for testing
+ virtual CCPrioritizedTextureManager* textureManager() const;
+
+private:
+ virtual scoped_ptr<CCLayerImpl> createCCLayerImpl() OVERRIDE;
+
+ void createTilerIfNeeded();
+ void setTilingOption(TilingOption);
+
+ bool tileOnlyNeedsPartialUpdate(UpdatableTile*);
+ bool tileNeedsBufferedUpdate(UpdatableTile*);
+
+ void markOcclusionsAndRequestTextures(int left, int top, int right, int bottom, const CCOcclusionTracker*);
+
+ bool updateTiles(int left, int top, int right, int bottom, CCTextureUpdateQueue&, const CCOcclusionTracker*, CCRenderingStats&, bool& didPaint);
+ bool haveTexturesForTiles(int left, int top, int right, int bottom, bool ignoreOcclusions);
+ IntRect markTilesForUpdate(int left, int top, int right, int bottom, bool ignoreOcclusions);
+ void updateTileTextures(const IntRect& paintRect, int left, int top, int right, int bottom, CCTextureUpdateQueue&, const CCOcclusionTracker*, CCRenderingStats&);
+
+ UpdatableTile* tileAt(int, int) const;
+ UpdatableTile* createTile(int, int);
+
+ GC3Denum m_textureFormat;
+ bool m_skipsDraw;
+ bool m_failedUpdate;
+ LayerTextureUpdater::SampledTexelFormat m_sampledTexelFormat;
+
+ TilingOption m_tilingOption;
+ OwnPtr<CCLayerTilingData> m_tiler;
+};
+
+}
+#endif // USE(ACCELERATED_COMPOSITING)
+
+#endif
diff --git a/cc/CCTiledLayerImpl.cpp b/cc/tiled_layer_impl.cc
index faa8ef8..faa8ef8 100644
--- a/cc/CCTiledLayerImpl.cpp
+++ b/cc/tiled_layer_impl.cc
diff --git a/cc/tiled_layer_impl.h b/cc/tiled_layer_impl.h
index 638cbb2..2d6803d 100644
--- a/cc/tiled_layer_impl.h
+++ b/cc/tiled_layer_impl.h
@@ -1,3 +1,62 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCTiledLayerImpl_h
+#define CCTiledLayerImpl_h
+
+#include "CCLayerImpl.h"
+#include <public/WebTransformationMatrix.h>
+
+namespace cc {
+
+class CCLayerTilingData;
+class DrawableTile;
+
+class CCTiledLayerImpl : public CCLayerImpl {
+public:
+ static scoped_ptr<CCTiledLayerImpl> create(int id)
+ {
+ return make_scoped_ptr(new CCTiledLayerImpl(id));
+ }
+ virtual ~CCTiledLayerImpl();
+
+ virtual void appendQuads(CCQuadSink&, CCAppendQuadsData&) OVERRIDE;
+
+ virtual CCResourceProvider::ResourceId contentsResourceId() const OVERRIDE;
+
+ virtual void dumpLayerProperties(std::string*, int indent) const OVERRIDE;
+
+ void setSkipsDraw(bool skipsDraw) { m_skipsDraw = skipsDraw; }
+ void setTilingData(const CCLayerTilingData& tiler);
+ void pushTileProperties(int, int, CCResourceProvider::ResourceId, const IntRect& opaqueRect);
+ void pushInvalidTile(int, int);
+
+ void setContentsSwizzled(bool contentsSwizzled) { m_contentsSwizzled = contentsSwizzled; }
+ bool contentsSwizzled() const { return m_contentsSwizzled; }
+
+ virtual Region visibleContentOpaqueRegion() const OVERRIDE;
+ virtual void didLoseContext() OVERRIDE;
+
+protected:
+ explicit CCTiledLayerImpl(int id);
+ // Exposed for testing.
+ bool hasTileAt(int, int) const;
+ bool hasResourceIdForTileAt(int, int) const;
+
+private:
+
+ virtual const char* layerTypeAsString() const OVERRIDE;
+
+ DrawableTile* tileAt(int, int) const;
+ DrawableTile* createTile(int, int);
+
+ bool m_skipsDraw;
+ bool m_contentsSwizzled;
+
+ OwnPtr<CCLayerTilingData> m_tiler;
+};
+
+}
+
+#endif // CCTiledLayerImpl_h
diff --git a/cc/time_source.h b/cc/time_source.h
index 638cbb2..6f24d35 100644
--- a/cc/time_source.h
+++ b/cc/time_source.h
@@ -1,3 +1,40 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCTimeSource_h
+#define CCTimeSource_h
+
+#include "base/time.h"
+#include <wtf/RefCounted.h>
+
+namespace cc {
+
+class CCThread;
+
+class CCTimeSourceClient {
+public:
+ virtual void onTimerTick() = 0;
+
+protected:
+ virtual ~CCTimeSourceClient() { }
+};
+
+// An generic interface for getting a reliably-ticking timesource of
+// a specified rate.
+//
+// Be sure to call setActive(false) before releasing your reference to the
+// timer, or it will keep on ticking!
+class CCTimeSource : public RefCounted<CCTimeSource> {
+public:
+ virtual ~CCTimeSource() { }
+ virtual void setClient(CCTimeSourceClient*) = 0;
+ virtual void setActive(bool) = 0;
+ virtual bool active() const = 0;
+ virtual void setTimebaseAndInterval(base::TimeTicks timebase, base::TimeDelta interval) = 0;
+ virtual base::TimeTicks lastTickTime() = 0;
+ virtual base::TimeTicks nextTickTime() = 0;
+};
+
+}
+#endif // CCSmoothedTimer_h
diff --git a/cc/CCTimer.cpp b/cc/timer.cc
index 089c12b..089c12b 100644
--- a/cc/CCTimer.cpp
+++ b/cc/timer.cc
diff --git a/cc/timer.h b/cc/timer.h
index 638cbb2..9424aef 100644
--- a/cc/timer.h
+++ b/cc/timer.h
@@ -1,3 +1,41 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCTimer_h
+#define CCTimer_h
+
+namespace cc {
+
+class CCThread;
+class CCTimerTask;
+
+class CCTimerClient {
+public:
+ virtual ~CCTimerClient() { }
+
+ virtual void onTimerFired() = 0;
+};
+
+class CCTimer {
+public:
+ CCTimer(CCThread*, CCTimerClient*);
+ ~CCTimer();
+
+ // If a previous task is pending, it will be replaced with the new one.
+ void startOneShot(double intervalSeconds);
+ void stop();
+
+ bool isActive() const { return m_task; }
+
+private:
+ friend class CCTimerTask;
+
+ CCTimerClient* m_client;
+ CCThread* m_thread;
+ CCTimerTask* m_task; // weak pointer
+};
+
+} // namespace cc
+
+#endif
diff --git a/cc/CCTimingFunction.cpp b/cc/timing_function.cc
index 3a4ecd4..3a4ecd4 100644
--- a/cc/CCTimingFunction.cpp
+++ b/cc/timing_function.cc
diff --git a/cc/timing_function.h b/cc/timing_function.h
index 638cbb2..993ab87 100644
--- a/cc/timing_function.h
+++ b/cc/timing_function.h
@@ -1,3 +1,62 @@
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCTimingFunction_h
+#define CCTimingFunction_h
+
+#include "CCAnimationCurve.h"
+#include "UnitBezier.h"
+
+namespace cc {
+
+// See http://www.w3.org/TR/css3-transitions/.
+class CCTimingFunction : public CCFloatAnimationCurve {
+public:
+ virtual ~CCTimingFunction();
+
+ // Partial implementation of CCFloatAnimationCurve.
+ virtual double duration() const OVERRIDE;
+
+protected:
+ CCTimingFunction();
+};
+
+class CCCubicBezierTimingFunction : public CCTimingFunction {
+public:
+ static scoped_ptr<CCCubicBezierTimingFunction> create(double x1, double y1, double x2, double y2);
+ virtual ~CCCubicBezierTimingFunction();
+
+ // Partial implementation of CCFloatAnimationCurve.
+ virtual float getValue(double time) const OVERRIDE;
+ virtual scoped_ptr<CCAnimationCurve> clone() const OVERRIDE;
+
+protected:
+ CCCubicBezierTimingFunction(double x1, double y1, double x2, double y2);
+
+ UnitBezier m_curve;
+};
+
+class CCEaseTimingFunction {
+public:
+ static scoped_ptr<CCTimingFunction> create();
+};
+
+class CCEaseInTimingFunction {
+public:
+ static scoped_ptr<CCTimingFunction> create();
+};
+
+class CCEaseOutTimingFunction {
+public:
+ static scoped_ptr<CCTimingFunction> create();
+};
+
+class CCEaseInOutTimingFunction {
+public:
+ static scoped_ptr<CCTimingFunction> create();
+};
+
+} // namespace cc
+
+#endif // CCTimingFunction_h
diff --git a/cc/TreeSynchronizer.cpp b/cc/tree_synchronizer.cc
index b7e76bb..b7e76bb 100644
--- a/cc/TreeSynchronizer.cpp
+++ b/cc/tree_synchronizer.cc
diff --git a/cc/tree_synchronizer.h b/cc/tree_synchronizer.h
index 638cbb2..2609841 100644
--- a/cc/tree_synchronizer.h
+++ b/cc/tree_synchronizer.h
@@ -1,3 +1,41 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef TreeSynchronizer_h
+#define TreeSynchronizer_h
+
+#include "base/basictypes.h"
+#include "base/memory/scoped_ptr.h"
+#include "cc/scoped_ptr_hash_map.h"
+
+namespace cc {
+
+class CCLayerImpl;
+class CCLayerTreeHostImpl;
+class LayerChromium;
+
+class TreeSynchronizer {
+public:
+ // Accepts a LayerChromium tree and returns a reference to a CCLayerImpl tree that duplicates the structure
+ // of the LayerChromium tree, reusing the CCLayerImpls in the tree provided by oldCCLayerImplRoot if possible.
+ static scoped_ptr<CCLayerImpl> synchronizeTrees(LayerChromium* layerRoot, scoped_ptr<CCLayerImpl> oldCCLayerImplRoot, CCLayerTreeHostImpl*);
+
+private:
+ TreeSynchronizer(); // Not instantiable.
+
+ typedef ScopedPtrHashMap<int, CCLayerImpl> ScopedPtrCCLayerImplMap;
+ typedef base::hash_map<int, CCLayerImpl*> RawPtrCCLayerImplMap;
+
+ // Declared as static member functions so they can access functions on LayerChromium as a friend class.
+ static scoped_ptr<CCLayerImpl> reuseOrCreateCCLayerImpl(RawPtrCCLayerImplMap& newLayers, ScopedPtrCCLayerImplMap& oldLayers, LayerChromium*);
+ static void collectExistingCCLayerImplRecursive(ScopedPtrCCLayerImplMap& oldLayers, scoped_ptr<CCLayerImpl>);
+ static scoped_ptr<CCLayerImpl> synchronizeTreeRecursive(RawPtrCCLayerImplMap& newLayers, ScopedPtrCCLayerImplMap& oldLayers, LayerChromium*, CCLayerTreeHostImpl*);
+ static void updateScrollbarLayerPointersRecursive(const RawPtrCCLayerImplMap& newLayers, LayerChromium*);
+
+ DISALLOW_COPY_AND_ASSIGN(TreeSynchronizer);
+};
+
+} // namespace cc
+
+#endif // TreeSynchronizer_h
diff --git a/cc/UnthrottledTextureUploader.cpp b/cc/unthrottled_texture_uploader.cc
index 82b4337..82b4337 100644
--- a/cc/UnthrottledTextureUploader.cpp
+++ b/cc/unthrottled_texture_uploader.cc
diff --git a/cc/unthrottled_texture_uploader.h b/cc/unthrottled_texture_uploader.h
index 638cbb2..bc0822a 100644
--- a/cc/unthrottled_texture_uploader.h
+++ b/cc/unthrottled_texture_uploader.h
@@ -1,3 +1,36 @@
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef UnthrottledTextureUploader_h
+#define UnthrottledTextureUploader_h
+
+#include "base/basictypes.h"
+#include "CCResourceProvider.h"
+#include "TextureUploader.h"
+
+namespace cc {
+
+class UnthrottledTextureUploader : public TextureUploader {
+public:
+ static PassOwnPtr<UnthrottledTextureUploader> create()
+ {
+ return adoptPtr(new UnthrottledTextureUploader());
+ }
+ virtual ~UnthrottledTextureUploader() { }
+
+ virtual size_t numBlockingUploads() OVERRIDE;
+ virtual void markPendingUploadsAsNonBlocking() OVERRIDE;
+ virtual double estimatedTexturesPerSecond() OVERRIDE;
+ virtual void uploadTexture(CCResourceProvider* resourceProvider, Parameters upload) OVERRIDE;
+
+protected:
+ UnthrottledTextureUploader() { }
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(UnthrottledTextureUploader);
+};
+
+}
+
+#endif
diff --git a/cc/VideoLayerChromium.cpp b/cc/video_layer.cc
index e210473..e210473 100644
--- a/cc/VideoLayerChromium.cpp
+++ b/cc/video_layer.cc
diff --git a/cc/video_layer.h b/cc/video_layer.h
index 638cbb2..92b5e13 100644
--- a/cc/video_layer.h
+++ b/cc/video_layer.h
@@ -1,3 +1,39 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+
+#ifndef VideoLayerChromium_h
+#define VideoLayerChromium_h
+
+#if USE(ACCELERATED_COMPOSITING)
+
+#include "LayerChromium.h"
+
+namespace WebKit {
+class WebVideoFrameProvider;
+}
+
+namespace cc {
+
+class CCVideoLayerImpl;
+
+// A Layer that contains a Video element.
+class VideoLayerChromium : public LayerChromium {
+public:
+ static scoped_refptr<VideoLayerChromium> create(WebKit::WebVideoFrameProvider*);
+
+ virtual scoped_ptr<CCLayerImpl> createCCLayerImpl() OVERRIDE;
+
+private:
+ explicit VideoLayerChromium(WebKit::WebVideoFrameProvider*);
+ virtual ~VideoLayerChromium();
+
+ // This pointer is only for passing to CCVideoLayerImpl's constructor. It should never be dereferenced by this class.
+ WebKit::WebVideoFrameProvider* m_provider;
+};
+
+}
+#endif // USE(ACCELERATED_COMPOSITING)
+
+#endif
diff --git a/cc/CCVideoLayerImpl.cpp b/cc/video_layer_impl.cc
index d1fb412..d1fb412 100644
--- a/cc/CCVideoLayerImpl.cpp
+++ b/cc/video_layer_impl.cc
diff --git a/cc/video_layer_impl.h b/cc/video_layer_impl.h
index 638cbb2..b254e8c 100644
--- a/cc/video_layer_impl.h
+++ b/cc/video_layer_impl.h
@@ -1,3 +1,89 @@
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCVideoLayerImpl_h
+#define CCVideoLayerImpl_h
+
+#include "CCLayerImpl.h"
+#include "GraphicsContext3D.h"
+#include "IntSize.h"
+#include <public/WebTransformationMatrix.h>
+#include <public/WebVideoFrameProvider.h>
+
+namespace WebKit {
+class WebVideoFrame;
+}
+
+namespace cc {
+
+class CCLayerTreeHostImpl;
+class CCVideoLayerImpl;
+
+class CCVideoLayerImpl : public CCLayerImpl
+ , public WebKit::WebVideoFrameProvider::Client {
+public:
+ static scoped_ptr<CCVideoLayerImpl> create(int id, WebKit::WebVideoFrameProvider* provider)
+ {
+ return make_scoped_ptr(new CCVideoLayerImpl(id, provider));
+ }
+ virtual ~CCVideoLayerImpl();
+
+ virtual void willDraw(CCResourceProvider*) OVERRIDE;
+ virtual void appendQuads(CCQuadSink&, CCAppendQuadsData&) OVERRIDE;
+ virtual void didDraw(CCResourceProvider*) OVERRIDE;
+
+ virtual void dumpLayerProperties(std::string*, int indent) const OVERRIDE;
+
+ Mutex& providerMutex() { return m_providerMutex; }
+
+ // WebKit::WebVideoFrameProvider::Client implementation.
+ virtual void stopUsingProvider(); // Callable on any thread.
+ virtual void didReceiveFrame(); // Callable on impl thread.
+ virtual void didUpdateMatrix(const float*); // Callable on impl thread.
+
+ virtual void didLoseContext() OVERRIDE;
+
+ void setNeedsRedraw();
+
+ struct FramePlane {
+ CCResourceProvider::ResourceId resourceId;
+ IntSize size;
+ GC3Denum format;
+ IntSize visibleSize;
+
+ FramePlane() : resourceId(0) { }
+
+ bool allocateData(CCResourceProvider*);
+ void freeData(CCResourceProvider*);
+ };
+
+private:
+ CCVideoLayerImpl(int, WebKit::WebVideoFrameProvider*);
+
+ static IntSize computeVisibleSize(const WebKit::WebVideoFrame&, unsigned plane);
+ virtual const char* layerTypeAsString() const OVERRIDE;
+
+ void willDrawInternal(CCResourceProvider*);
+ bool allocatePlaneData(CCResourceProvider*);
+ bool copyPlaneData(CCResourceProvider*);
+ void freePlaneData(CCResourceProvider*);
+ void freeUnusedPlaneData(CCResourceProvider*);
+
+ // Guards the destruction of m_provider and the frame that it provides
+ Mutex m_providerMutex;
+ WebKit::WebVideoFrameProvider* m_provider;
+
+ WebKit::WebTransformationMatrix m_streamTextureMatrix;
+
+ WebKit::WebVideoFrame* m_frame;
+ GC3Denum m_format;
+ CCResourceProvider::ResourceId m_externalTextureResource;
+
+ // Each index in this array corresponds to a plane in WebKit::WebVideoFrame.
+ FramePlane m_framePlanes[WebKit::WebVideoFrame::maxPlanes];
+};
+
+}
+
+#endif // CCVideoLayerImpl_h
diff --git a/cc/CCYUVVideoDrawQuad.cpp b/cc/yuv_video_draw_quad.cc
index 41d5490..41d5490 100644
--- a/cc/CCYUVVideoDrawQuad.cpp
+++ b/cc/yuv_video_draw_quad.cc
diff --git a/cc/yuv_video_draw_quad.h b/cc/yuv_video_draw_quad.h
index 638cbb2..5d574b7b 100644
--- a/cc/yuv_video_draw_quad.h
+++ b/cc/yuv_video_draw_quad.h
@@ -1,3 +1,36 @@
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCYUVVideoDrawQuad_h
+#define CCYUVVideoDrawQuad_h
+
+#include "base/basictypes.h"
+#include "base/memory/scoped_ptr.h"
+#include "CCDrawQuad.h"
+#include "CCVideoLayerImpl.h"
+
+namespace cc {
+
+class CCYUVVideoDrawQuad : public CCDrawQuad {
+public:
+ static scoped_ptr<CCYUVVideoDrawQuad> create(const CCSharedQuadState*, const IntRect&, const CCVideoLayerImpl::FramePlane& yPlane, const CCVideoLayerImpl::FramePlane& uPlane, const CCVideoLayerImpl::FramePlane& vPlane);
+
+ const CCVideoLayerImpl::FramePlane& yPlane() const { return m_yPlane; }
+ const CCVideoLayerImpl::FramePlane& uPlane() const { return m_uPlane; }
+ const CCVideoLayerImpl::FramePlane& vPlane() const { return m_vPlane; }
+
+ static const CCYUVVideoDrawQuad* materialCast(const CCDrawQuad*);
+private:
+ CCYUVVideoDrawQuad(const CCSharedQuadState*, const IntRect&, const CCVideoLayerImpl::FramePlane& yPlane, const CCVideoLayerImpl::FramePlane& uPlane, const CCVideoLayerImpl::FramePlane& vPlane);
+
+ CCVideoLayerImpl::FramePlane m_yPlane;
+ CCVideoLayerImpl::FramePlane m_uPlane;
+ CCVideoLayerImpl::FramePlane m_vPlane;
+
+ DISALLOW_COPY_AND_ASSIGN(CCYUVVideoDrawQuad);
+};
+
+}
+
+#endif