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

Side by Side Diff: content/browser/gpu/gpu_surface_tracker.h

Issue 10795058: Add GL surface creation for Android. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add interface for surface lookup Created 8 years, 5 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 #ifndef CONTENT_BROWSER_GPU_GPU_SURFACE_TRACKER_H_ 5 #ifndef CONTENT_BROWSER_GPU_GPU_SURFACE_TRACKER_H_
6 #define CONTENT_BROWSER_GPU_GPU_SURFACE_TRACKER_H_ 6 #define CONTENT_BROWSER_GPU_GPU_SURFACE_TRACKER_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/memory/singleton.h" 11 #include "base/memory/singleton.h"
12 #include "base/synchronization/lock.h" 12 #include "base/synchronization/lock.h"
13 #include "content/common/gpu/gpu_surface_lookup.h"
13 #include "ui/gfx/native_widget_types.h" 14 #include "ui/gfx/native_widget_types.h"
14 #include "ui/gfx/size.h" 15 #include "ui/gfx/size.h"
15 16
16 // This class is responsible for managing rendering surfaces exposed to the 17 // This class is responsible for managing rendering surfaces exposed to the
17 // GPU process. Every surface gets registered to this class, and gets an ID. 18 // GPU process. Every surface gets registered to this class, and gets an ID.
18 // All calls to and from the GPU process, with the exception of 19 // All calls to and from the GPU process, with the exception of
19 // CreateViewCommandBuffer, refer to the rendering surface by its ID. 20 // CreateViewCommandBuffer, refer to the rendering surface by its ID.
20 // This class is thread safe. 21 // This class is thread safe.
21 // 22 //
22 // Note: The ID can exist before the actual native handle for the surface is 23 // Note: The ID can exist before the actual native handle for the surface is
23 // created, for example to allow giving a reference to it to a renderer, so that 24 // created, for example to allow giving a reference to it to a renderer, so that
24 // it is unamibiguously identified. 25 // it is unamibiguously identified.
25 class GpuSurfaceTracker { 26 class GpuSurfaceTracker : public GpuSurfaceLookup {
26 public: 27 public:
28 // GpuSurfaceLookup implementation:
29 // Returns the native widget associated with a given surface_id.
30 virtual gfx::AcceleratedWidget GetNativeWidget(int surface_id) OVERRIDE;
31
27 // Gets the global instance of the surface tracker. 32 // Gets the global instance of the surface tracker.
28 static GpuSurfaceTracker* Get() { return GetInstance(); } 33 static GpuSurfaceTracker* Get() { return GetInstance(); }
29 34
30 // Adds a surface for a given RenderWidgetHost. |renderer_id| is the renderer 35 // Adds a surface for a given RenderWidgetHost. |renderer_id| is the renderer
31 // process ID, |render_widget_id| is the RenderWidgetHost route id within that 36 // process ID, |render_widget_id| is the RenderWidgetHost route id within that
32 // renderer. Returns the surface ID. 37 // renderer. Returns the surface ID.
33 int AddSurfaceForRenderer(int renderer_id, int render_widget_id); 38 int AddSurfaceForRenderer(int renderer_id, int render_widget_id);
34 39
35 // Looks up a surface for a given RenderWidgetHost. Returns the surface 40 // Looks up a surface for a given RenderWidgetHost. Returns the surface
36 // ID, or 0 if not found. 41 // ID, or 0 if not found.
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 ~GpuSurfaceTracker(); 86 ~GpuSurfaceTracker();
82 87
83 base::Lock lock_; 88 base::Lock lock_;
84 SurfaceMap surface_map_; 89 SurfaceMap surface_map_;
85 int next_surface_id_; 90 int next_surface_id_;
86 91
87 DISALLOW_COPY_AND_ASSIGN(GpuSurfaceTracker); 92 DISALLOW_COPY_AND_ASSIGN(GpuSurfaceTracker);
88 }; 93 };
89 94
90 #endif // CONTENT_BROWSER_GPU_GPU_SURFACE_TRACKER_H_ 95 #endif // CONTENT_BROWSER_GPU_GPU_SURFACE_TRACKER_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/gpu/gpu_surface_tracker.cc » ('j') | content/browser/gpu/gpu_surface_tracker.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698