diff options
author | apatrick@google.com <apatrick@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-06 20:47:45 +0000 |
---|---|---|
committer | apatrick@google.com <apatrick@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-06 20:47:45 +0000 |
commit | 3dbf0a3c1ccaf15a6c107da8b4cfa43537833e5a (patch) | |
tree | 58c5786d980ceb97a3e0ec8a652963f23064d26c /ui | |
parent | 869f63584313127e61ba26413a1fca3fa66c7819 (diff) | |
download | chromium_src-3dbf0a3c1ccaf15a6c107da8b4cfa43537833e5a.zip chromium_src-3dbf0a3c1ccaf15a6c107da8b4cfa43537833e5a.tar.gz chromium_src-3dbf0a3c1ccaf15a6c107da8b4cfa43537833e5a.tar.bz2 |
Revert 171413
> Move initialization of D3D earlier in present thread lifetime.
>
> This improves startup time.
>
> Fixed bug where initial window size was treated as a resize and triggered the slow GDI path.
>
> Previous version was r171174, which was reverted. This patch is different because it does not initialize D3D until an AcceleratedPresenter is created but does not wait for the first present.
>
> BUG=163215,164414,164398
>
> Review URL: https://chromiumcodereview.appspot.com/11445029
TBR=apatrick@chromium.org
Review URL: https://codereview.chromium.org/11472008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@171584 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r-- | ui/surface/accelerated_surface_win.cc | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/ui/surface/accelerated_surface_win.cc b/ui/surface/accelerated_surface_win.cc index 969bf8a..4ed0ffd4 100644 --- a/ui/surface/accelerated_surface_win.cc +++ b/ui/surface/accelerated_surface_win.cc @@ -189,7 +189,6 @@ class PresentThread : public base::Thread, void ResetDevice(); protected: - virtual void Init(); virtual void CleanUp(); private: @@ -354,11 +353,6 @@ void PresentThread::ResetDevice() { device_->SetVertexDeclaration(vertex_declaration); } -void PresentThread::Init() { - TRACE_EVENT0("gpu", "Initialize thread"); - InitDevice(); -} - void PresentThread::CleanUp() { // The D3D device and query are leaked because destroying the associated D3D // query crashes some Intel drivers. @@ -371,19 +365,18 @@ PresentThread::~PresentThread() { } PresentThreadPool::PresentThreadPool() : next_thread_(0) { + // Do this in the constructor so present_threads_ is initialized before any + // other thread sees it. See LazyInstance documentation. + for (int i = 0; i < kNumPresentThreads; ++i) { + present_threads_[i] = new PresentThread( + base::StringPrintf("PresentThread #%d", i).c_str()); + present_threads_[i]->Start(); + } } PresentThread* PresentThreadPool::NextThread() { next_thread_ = (next_thread_ + 1) % kNumPresentThreads; - PresentThread* thread = present_threads_[next_thread_].get(); - if (!thread) { - thread = new PresentThread( - base::StringPrintf("PresentThread #%d", next_thread_).c_str()); - thread->Start(); - present_threads_[next_thread_] = thread; - } - - return thread; + return present_threads_[next_thread_].get(); } AcceleratedPresenterMap::AcceleratedPresenterMap() { @@ -1025,7 +1018,7 @@ gfx::Size AcceleratedPresenter::GetWindowSize() { bool AcceleratedPresenter::CheckDirect3DWillWork() { gfx::Size window_size = GetWindowSize(); - if (window_size != last_window_size_ && last_window_size_.GetArea() != 0) { + if (window_size != last_window_size_) { last_window_size_ = window_size; last_window_resize_time_ = base::Time::Now(); return false; |