diff options
author | apatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-20 22:51:48 +0000 |
---|---|---|
committer | apatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-20 22:51:48 +0000 |
commit | 85cd621132aca61852db935cf91baf7f53395084 (patch) | |
tree | c45e9529a8bd26a40600791c9a943f65f3e5930e /content/browser/gpu/gpu_surface_tracker.cc | |
parent | 1ea8143aeeb5b9b464b67397ebe637e7731ea564 (diff) | |
download | chromium_src-85cd621132aca61852db935cf91baf7f53395084.zip chromium_src-85cd621132aca61852db935cf91baf7f53395084.tar.gz chromium_src-85cd621132aca61852db935cf91baf7f53395084.tar.bz2 |
Windows: Added AcceleratedPresenterMap.
This is a thread safe mapping from window handle to the associated AcceleratorPresenter that maintains the window's swap chain. The mapping was previously maintained by the GpuSurfaceTracker (via the surface ID). I changed it because I think is is possible the GpuSurfaceTracker's AcceleratedSurface pointer was going dangling.
I made PresentThread reference counted and made each AcceleratedPresenter ref count it's PresentThread so the PresentThread's message loop are always a valid place to post tasks.
Since other threads can post tasks to the AcceleratedPresenter at any time, I changed the shutdown of AcceleratedSurface to simply invalidate the presenter rather than waiting for its pending tasks to complete, which probably wasn't sufficient.
I renamed surface_id to surface_handle for consistency with the rest of the code.
BUG=117453
Review URL: https://chromiumcodereview.appspot.com/9704075
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@127821 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/gpu/gpu_surface_tracker.cc')
-rw-r--r-- | content/browser/gpu/gpu_surface_tracker.cc | 42 |
1 files changed, 6 insertions, 36 deletions
diff --git a/content/browser/gpu/gpu_surface_tracker.cc b/content/browser/gpu/gpu_surface_tracker.cc index ca1d078..9d0d9ac 100644 --- a/content/browser/gpu/gpu_surface_tracker.cc +++ b/content/browser/gpu/gpu_surface_tracker.cc @@ -6,10 +6,6 @@ #include "base/logging.h" -#if defined(OS_WIN) -#include "ui/gfx/surface/accelerated_surface_win.h" -#endif - GpuSurfaceTracker::GpuSurfaceTracker() : next_surface_id_(1) { } @@ -90,37 +86,11 @@ gfx::GLSurfaceHandle GpuSurfaceTracker::GetSurfaceHandle(int surface_id) { return surface_map_[surface_id].handle; } -#if defined(OS_WIN) && !defined(USE_AURA) - -void GpuSurfaceTracker::AsyncPresentAndAcknowledge( - int surface_id, - const gfx::Size& size, - int64 surface_handle, - const base::Callback<void(bool)>& completion_task) { +gfx::PluginWindowHandle GpuSurfaceTracker::GetSurfaceWindowHandle( + int surface_id) { base::AutoLock lock(lock_); - SurfaceMap::iterator it = surface_map_.find(surface_id); - if (it == surface_map_.end() || !it->second.handle.accelerated_surface) { - completion_task.Run(true); - return; - } - - it->second.handle.accelerated_surface->AsyncPresentAndAcknowledge( - it->second.handle.handle, - size, - surface_handle, - completion_task); -} - -void GpuSurfaceTracker::Suspend(int surface_id) { - base::AutoLock lock(lock_); - - SurfaceMap::iterator it = surface_map_.find(surface_id); - if (it == surface_map_.end() || !it->second.handle.accelerated_surface) - return; - - it->second.handle.accelerated_surface->Suspend(); -} - -#endif // OS_WIN - + if (it == surface_map_.end()) + return gfx::kNullPluginWindow; + return it->second.handle.handle; +}
\ No newline at end of file |