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

Side by Side Diff: ui/gfx/compositor/compositor.cc

Issue 9122020: Update CompositorCC WebLayerTreeView usage for WebKit API change (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase to ToT Created 8 years, 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/gfx/compositor/compositor.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/gfx/compositor/compositor.h" 5 #include "ui/gfx/compositor/compositor.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/threading/thread_restrictions.h" 8 #include "base/threading/thread_restrictions.h"
9 #include "third_party/skia/include/images/SkImageEncoder.h" 9 #include "third_party/skia/include/images/SkImageEncoder.h"
10 #include "third_party/skia/include/core/SkBitmap.h" 10 #include "third_party/skia/include/core/SkBitmap.h"
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 command_line->HasSwitch(switches::kUIShowLayerTree); 121 command_line->HasSwitch(switches::kUIShowLayerTree);
122 settings.refreshRate = test_compositor_enabled ? 122 settings.refreshRate = test_compositor_enabled ?
123 kTestRefreshRate : kDefaultRefreshRate; 123 kTestRefreshRate : kDefaultRefreshRate;
124 settings.partialSwapEnabled = 124 settings.partialSwapEnabled =
125 command_line->HasSwitch(switches::kUIEnablePartialSwap); 125 command_line->HasSwitch(switches::kUIEnablePartialSwap);
126 #if defined(PER_TILE_PAINTING) 126 #if defined(PER_TILE_PAINTING)
127 settings.perTilePainting = 127 settings.perTilePainting =
128 command_line->HasSwitch(switches::kUIEnablePerTilePainting); 128 command_line->HasSwitch(switches::kUIEnablePerTilePainting);
129 #endif 129 #endif
130 130
131 #if defined(WEBLAYERTREEVIEW_HAS_INITIALIZE)
132 host_.initialize(this, root_web_layer_, settings);
133 #else
131 host_ = WebKit::WebLayerTreeView::create(this, root_web_layer_, settings); 134 host_ = WebKit::WebLayerTreeView::create(this, root_web_layer_, settings);
135 #endif
132 root_web_layer_.setAnchorPoint(WebKit::WebFloatPoint(0.f, 0.f)); 136 root_web_layer_.setAnchorPoint(WebKit::WebFloatPoint(0.f, 0.f));
133 WidgetSizeChanged(size_); 137 WidgetSizeChanged(size_);
134 } 138 }
135 139
136 Compositor::~Compositor() { 140 Compositor::~Compositor() {
137 // There's a cycle between |root_web_layer_| and |host_|, which results in 141 // There's a cycle between |root_web_layer_| and |host_|, which results in
138 // leaking and/or crashing. Explicitly set the root layer to NULL so the cycle 142 // leaking and/or crashing. Explicitly set the root layer to NULL so the cycle
139 // is broken. 143 // is broken.
140 host_.setRootLayer(NULL); 144 host_.setRootLayer(NULL);
141 if (root_layer_) 145 if (root_layer_)
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 if (test_compositor_enabled) { 275 if (test_compositor_enabled) {
272 ui::TestWebGraphicsContext3D* test_context = 276 ui::TestWebGraphicsContext3D* test_context =
273 new ui::TestWebGraphicsContext3D(); 277 new ui::TestWebGraphicsContext3D();
274 test_context->Initialize(); 278 test_context->Initialize();
275 return test_context; 279 return test_context;
276 } else { 280 } else {
277 return ContextFactory::GetInstance()->CreateContext(this); 281 return ContextFactory::GetInstance()->CreateContext(this);
278 } 282 }
279 } 283 }
280 284
285 void Compositor::didRebindGraphicsContext(bool success) {
286 }
287
288 void Compositor::didCommitAndDrawFrame() {
289 }
290
281 void Compositor::didCompleteSwapBuffers() { 291 void Compositor::didCompleteSwapBuffers() {
282 NotifyEnd(); 292 NotifyEnd();
283 } 293 }
284 294
285 void Compositor::didRebindGraphicsContext(bool success) {
286 }
287
288 void Compositor::scheduleComposite() { 295 void Compositor::scheduleComposite() {
289 ScheduleDraw(); 296 ScheduleDraw();
290 } 297 }
291 298
292 void Compositor::SwizzleRGBAToBGRAAndFlip(unsigned char* pixels, 299 void Compositor::SwizzleRGBAToBGRAAndFlip(unsigned char* pixels,
293 const gfx::Size& image_size) { 300 const gfx::Size& image_size) {
294 // Swizzle from RGBA to BGRA 301 // Swizzle from RGBA to BGRA
295 size_t bitmap_size = 4 * image_size.width() * image_size.height(); 302 size_t bitmap_size = 4 * image_size.width() * image_size.height();
296 for(size_t i = 0; i < bitmap_size; i += 4) 303 for(size_t i = 0; i < bitmap_size; i += 4)
297 std::swap(pixels[i], pixels[i + 2]); 304 std::swap(pixels[i], pixels[i + 2]);
(...skipping 29 matching lines...) Expand all
327 334
328 COMPOSITOR_EXPORT void DisableTestCompositor() { 335 COMPOSITOR_EXPORT void DisableTestCompositor() {
329 test_compositor_enabled = false; 336 test_compositor_enabled = false;
330 } 337 }
331 338
332 COMPOSITOR_EXPORT bool IsTestCompositorEnabled() { 339 COMPOSITOR_EXPORT bool IsTestCompositorEnabled() {
333 return test_compositor_enabled; 340 return test_compositor_enabled;
334 } 341 }
335 342
336 } // namespace ui 343 } // namespace ui
OLDNEW
« no previous file with comments | « ui/gfx/compositor/compositor.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698