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

Side by Side Diff: chrome/browser/renderer_host/accelerated_surface_container_manager_mac.h

Issue 6532073: Move core pieces of browser\renderer_host to src\content. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 CHROME_BROWSER_RENDERER_HOST_GPU_PLUGIN_CONTAINER_MANAGER_MAC_H_ 5 #ifndef CHROME_BROWSER_RENDERER_HOST_GPU_PLUGIN_CONTAINER_MANAGER_MAC_H_
6 #define CHROME_BROWSER_RENDERER_HOST_GPU_PLUGIN_CONTAINER_MANAGER_MAC_H_ 6 #define CHROME_BROWSER_RENDERER_HOST_GPU_PLUGIN_CONTAINER_MANAGER_MAC_H_
7 #pragma once 7 #pragma once
8 8
9 #include <OpenGL/OpenGL.h> 9 // TODO(jam): remove this file when all files have been converted.
10 #include <map> 10 #include "content/browser/renderer_host/accelerated_surface_container_manager_ma c.h"
11
12 #include "app/surface/transport_dib.h"
13 #include "base/basictypes.h"
14 #include "base/synchronization/lock.h"
15 #include "ui/gfx/native_widget_types.h"
16
17 namespace webkit {
18 namespace npapi {
19 struct WebPluginGeometry;
20 }
21 }
22
23 class AcceleratedSurfaceContainerMac;
24
25 // Helper class that manages the backing store and on-screen rendering
26 // of instances of the GPU plugin on the Mac.
27 class AcceleratedSurfaceContainerManagerMac {
28 public:
29 AcceleratedSurfaceContainerManagerMac();
30
31 // Allocates a new "fake" PluginWindowHandle, which is used as the
32 // key for the other operations.
33 gfx::PluginWindowHandle AllocateFakePluginWindowHandle(bool opaque,
34 bool root);
35
36 // Destroys a fake PluginWindowHandle and associated storage.
37 void DestroyFakePluginWindowHandle(gfx::PluginWindowHandle id);
38
39 // Indicates whether the given PluginWindowHandle is "root", which
40 // means that we are using accelerated compositing and that this one
41 // contains the compositor's output.
42 bool IsRootContainer(gfx::PluginWindowHandle id) const;
43
44 // Returns the handle of the compositor surface, or kNullPluginWindow if no
45 // compositor surface is active.
46 gfx::PluginWindowHandle root_container_handle() const {
47 return root_container_handle_;
48 }
49
50 // Informs the manager if gpu rendering is active.
51 void set_gpu_rendering_active(bool active);
52
53 // Sets the size and backing store of the plugin instance. There are two
54 // versions: the IOSurface version is used on systems where the IOSurface
55 // API is supported (Mac OS X 10.6 and later); the TransportDIB is used on
56 // Mac OS X 10.5 and earlier.
57 void SetSizeAndIOSurface(gfx::PluginWindowHandle id,
58 int32 width,
59 int32 height,
60 uint64 io_surface_identifier);
61 void SetSizeAndTransportDIB(gfx::PluginWindowHandle id,
62 int32 width,
63 int32 height,
64 TransportDIB::Handle transport_dib);
65
66 // Takes an update from WebKit about a plugin's position and size and moves
67 // the plugin accordingly.
68 void SetPluginContainerGeometry(
69 const webkit::npapi::WebPluginGeometry& move);
70
71 // Draws the plugin container associated with the given id into the given
72 // OpenGL context, which must already be current.
73 void Draw(CGLContextObj context, gfx::PluginWindowHandle id);
74
75 // Causes the next Draw call on each container to trigger a texture upload.
76 // Should be called any time the drawing context has changed.
77 void ForceTextureReload();
78
79 // Notifies a surface that it has been painted to.
80 void SetSurfaceWasPaintedTo(gfx::PluginWindowHandle id, uint64 surface_id);
81
82 // Notifies the root container that its surface is invalid.
83 void SetRootSurfaceInvalid();
84
85 // Returns if a given surface should be shown.
86 bool SurfaceShouldBeVisible(gfx::PluginWindowHandle id) const;
87 private:
88 uint32 current_id_;
89
90 // Maps a "fake" plugin window handle to the corresponding container.
91 AcceleratedSurfaceContainerMac*
92 MapIDToContainer(gfx::PluginWindowHandle id) const;
93
94 // A map that associates plugin window handles with their containers.
95 typedef std::map<gfx::PluginWindowHandle, AcceleratedSurfaceContainerMac*>
96 PluginWindowToContainerMap;
97 PluginWindowToContainerMap plugin_window_to_container_map_;
98
99 // The "root" container, which is only used to draw the output of
100 // the accelerated compositor if it is active. Currently,
101 // accelerated plugins (Core Animation and Pepper 3D) are drawn on
102 // top of the page's contents rather than transformed and composited
103 // with the rest of the page. At some point we would like them to be
104 // treated uniformly with other page elements; when this is done,
105 // the separate treatment of the root container can go away because
106 // there will only be one container active when the accelerated
107 // compositor is active.
108 AcceleratedSurfaceContainerMac* root_container_;
109 gfx::PluginWindowHandle root_container_handle_;
110
111 // True if gpu rendering is active. The root container is created on demand
112 // and destroyed only when a renderer process exits. When the compositor was
113 // created, this is set to |false| while the compositor is not needed.
114 bool gpu_rendering_active_;
115
116 // Both |plugin_window_to_container_map_| and the
117 // AcceleratedSurfaceContainerMac in it are not threadsafe, but accessed from
118 // multiple threads. All these accesses are guarded by this lock.
119 mutable base::Lock lock_;
120
121 DISALLOW_COPY_AND_ASSIGN(AcceleratedSurfaceContainerManagerMac);
122 };
123 11
124 #endif // CHROME_BROWSER_RENDERER_HOST_GPU_PLUGIN_CONTAINER_MANAGER_MAC_H_ 12 #endif // CHROME_BROWSER_RENDERER_HOST_GPU_PLUGIN_CONTAINER_MANAGER_MAC_H_
125
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698