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

Side by Side Diff: ui/surface/accelerated_surface_win.cc

Issue 10984007: in-chrome viewer for metro (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix include Created 8 years, 2 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
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/surface/accelerated_surface_win.h" 5 #include "ui/surface/accelerated_surface_win.h"
6 6
7 #include <dwmapi.h> 7 #include <dwmapi.h>
8 #include <windows.h> 8 #include <windows.h>
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 return; 405 return;
406 } 406 }
407 } 407 }
408 408
409 NOTREACHED(); 409 NOTREACHED();
410 } 410 }
411 411
412 scoped_refptr<AcceleratedPresenter> AcceleratedPresenterMap::GetPresenter( 412 scoped_refptr<AcceleratedPresenter> AcceleratedPresenterMap::GetPresenter(
413 gfx::PluginWindowHandle window) { 413 gfx::PluginWindowHandle window) {
414 base::AutoLock locked(lock_); 414 base::AutoLock locked(lock_);
415
416 if (!window)
417 return presenters_.begin()->second;
418
415 PresenterMap::iterator it = presenters_.find(window); 419 PresenterMap::iterator it = presenters_.find(window);
416 if (it == presenters_.end()) 420 if (it == presenters_.end())
417 return scoped_refptr<AcceleratedPresenter>(); 421 return scoped_refptr<AcceleratedPresenter>();
418 422
419 return it->second; 423 return it->second;
420 } 424 }
421 425
422 AcceleratedPresenter::AcceleratedPresenter(gfx::PluginWindowHandle window) 426 AcceleratedPresenter::AcceleratedPresenter(gfx::PluginWindowHandle window)
423 : present_thread_(g_present_thread_pool.Pointer()->NextThread()), 427 : present_thread_(g_present_thread_pool.Pointer()->NextThread()),
424 window_(window), 428 window_(window),
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 658
655 void AcceleratedPresenter::Invalidate() { 659 void AcceleratedPresenter::Invalidate() {
656 // Make any pending or future presentation tasks do nothing. Once the last 660 // Make any pending or future presentation tasks do nothing. Once the last
657 // last pending task has been ignored, the reference count on the presenter 661 // last pending task has been ignored, the reference count on the presenter
658 // will go to zero and the presenter, and potentially also the present thread 662 // will go to zero and the presenter, and potentially also the present thread
659 // it has a reference count on, will be destroyed. 663 // it has a reference count on, will be destroyed.
660 base::AutoLock locked(lock_); 664 base::AutoLock locked(lock_);
661 window_ = NULL; 665 window_ = NULL;
662 } 666 }
663 667
668 #if defined(USE_AURA)
669 void AcceleratedPresenter::SetNewTargetWindow(gfx::PluginWindowHandle window) {
670 window_ = window;
671 }
672 #endif
673
664 AcceleratedPresenter::~AcceleratedPresenter() { 674 AcceleratedPresenter::~AcceleratedPresenter() {
665 } 675 }
666 676
667 static base::TimeDelta GetSwapDelay() { 677 static base::TimeDelta GetSwapDelay() {
668 CommandLine* cmd_line = CommandLine::ForCurrentProcess(); 678 CommandLine* cmd_line = CommandLine::ForCurrentProcess();
669 int delay = 0; 679 int delay = 0;
670 if (cmd_line->HasSwitch(switches::kGpuSwapDelay)) { 680 if (cmd_line->HasSwitch(switches::kGpuSwapDelay)) {
671 base::StringToInt(cmd_line->GetSwitchValueNative( 681 base::StringToInt(cmd_line->GetSwitchValueNative(
672 switches::kGpuSwapDelay).c_str(), &delay); 682 switches::kGpuSwapDelay).c_str(), &delay);
673 } 683 }
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
936 return presenter_->CopyTo(src_subrect, dst_size, buf); 946 return presenter_->CopyTo(src_subrect, dst_size, buf);
937 } 947 }
938 948
939 void AcceleratedSurface::Suspend() { 949 void AcceleratedSurface::Suspend() {
940 presenter_->Suspend(); 950 presenter_->Suspend();
941 } 951 }
942 952
943 void AcceleratedSurface::WasHidden() { 953 void AcceleratedSurface::WasHidden() {
944 presenter_->WasHidden(); 954 presenter_->WasHidden();
945 } 955 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698