summaryrefslogtreecommitdiffstats
path: root/cc
diff options
context:
space:
mode:
authorboliu@chromium.org <boliu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-26 04:22:03 +0000
committerboliu@chromium.org <boliu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-26 04:22:03 +0000
commit1cd9f55522c066a510672880c4009543bd6d0b23 (patch)
tree89b48ea7ecd01b83676907d20797bb61599b7cde /cc
parentbd6caf26ba6e0c1e07b4ff2226d5acfbada76c9c (diff)
downloadchromium_src-1cd9f55522c066a510672880c4009543bd6d0b23.zip
chromium_src-1cd9f55522c066a510672880c4009543bd6d0b23.tar.gz
chromium_src-1cd9f55522c066a510672880c4009543bd6d0b23.tar.bz2
Add OutputSurfaceClient::SetNeedsRedrawRect
Same as LTH::SetNeedsRedrawRect except this is on the impl thread. No new tests because this is used to implement LTH::SetNeedsRedrawRect which is already tested. BUG=230202 Review URL: https://chromiumcodereview.appspot.com/14320011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@196603 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc')
-rw-r--r--cc/output/output_surface_client.h2
-rw-r--r--cc/test/fake_layer_tree_host_impl_client.h1
-rw-r--r--cc/trees/layer_tree_host_impl.cc4
-rw-r--r--cc/trees/layer_tree_host_impl.h2
-rw-r--r--cc/trees/layer_tree_host_impl_unittest.cc3
-rw-r--r--cc/trees/single_thread_proxy.cc12
-rw-r--r--cc/trees/single_thread_proxy.h1
-rw-r--r--cc/trees/thread_proxy.cc15
-rw-r--r--cc/trees/thread_proxy.h2
9 files changed, 29 insertions, 13 deletions
diff --git a/cc/output/output_surface_client.h b/cc/output/output_surface_client.h
index 1e2b542..32dec38 100644
--- a/cc/output/output_surface_client.h
+++ b/cc/output/output_surface_client.h
@@ -7,6 +7,7 @@
#include "base/time.h"
#include "cc/base/cc_export.h"
+#include "ui/gfx/rect.h"
namespace cc {
@@ -14,6 +15,7 @@ class CompositorFrameAck;
class CC_EXPORT OutputSurfaceClient {
public:
+ virtual void SetNeedsRedrawRect(gfx::Rect damage_rect) = 0;
virtual void OnVSyncParametersChanged(base::TimeTicks timebase,
base::TimeDelta interval) = 0;
virtual void DidVSync(base::TimeTicks frame_time) = 0;
diff --git a/cc/test/fake_layer_tree_host_impl_client.h b/cc/test/fake_layer_tree_host_impl_client.h
index 8be8575..7e35a20 100644
--- a/cc/test/fake_layer_tree_host_impl_client.h
+++ b/cc/test/fake_layer_tree_host_impl_client.h
@@ -21,6 +21,7 @@ class FakeLayerTreeHostImplClient : public LayerTreeHostImplClient {
virtual void OnCanDrawStateChanged(bool can_draw) OVERRIDE {}
virtual void OnHasPendingTreeStateChanged(bool has_pending_tree) OVERRIDE {}
virtual void SetNeedsRedrawOnImplThread() OVERRIDE {}
+ virtual void SetNeedsRedrawRectOnImplThread(gfx::Rect damage_rect) OVERRIDE {}
virtual void DidInitializeVisibleTileOnImplThread() OVERRIDE {}
virtual void SetNeedsCommitOnImplThread() OVERRIDE {}
virtual void SetNeedsManageTilesOnImplThread() OVERRIDE {}
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index 5a0015e..d05f610 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -995,6 +995,10 @@ void LayerTreeHostImpl::SetManagedMemoryPolicy(
client_->SetNeedsCommitOnImplThread();
}
+void LayerTreeHostImpl::SetNeedsRedrawRect(gfx::Rect damage_rect) {
+ client_->SetNeedsRedrawRectOnImplThread(damage_rect);
+}
+
void LayerTreeHostImpl::OnVSyncParametersChanged(base::TimeTicks timebase,
base::TimeDelta interval) {
client_->OnVSyncParametersChanged(timebase, interval);
diff --git a/cc/trees/layer_tree_host_impl.h b/cc/trees/layer_tree_host_impl.h
index 2564a31..df3f23f 100644
--- a/cc/trees/layer_tree_host_impl.h
+++ b/cc/trees/layer_tree_host_impl.h
@@ -57,6 +57,7 @@ class LayerTreeHostImplClient {
virtual void OnCanDrawStateChanged(bool can_draw) = 0;
virtual void OnHasPendingTreeStateChanged(bool has_pending_tree) = 0;
virtual void SetNeedsRedrawOnImplThread() = 0;
+ virtual void SetNeedsRedrawRectOnImplThread(gfx::Rect damage_rect) = 0;
virtual void DidInitializeVisibleTileOnImplThread() = 0;
virtual void SetNeedsCommitOnImplThread() = 0;
virtual void SetNeedsManageTilesOnImplThread() = 0;
@@ -191,6 +192,7 @@ class CC_EXPORT LayerTreeHostImpl : public InputHandlerClient,
virtual void DidInitializeVisibleTile() OVERRIDE;
// OutputSurfaceClient implementation.
+ virtual void SetNeedsRedrawRect(gfx::Rect rect) OVERRIDE;
virtual void OnVSyncParametersChanged(base::TimeTicks timebase,
base::TimeDelta interval) OVERRIDE;
virtual void DidVSync(base::TimeTicks frame_time) OVERRIDE;
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc
index 6f7813d..a031d3d 100644
--- a/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -106,6 +106,9 @@ class LayerTreeHostImplTest : public testing::Test,
virtual void SetNeedsRedrawOnImplThread() OVERRIDE {
did_request_redraw_ = true;
}
+ virtual void SetNeedsRedrawRectOnImplThread(gfx::Rect damage_rect) OVERRIDE {
+ did_request_redraw_ = true;
+ }
virtual void DidInitializeVisibleTileOnImplThread() OVERRIDE {
did_upload_visible_tile_ = true;
}
diff --git a/cc/trees/single_thread_proxy.cc b/cc/trees/single_thread_proxy.cc
index 7534b4d..f8ee95a 100644
--- a/cc/trees/single_thread_proxy.cc
+++ b/cc/trees/single_thread_proxy.cc
@@ -229,10 +229,7 @@ void SingleThreadProxy::SetNeedsCommit() {
}
void SingleThreadProxy::SetNeedsRedraw(gfx::Rect damage_rect) {
- // FIXME: Once we move render_widget scheduling into this class, we can
- // treat redraw requests more efficiently than CommitAndRedraw requests.
- layer_tree_host_impl_->SetViewportDamage(damage_rect);
- SetNeedsCommit();
+ SetNeedsRedrawRectOnImplThread(damage_rect);
}
void SingleThreadProxy::OnHasPendingTreeStateChanged(bool have_pending_tree) {
@@ -274,6 +271,13 @@ void SingleThreadProxy::SetNeedsRedrawOnImplThread() {
layer_tree_host_->ScheduleComposite();
}
+void SingleThreadProxy::SetNeedsRedrawRectOnImplThread(gfx::Rect damage_rect) {
+ // FIXME: Once we move render_widget scheduling into this class, we can
+ // treat redraw requests more efficiently than CommitAndRedraw requests.
+ layer_tree_host_impl_->SetViewportDamage(damage_rect);
+ SetNeedsCommit();
+}
+
void SingleThreadProxy::DidInitializeVisibleTileOnImplThread() {
// Impl-side painting only.
NOTREACHED();
diff --git a/cc/trees/single_thread_proxy.h b/cc/trees/single_thread_proxy.h
index d345a15..e290fb0 100644
--- a/cc/trees/single_thread_proxy.h
+++ b/cc/trees/single_thread_proxy.h
@@ -56,6 +56,7 @@ class SingleThreadProxy : public Proxy, LayerTreeHostImplClient {
virtual void OnCanDrawStateChanged(bool can_draw) OVERRIDE;
virtual void OnHasPendingTreeStateChanged(bool have_pending_tree) OVERRIDE;
virtual void SetNeedsRedrawOnImplThread() OVERRIDE;
+ virtual void SetNeedsRedrawRectOnImplThread(gfx::Rect dirty_rect) OVERRIDE;
virtual void DidInitializeVisibleTileOnImplThread() OVERRIDE;
virtual void SetNeedsCommitOnImplThread() OVERRIDE;
virtual void SetNeedsManageTilesOnImplThread() OVERRIDE;
diff --git a/cc/trees/thread_proxy.cc b/cc/trees/thread_proxy.cc
index 587baac..12142ad 100644
--- a/cc/trees/thread_proxy.cc
+++ b/cc/trees/thread_proxy.cc
@@ -459,10 +459,8 @@ void ThreadProxy::SetNeedsRedraw(gfx::Rect damage_rect) {
DCHECK(IsMainThread());
TRACE_EVENT0("cc", "ThreadProxy::SetNeedsRedraw");
Proxy::ImplThread()->PostTask(base::Bind(
- &ThreadProxy::SetViewportDamageOnImplThread,
+ &ThreadProxy::SetNeedsRedrawRectOnImplThread,
impl_thread_weak_ptr_, damage_rect));
- Proxy::ImplThread()->PostTask(base::Bind(
- &ThreadProxy::SetNeedsRedrawOnImplThread, impl_thread_weak_ptr_));
}
void ThreadProxy::SetDeferCommits(bool defer_commits) {
@@ -493,6 +491,12 @@ void ThreadProxy::SetNeedsRedrawOnImplThread() {
scheduler_on_impl_thread_->SetNeedsRedraw();
}
+void ThreadProxy::SetNeedsRedrawRectOnImplThread(gfx::Rect damage_rect) {
+ DCHECK(IsImplThread());
+ layer_tree_host_impl_->SetViewportDamage(damage_rect);
+ SetNeedsRedrawOnImplThread();
+}
+
void ThreadProxy::DidSwapUseIncompleteTileOnImplThread() {
DCHECK(IsImplThread());
TRACE_EVENT0("cc", "ThreadProxy::DidSwapUseIncompleteTileOnImplThread");
@@ -1162,11 +1166,6 @@ void ThreadProxy::LayerTreeHostClosedOnImplThread(CompletionEvent* completion) {
completion->Signal();
}
-void ThreadProxy::SetViewportDamageOnImplThread(gfx::Rect damage_rect) {
- DCHECK(IsImplThread());
- layer_tree_host_impl_->SetViewportDamage(damage_rect);
-}
-
size_t ThreadProxy::MaxPartialTextureUpdates() const {
return ResourceUpdateController::MaxPartialTextureUpdates();
}
diff --git a/cc/trees/thread_proxy.h b/cc/trees/thread_proxy.h
index d466228..30b08782 100644
--- a/cc/trees/thread_proxy.h
+++ b/cc/trees/thread_proxy.h
@@ -71,6 +71,7 @@ class ThreadProxy : public Proxy,
virtual void OnCanDrawStateChanged(bool can_draw) OVERRIDE;
virtual void OnHasPendingTreeStateChanged(bool has_pending_tree) OVERRIDE;
virtual void SetNeedsRedrawOnImplThread() OVERRIDE;
+ virtual void SetNeedsRedrawRectOnImplThread(gfx::Rect dirty_rect) OVERRIDE;
virtual void DidInitializeVisibleTileOnImplThread() OVERRIDE;
virtual void SetNeedsCommitOnImplThread() OVERRIDE;
virtual void SetNeedsManageTilesOnImplThread() OVERRIDE;
@@ -164,7 +165,6 @@ class ThreadProxy : public Proxy,
RendererCapabilities* capabilities);
void LayerTreeHostClosedOnImplThread(CompletionEvent* completion);
void ManageTilesOnImplThread();
- void SetViewportDamageOnImplThread(gfx::Rect damage_rect);
void AcquireLayerTexturesForMainThreadOnImplThread(
CompletionEvent* completion);
void RecreateOutputSurfaceOnImplThread(