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

Unified Diff: cc/trees/thread_proxy.h

Issue 242783003: cc: Add testing stubs for proxy test (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: cc/trees/thread_proxy.h
diff --git a/cc/trees/thread_proxy.h b/cc/trees/thread_proxy.h
index d67044499c0b4d790a6dbabfacf6eeee51ef7f07..9d94ced856a78393a86444828ac55776c85a77ec 100644
--- a/cc/trees/thread_proxy.h
+++ b/cc/trees/thread_proxy.h
@@ -31,7 +31,7 @@ class ResourceUpdateQueue;
class Scheduler;
class ScopedThreadProxy;
-class ThreadProxy : public Proxy,
+class CC_EXPORT ThreadProxy : public Proxy,
LayerTreeHostImplClient,
SchedulerClient,
ResourceUpdateControllerClient {
@@ -42,6 +42,97 @@ class ThreadProxy : public Proxy,
virtual ~ThreadProxy();
+ struct BeginMainFrameAndCommitState {
+ BeginMainFrameAndCommitState();
+ ~BeginMainFrameAndCommitState();
+
+ base::TimeTicks monotonic_frame_begin_time;
+ scoped_ptr<ScrollAndScaleSet> scroll_info;
+ size_t memory_allocation_limit_bytes;
+ int memory_allocation_priority_cutoff;
+ bool evicted_ui_resources;
+ };
+
+ struct MainThreadOnly {
+ MainThreadOnly(ThreadProxy* proxy, int layer_tree_host_id);
+ ~MainThreadOnly();
+
+ const int layer_tree_host_id;
+
+ // Set only when SetNeedsAnimate is called.
+ bool animate_requested;
+ // Set only when SetNeedsCommit is called.
+ bool commit_requested;
+ // Set by SetNeedsAnimate, SetNeedsUpdateLayers, and SetNeedsCommit.
+ bool commit_request_sent_to_impl_thread;
+
+ bool started;
+ bool in_composite_and_readback;
+ bool manage_tiles_pending;
+ bool can_cancel_commit;
+ bool defer_commits;
+
+ base::CancelableClosure output_surface_creation_callback;
+ RendererCapabilities renderer_capabilities_main_thread_copy;
+
+ scoped_ptr<BeginMainFrameAndCommitState> pending_deferred_commit;
+ base::WeakPtrFactory<ThreadProxy> weak_factory;
+ };
+
+ struct ReadbackRequest;
+
+ struct CompositorThreadOnly {
+ CompositorThreadOnly(ThreadProxy* proxy, int layer_tree_host_id);
+ ~CompositorThreadOnly();
+
+ const int layer_tree_host_id;
+
+ // Copy of the main thread side contents texture manager for work
+ // that needs to be done on the compositor thread.
+ PrioritizedResourceManager* contents_texture_manager;
+
+ scoped_ptr<Scheduler> scheduler;
+
+ // Set when the main thread is waiting on a
+ // ScheduledActionSendBeginMainFrame to be issued.
+ CompletionEvent* begin_main_frame_sent_completion_event;
+
+ // Set when the main thread is waiting on a readback.
+ ReadbackRequest* readback_request;
+
+ // Set when the main thread is waiting on a commit to complete.
+ CompletionEvent* commit_completion_event;
+
+ // Set when the main thread is waiting on a pending tree activation.
+ CompletionEvent* completion_event_for_commit_held_on_tree_activation;
+
+ scoped_ptr<ResourceUpdateController> current_resource_update_controller;
+
+ // Set when the next draw should post DidCommitAndDrawFrame to the main
+ // thread.
+ bool next_frame_is_newly_committed_frame;
+
+ bool inside_draw;
+
+ bool input_throttled_until_commit;
+
+ // Set when we freeze animations to avoid checkerboarding.
+ bool animations_frozen_until_next_draw;
+ base::TimeTicks animation_time;
+
+ // Whether a commit has been completed since the last time animations were
+ // ticked. If this happens, we need to animate again.
+ bool did_commit_after_animating;
+
+ base::TimeTicks smoothness_takes_priority_expiration_time;
+ bool renew_tree_priority_pending;
+
+ ProxyTimingHistory timing_history;
+
+ scoped_ptr<LayerTreeHostImpl> layer_tree_host_impl;
+ base::WeakPtrFactory<ThreadProxy> weak_factory;
+ };
+
// Proxy implementation
virtual bool CompositeAndReadback(void* pixels,
const gfx::Rect& rect) OVERRIDE;
@@ -128,21 +219,17 @@ class ThreadProxy : public Proxy,
// ResourceUpdateControllerClient implementation
virtual void ReadyToFinalizeTextureUpdates() OVERRIDE;
- private:
+ protected:
ThreadProxy(LayerTreeHost* layer_tree_host,
scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner);
- struct BeginMainFrameAndCommitState {
- BeginMainFrameAndCommitState();
- ~BeginMainFrameAndCommitState();
+ MainThreadOnly& main();
brianderson 2014/05/14 21:12:07 Does this need to be protected too? It looks like
simonhong 2014/05/15 01:32:07 Done.
+ const MainThreadOnly& main() const;
- base::TimeTicks monotonic_frame_begin_time;
- scoped_ptr<ScrollAndScaleSet> scroll_info;
- size_t memory_allocation_limit_bytes;
- int memory_allocation_priority_cutoff;
- bool evicted_ui_resources;
- };
+ CompositorThreadOnly& impl();
+ const CompositorThreadOnly& impl() const;
+ private:
// Called on main thread.
void SetRendererCapabilitiesMainThreadCopy(
const RendererCapabilities& capabilities);
@@ -155,7 +242,6 @@ class ThreadProxy : public Proxy,
void SendCommitRequestToImplThreadIfNeeded();
// Called on impl thread.
- struct ReadbackRequest;
struct CommitPendingRequest;
struct SchedulerStateRequest;
@@ -199,35 +285,8 @@ class ThreadProxy : public Proxy,
LayerTreeHost* layer_tree_host();
const LayerTreeHost* layer_tree_host() const;
- struct MainThreadOnly {
- MainThreadOnly(ThreadProxy* proxy, int layer_tree_host_id);
- ~MainThreadOnly();
-
- const int layer_tree_host_id;
-
- // Set only when SetNeedsAnimate is called.
- bool animate_requested;
- // Set only when SetNeedsCommit is called.
- bool commit_requested;
- // Set by SetNeedsAnimate, SetNeedsUpdateLayers, and SetNeedsCommit.
- bool commit_request_sent_to_impl_thread;
-
- bool started;
- bool in_composite_and_readback;
- bool manage_tiles_pending;
- bool can_cancel_commit;
- bool defer_commits;
-
- base::CancelableClosure output_surface_creation_callback;
- RendererCapabilities renderer_capabilities_main_thread_copy;
-
- scoped_ptr<BeginMainFrameAndCommitState> pending_deferred_commit;
- base::WeakPtrFactory<ThreadProxy> weak_factory;
- };
// Use accessors instead of this variable directly.
MainThreadOnly main_thread_only_vars_unsafe_;
- MainThreadOnly& main();
- const MainThreadOnly& main() const;
// Accessed on the main thread, or when main thread is blocked.
struct MainThreadOrBlockedMainThread {
@@ -247,61 +306,8 @@ class ThreadProxy : public Proxy,
MainThreadOrBlockedMainThread& blocked_main();
const MainThreadOrBlockedMainThread& blocked_main() const;
brianderson 2014/05/14 21:12:07 Please expose MainThreadOrBlockedMainThread as the
simonhong 2014/05/15 01:32:07 Done.
- struct CompositorThreadOnly {
- CompositorThreadOnly(ThreadProxy* proxy, int layer_tree_host_id);
- ~CompositorThreadOnly();
-
- const int layer_tree_host_id;
-
- // Copy of the main thread side contents texture manager for work
- // that needs to be done on the compositor thread.
- PrioritizedResourceManager* contents_texture_manager;
-
- scoped_ptr<Scheduler> scheduler;
-
- // Set when the main thread is waiting on a
- // ScheduledActionSendBeginMainFrame to be issued.
- CompletionEvent* begin_main_frame_sent_completion_event;
-
- // Set when the main thread is waiting on a readback.
- ReadbackRequest* readback_request;
-
- // Set when the main thread is waiting on a commit to complete.
- CompletionEvent* commit_completion_event;
-
- // Set when the main thread is waiting on a pending tree activation.
- CompletionEvent* completion_event_for_commit_held_on_tree_activation;
-
- scoped_ptr<ResourceUpdateController> current_resource_update_controller;
-
- // Set when the next draw should post DidCommitAndDrawFrame to the main
- // thread.
- bool next_frame_is_newly_committed_frame;
-
- bool inside_draw;
-
- bool input_throttled_until_commit;
-
- // Set when we freeze animations to avoid checkerboarding.
- bool animations_frozen_until_next_draw;
- base::TimeTicks animation_time;
-
- // Whether a commit has been completed since the last time animations were
- // ticked. If this happens, we need to animate again.
- bool did_commit_after_animating;
-
- base::TimeTicks smoothness_takes_priority_expiration_time;
- bool renew_tree_priority_pending;
-
- ProxyTimingHistory timing_history;
-
- scoped_ptr<LayerTreeHostImpl> layer_tree_host_impl;
- base::WeakPtrFactory<ThreadProxy> weak_factory;
- };
// Use accessors instead of this variable directly.
CompositorThreadOnly compositor_thread_vars_unsafe_;
- CompositorThreadOnly& impl();
- const CompositorThreadOnly& impl() const;
base::WeakPtr<ThreadProxy> main_thread_weak_ptr_;
base::WeakPtr<ThreadProxy> impl_thread_weak_ptr_;
« cc/trees/layer_tree_host_unittest_proxy.cc ('K') | « cc/trees/layer_tree_host_unittest_proxy.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698