OLD | NEW |
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 #if defined(OS_WIN) | 5 #if defined(OS_WIN) |
6 #include <windows.h> | 6 #include <windows.h> |
7 #endif | 7 #endif |
8 | 8 |
9 #include "chrome/gpu/gpu_channel.h" | 9 #include "chrome/gpu/gpu_channel.h" |
10 | 10 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 static int last_id = 0; | 98 static int last_id = 0; |
99 return ++last_id; | 99 return ++last_id; |
100 } | 100 } |
101 | 101 |
102 void GpuChannel::OnCreateViewCommandBuffer(gfx::NativeViewId view_id, | 102 void GpuChannel::OnCreateViewCommandBuffer(gfx::NativeViewId view_id, |
103 int32* route_id) { | 103 int32* route_id) { |
104 *route_id = 0; | 104 *route_id = 0; |
105 | 105 |
106 #if defined(ENABLE_GPU) | 106 #if defined(ENABLE_GPU) |
107 | 107 |
108 gfx::PluginWindowHandle handle = NULL; | 108 gfx::PluginWindowHandle handle = gfx::kNullPluginWindow; |
109 #if defined(OS_WIN) | 109 #if defined(OS_WIN) |
110 gfx::NativeView view = gfx::NativeViewFromId(view_id); | 110 gfx::NativeView view = gfx::NativeViewFromId(view_id); |
111 | 111 |
112 // Check that the calling renderer is allowed to render to this window. | 112 // Check that the calling renderer is allowed to render to this window. |
113 // TODO(apatrick): consider killing the renderer process rather than failing. | 113 // TODO(apatrick): consider killing the renderer process rather than failing. |
114 int view_renderer_id = reinterpret_cast<int>( | 114 int view_renderer_id = reinterpret_cast<int>( |
115 GetProp(view, chrome::kChromiumRendererIdProperty)); | 115 GetProp(view, chrome::kChromiumRendererIdProperty)); |
116 if (view_renderer_id != renderer_id_) | 116 if (view_renderer_id != renderer_id_) |
117 return; | 117 return; |
118 handle = view; | 118 handle = view; |
(...skipping 25 matching lines...) Expand all Loading... |
144 uint32 parent_texture_id, | 144 uint32 parent_texture_id, |
145 int32* route_id) { | 145 int32* route_id) { |
146 #if defined(ENABLE_GPU) | 146 #if defined(ENABLE_GPU) |
147 *route_id = GenerateRouteID(); | 147 *route_id = GenerateRouteID(); |
148 GpuCommandBufferStub* parent_stub = NULL; | 148 GpuCommandBufferStub* parent_stub = NULL; |
149 if (parent_route_id != 0) | 149 if (parent_route_id != 0) |
150 parent_stub = stubs_.Lookup(parent_route_id); | 150 parent_stub = stubs_.Lookup(parent_route_id); |
151 | 151 |
152 scoped_ptr<GpuCommandBufferStub> stub(new GpuCommandBufferStub( | 152 scoped_ptr<GpuCommandBufferStub> stub(new GpuCommandBufferStub( |
153 this, | 153 this, |
154 NULL, | 154 gfx::kNullPluginWindow, |
155 parent_stub, | 155 parent_stub, |
156 size, | 156 size, |
157 parent_texture_id, | 157 parent_texture_id, |
158 *route_id)); | 158 *route_id)); |
159 router_.AddRoute(*route_id, stub.get()); | 159 router_.AddRoute(*route_id, stub.get()); |
160 stubs_.AddWithID(stub.release(), *route_id); | 160 stubs_.AddWithID(stub.release(), *route_id); |
161 #else | 161 #else |
162 *route_id = 0; | 162 *route_id = 0; |
163 #endif | 163 #endif |
164 } | 164 } |
(...skipping 24 matching lines...) Expand all Loading... |
189 channel_.reset(new IPC::SyncChannel( | 189 channel_.reset(new IPC::SyncChannel( |
190 channel_name, IPC::Channel::MODE_SERVER, this, NULL, | 190 channel_name, IPC::Channel::MODE_SERVER, this, NULL, |
191 ChildProcess::current()->io_message_loop(), false, | 191 ChildProcess::current()->io_message_loop(), false, |
192 ChildProcess::current()->GetShutDownEvent())); | 192 ChildProcess::current()->GetShutDownEvent())); |
193 return true; | 193 return true; |
194 } | 194 } |
195 | 195 |
196 std::string GpuChannel::GetChannelName() { | 196 std::string GpuChannel::GetChannelName() { |
197 return StringPrintf("%d.r%d", base::GetCurrentProcId(), renderer_id_); | 197 return StringPrintf("%d.r%d", base::GetCurrentProcId(), renderer_id_); |
198 } | 198 } |
OLD | NEW |