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

Unified Diff: ui/compositor/compositor.cc

Issue 10873052: Add ifdef guards to prepare for WebLayerTreeView interface change (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 8 years, 4 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
« no previous file with comments | « ui/compositor/compositor.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/compositor/compositor.cc
diff --git a/ui/compositor/compositor.cc b/ui/compositor/compositor.cc
index a2102df0c0f84148b10bb16863355e5f747d6658..b129ef610ac1d69e9309cf80ea9145b54d28ef88 100644
--- a/ui/compositor/compositor.cc
+++ b/ui/compositor/compositor.cc
@@ -153,9 +153,15 @@ Compositor::Compositor(CompositorDelegate* delegate,
settings.refreshRate =
test_compositor_enabled ? kTestRefreshRate : kDefaultRefreshRate;
- host_.initialize(this, *root_web_layer_, settings);
root_web_layer_->setAnchorPoint(WebKit::WebFloatPoint(0.f, 0.f));
+#if defined(WEBLAYERTREEVIEW_IS_PURE_VIRTUAL)
+ host_.reset(WebKit::WebLayerTreeView::create(this, *root_web_layer_,
+ settings));
+ host_->setSurfaceReady();
+#else
+ host_.initialize(this, *root_web_layer_, settings);
host_.setSurfaceReady();
+#endif
}
Compositor::~Compositor() {
@@ -197,7 +203,11 @@ void Compositor::ScheduleDraw() {
// TODO(nduca): Temporary while compositor calls
// compositeImmediately() directly.
layout();
+#if defined(WEBLAYERTREEVIEW_IS_PURE_VIRTUAL)
+ host_->composite();
+#else
host_.composite();
+#endif
} else if (delegate_) {
delegate_->ScheduleDraw();
}
@@ -229,13 +239,21 @@ void Compositor::Draw(bool force_clear) {
// TODO(nduca): Temporary while compositor calls
// compositeImmediately() directly.
layout();
+#if defined(WEBLAYERTREEVIEW_IS_PURE_VIRTUAL)
+ host_->composite();
+#else
host_.composite();
+#endif
if (!g_compositor_thread && !swap_posted_)
NotifyEnd();
}
void Compositor::ScheduleFullDraw() {
+#if defined(WEBLAYERTREEVIEW_IS_PURE_VIRTUAL)
+ host_->setNeedsRedraw();
+#else
host_.setNeedsRedraw();
+#endif
}
bool Compositor::ReadPixels(SkBitmap* bitmap,
@@ -253,7 +271,11 @@ bool Compositor::ReadPixels(SkBitmap* bitmap,
bitmap->allocPixels();
SkAutoLockPixels lock_image(*bitmap);
unsigned char* pixels = static_cast<unsigned char*>(bitmap->getPixels());
+#if defined(WEBLAYERTREEVIEW_IS_PURE_VIRTUAL)
+ if (host_->compositeAndReadback(
+#else
if (host_.compositeAndReadback(
+#endif
pixels, gfx::Rect(new_origin, bounds_in_pixel.size()))) {
SwizzleRGBAToBGRAAndFlip(pixels, bounds_in_pixel.size());
return true;
@@ -266,7 +288,11 @@ void Compositor::SetScaleAndSize(float scale, const gfx::Size& size_in_pixel) {
if (size_in_pixel.IsEmpty() || scale <= 0)
return;
size_ = size_in_pixel;
+#if defined(WEBLAYERTREEVIEW_IS_PURE_VIRTUAL)
+ host_->setViewportSize(size_in_pixel);
+#else
host_.setViewportSize(size_in_pixel);
+#endif
root_web_layer_->setBounds(size_in_pixel);
if (device_scale_factor_ != scale) {
« no previous file with comments | « ui/compositor/compositor.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698