| OLD | NEW |
| 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/compositor/compositor.h" | 5 #include "ui/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/WebKit/Source/WebKit/chromium/public/WebCompositor.h" | 9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositor.h" |
| 10 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebFloatPoin
t.h" | 10 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebFloatPoin
t.h" |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 return test_context; | 303 return test_context; |
| 304 } else { | 304 } else { |
| 305 return ContextFactory::GetInstance()->CreateContext(this); | 305 return ContextFactory::GetInstance()->CreateContext(this); |
| 306 } | 306 } |
| 307 } | 307 } |
| 308 | 308 |
| 309 void Compositor::didRebindGraphicsContext(bool success) { | 309 void Compositor::didRebindGraphicsContext(bool success) { |
| 310 } | 310 } |
| 311 | 311 |
| 312 void Compositor::didCommitAndDrawFrame() { | 312 void Compositor::didCommitAndDrawFrame() { |
| 313 currently_compositing_ = true; |
| 313 FOR_EACH_OBSERVER(CompositorObserver, | 314 FOR_EACH_OBSERVER(CompositorObserver, |
| 314 observer_list_, | 315 observer_list_, |
| 315 OnCompositingStarted(this)); | 316 OnCompositingStarted(this)); |
| 316 } | 317 } |
| 317 | 318 |
| 318 void Compositor::didCompleteSwapBuffers() { | 319 void Compositor::didCompleteSwapBuffers() { |
| 319 NotifyEnd(); | 320 NotifyEnd(); |
| 320 } | 321 } |
| 321 | 322 |
| 322 void Compositor::scheduleComposite() { | 323 void Compositor::scheduleComposite() { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 340 memcpy(&pixels[row * row_size], | 341 memcpy(&pixels[row * row_size], |
| 341 &pixels[bitmap_size - (row + 1) * row_size], | 342 &pixels[bitmap_size - (row + 1) * row_size], |
| 342 row_size); | 343 row_size); |
| 343 memcpy(&pixels[bitmap_size - (row + 1) * row_size], | 344 memcpy(&pixels[bitmap_size - (row + 1) * row_size], |
| 344 tmp_row.get(), | 345 tmp_row.get(), |
| 345 row_size); | 346 row_size); |
| 346 } | 347 } |
| 347 } | 348 } |
| 348 | 349 |
| 349 void Compositor::NotifyEnd() { | 350 void Compositor::NotifyEnd() { |
| 351 currently_compositing_ = false; |
| 350 FOR_EACH_OBSERVER(CompositorObserver, | 352 FOR_EACH_OBSERVER(CompositorObserver, |
| 351 observer_list_, | 353 observer_list_, |
| 352 OnCompositingEnded(this)); | 354 OnCompositingEnded(this)); |
| 353 } | 355 } |
| 354 | 356 |
| 355 COMPOSITOR_EXPORT void SetupTestCompositor() { | 357 COMPOSITOR_EXPORT void SetupTestCompositor() { |
| 356 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 358 if (!CommandLine::ForCurrentProcess()->HasSwitch( |
| 357 switches::kDisableTestCompositor)) { | 359 switches::kDisableTestCompositor)) { |
| 358 test_compositor_enabled = true; | 360 test_compositor_enabled = true; |
| 359 } | 361 } |
| 360 #if defined(OS_CHROMEOS) | 362 #if defined(OS_CHROMEOS) |
| 361 // If the test is running on the chromeos envrionment (such as | 363 // If the test is running on the chromeos envrionment (such as |
| 362 // device or vm bots), use the real compositor. | 364 // device or vm bots), use the real compositor. |
| 363 if (base::chromeos::IsRunningOnChromeOS()) | 365 if (base::chromeos::IsRunningOnChromeOS()) |
| 364 test_compositor_enabled = false; | 366 test_compositor_enabled = false; |
| 365 #endif | 367 #endif |
| 366 } | 368 } |
| 367 | 369 |
| 368 COMPOSITOR_EXPORT void DisableTestCompositor() { | 370 COMPOSITOR_EXPORT void DisableTestCompositor() { |
| 369 test_compositor_enabled = false; | 371 test_compositor_enabled = false; |
| 370 } | 372 } |
| 371 | 373 |
| 372 COMPOSITOR_EXPORT bool IsTestCompositorEnabled() { | 374 COMPOSITOR_EXPORT bool IsTestCompositorEnabled() { |
| 373 return test_compositor_enabled; | 375 return test_compositor_enabled; |
| 374 } | 376 } |
| 375 | 377 |
| 376 } // namespace ui | 378 } // namespace ui |
| OLD | NEW |