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/gfx/surface/accelerated_surface_win.h" | 5 #include "ui/gfx/surface/accelerated_surface_win.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <algorithm> | 8 #include <algorithm> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
630 | 630 |
631 if (hr == S_FALSE) | 631 if (hr == S_FALSE) |
632 Sleep(1); | 632 Sleep(1); |
633 } while (hr == S_FALSE); | 633 } while (hr == S_FALSE); |
634 } | 634 } |
635 | 635 |
636 static const base::TimeDelta swap_delay = GetSwapDelay(); | 636 static const base::TimeDelta swap_delay = GetSwapDelay(); |
637 if (swap_delay.ToInternalValue()) | 637 if (swap_delay.ToInternalValue()) |
638 base::PlatformThread::Sleep(swap_delay); | 638 base::PlatformThread::Sleep(swap_delay); |
639 | 639 |
640 scoped_completion_runner.Release(); | |
641 if (!completion_task.is_null()) | |
642 completion_task.Run(true); | |
643 | |
644 { | 640 { |
645 TRACE_EVENT0("surface", "Present"); | 641 TRACE_EVENT0("surface", "Present"); |
646 hr = swap_chain_->Present(&rect, &rect, window_, NULL, 0); | 642 hr = swap_chain_->Present(&rect, &rect, window_, NULL, 0); |
647 if (FAILED(hr) && | 643 if (FAILED(hr) && |
648 FAILED(present_thread_->device()->CheckDeviceState(window_))) { | 644 FAILED(present_thread_->device()->CheckDeviceState(window_))) { |
649 present_thread_->ResetDevice(); | 645 present_thread_->ResetDevice(); |
650 } | 646 } |
651 } | 647 } |
652 } | 648 } |
653 | 649 |
(...skipping 21 matching lines...) Expand all Loading... |
675 return presenter_->Present(); | 671 return presenter_->Present(); |
676 } | 672 } |
677 | 673 |
678 bool AcceleratedSurface::CopyTo(const gfx::Size& size, void* buf) { | 674 bool AcceleratedSurface::CopyTo(const gfx::Size& size, void* buf) { |
679 return presenter_->CopyTo(size, buf); | 675 return presenter_->CopyTo(size, buf); |
680 } | 676 } |
681 | 677 |
682 void AcceleratedSurface::Suspend() { | 678 void AcceleratedSurface::Suspend() { |
683 presenter_->Suspend(); | 679 presenter_->Suspend(); |
684 } | 680 } |
OLD | NEW |