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

Side by Side Diff: webkit/glue/plugins/mac_gpu_plugin_container_manager.cc

Issue 558035: [GPU] Get GPU process running on the mac... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 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
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "webkit/glue/plugins/mac_gpu_plugin_container_manager.h"
6
7 #include "base/logging.h"
8 #include "webkit/glue/webplugin.h"
9 #include "webkit/glue/plugins/mac_gpu_plugin_container.h"
10
11 MacGPUPluginContainerManager::MacGPUPluginContainerManager()
12 : current_id_(0) {
13 }
14
15 gfx::PluginWindowHandle
16 MacGPUPluginContainerManager::AllocateFakePluginWindowHandle() {
17 MacGPUPluginContainer* container = new MacGPUPluginContainer();
18 gfx::PluginWindowHandle res =
19 static_cast<gfx::PluginWindowHandle>(++current_id_);
20 plugin_window_to_container_map_.insert(std::make_pair(res, container));
21 return res;
22 }
23
24 void MacGPUPluginContainerManager::DestroyFakePluginWindowHandle(
25 gfx::PluginWindowHandle id) {
26 MacGPUPluginContainer* container = MapIDToContainer(id);
27 if (container)
28 delete container;
29 plugin_window_to_container_map_.erase(id);
30 }
31
32 void MacGPUPluginContainerManager::SetSizeAndBackingStore(
33 gfx::PluginWindowHandle id,
34 int32 width,
35 int32 height,
36 uint64 io_surface_identifier) {
37 MacGPUPluginContainer* container = MapIDToContainer(id);
38 if (container)
39 container->SetSizeAndBackingStore(width, height,
40 io_surface_identifier, this);
41 }
42
43 void MacGPUPluginContainerManager::MovePluginContainer(
44 const webkit_glue::WebPluginGeometry& move) {
45 MacGPUPluginContainer* container = MapIDToContainer(move.window);
46 if (container)
47 container->MoveTo(move);
48 }
49
50 void MacGPUPluginContainerManager::Draw(CGLContextObj context) {
51 glClearColor(0, 0, 0, 0);
52 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
53
54 GLenum target = GL_TEXTURE_RECTANGLE_ARB;
55 glTexEnvi(target, GL_TEXTURE_ENV_MODE, GL_REPLACE);
56
57 for (PluginWindowToContainerMap::const_iterator i =
58 plugin_window_to_container_map_.begin();
59 i != plugin_window_to_container_map_.end(); ++i) {
60 MacGPUPluginContainer* container = i->second;
61 container->Draw(context);
62 }
63
64 // Unbind any texture from the texture target to ensure that the
65 // next time through we will have to re-bind the texture and thereby
66 // pick up modifications from the other process.
67 glBindTexture(target, 0);
68
69 glFlush();
70 }
71
72 void MacGPUPluginContainerManager::EnqueueTextureForDeletion(GLuint texture) {
73 if (texture) {
74 textures_pending_deletion_.push_back(texture);
75 }
76 }
77
78 MacGPUPluginContainer* MacGPUPluginContainerManager::MapIDToContainer(
79 gfx::PluginWindowHandle id) {
80 PluginWindowToContainerMap::const_iterator i =
81 plugin_window_to_container_map_.find(id);
82 if (i != plugin_window_to_container_map_.end())
83 return i->second;
84
85 LOG(ERROR) << "Request for plugin container for unknown window id " << id;
86
87 return NULL;
88 }
89
OLDNEW
« no previous file with comments | « webkit/glue/plugins/mac_gpu_plugin_container_manager.h ('k') | webkit/glue/plugins/webplugin_delegate_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698