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

Side by Side Diff: chrome/gpu/gpu_channel.cc

Issue 5581008: Add a new GetInstance() method for singleton classes, take 2. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 10 years 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 #include "chrome/gpu/gpu_channel.h" 5 #include "chrome/gpu/gpu_channel.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #endif 9 #endif
10 10
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 #if defined(ENABLE_GPU) 199 #if defined(ENABLE_GPU)
200 router_.RemoveRoute(route_id); 200 router_.RemoveRoute(route_id);
201 stubs_.Remove(route_id); 201 stubs_.Remove(route_id);
202 #endif 202 #endif
203 } 203 }
204 204
205 void GpuChannel::OnCreateVideoDecoder(int32 context_route_id, 205 void GpuChannel::OnCreateVideoDecoder(int32 context_route_id,
206 int32 decoder_host_id) { 206 int32 decoder_host_id) {
207 #if defined(ENABLE_GPU) 207 #if defined(ENABLE_GPU)
208 VLOG(1) << "GpuChannel::OnCreateVideoDecoder"; 208 VLOG(1) << "GpuChannel::OnCreateVideoDecoder";
209 GpuVideoService* service = GpuVideoService::get(); 209 GpuVideoService* service = GpuVideoService::GetInstance();
210 if (service == NULL) { 210 if (service == NULL) {
211 // TODO(hclam): Need to send a failure message. 211 // TODO(hclam): Need to send a failure message.
212 return; 212 return;
213 } 213 }
214 214
215 // The context ID corresponds to the command buffer used. 215 // The context ID corresponds to the command buffer used.
216 GpuCommandBufferStub* stub = stubs_.Lookup(context_route_id); 216 GpuCommandBufferStub* stub = stubs_.Lookup(context_route_id);
217 int32 decoder_id = GenerateRouteID(); 217 int32 decoder_id = GenerateRouteID();
218 218
219 // TODO(hclam): Need to be careful about the lifetime of the command buffer 219 // TODO(hclam): Need to be careful about the lifetime of the command buffer
220 // decoder. 220 // decoder.
221 bool ret = service->CreateVideoDecoder( 221 bool ret = service->CreateVideoDecoder(
222 this, &router_, decoder_host_id, decoder_id, 222 this, &router_, decoder_host_id, decoder_id,
223 stub->processor()->decoder()); 223 stub->processor()->decoder());
224 DCHECK(ret) << "Failed to create a GpuVideoDecoder"; 224 DCHECK(ret) << "Failed to create a GpuVideoDecoder";
225 #endif 225 #endif
226 } 226 }
227 227
228 void GpuChannel::OnDestroyVideoDecoder(int32 decoder_id) { 228 void GpuChannel::OnDestroyVideoDecoder(int32 decoder_id) {
229 #if defined(ENABLE_GPU) 229 #if defined(ENABLE_GPU)
230 LOG(ERROR) << "GpuChannel::OnDestroyVideoDecoder"; 230 LOG(ERROR) << "GpuChannel::OnDestroyVideoDecoder";
231 GpuVideoService* service = GpuVideoService::get(); 231 GpuVideoService* service = GpuVideoService::GetInstance();
232 if (service == NULL) 232 if (service == NULL)
233 return; 233 return;
234 service->DestroyVideoDecoder(&router_, decoder_id); 234 service->DestroyVideoDecoder(&router_, decoder_id);
235 #endif 235 #endif
236 } 236 }
237 237
238 bool GpuChannel::Init() { 238 bool GpuChannel::Init() {
239 // Check whether we're already initialized. 239 // Check whether we're already initialized.
240 if (channel_.get()) 240 if (channel_.get())
241 return true; 241 return true;
(...skipping 13 matching lines...) Expand all
255 channel_name, IPC::Channel::MODE_SERVER, this, 255 channel_name, IPC::Channel::MODE_SERVER, this,
256 ChildProcess::current()->io_message_loop(), false, 256 ChildProcess::current()->io_message_loop(), false,
257 ChildProcess::current()->GetShutDownEvent())); 257 ChildProcess::current()->GetShutDownEvent()));
258 258
259 return true; 259 return true;
260 } 260 }
261 261
262 std::string GpuChannel::GetChannelName() { 262 std::string GpuChannel::GetChannelName() {
263 return StringPrintf("%d.r%d", base::GetCurrentProcId(), renderer_id_); 263 return StringPrintf("%d.r%d", base::GetCurrentProcId(), renderer_id_);
264 } 264 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698