OLD | NEW |
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 #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 "content/common/gpu/gpu_channel.h" | 9 #include "content/common/gpu/gpu_channel.h" |
10 | 10 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/debug/trace_event.h" | 13 #include "base/debug/trace_event.h" |
14 #include "base/message_loop_proxy.h" | 14 #include "base/message_loop_proxy.h" |
15 #include "base/process_util.h" | 15 #include "base/process_util.h" |
16 #include "base/string_util.h" | 16 #include "base/string_util.h" |
17 #include "content/common/child_process.h" | 17 #include "content/common/child_process.h" |
18 #include "content/common/gpu/gpu_channel_manager.h" | 18 #include "content/common/gpu/gpu_channel_manager.h" |
19 #include "content/common/gpu/gpu_messages.h" | 19 #include "content/common/gpu/gpu_messages.h" |
20 #include "content/common/gpu/sync_point_manager.h" | 20 #include "content/common/gpu/sync_point_manager.h" |
21 #include "content/public/common/content_client.h" | |
22 #include "content/public/common/content_switches.h" | 21 #include "content/public/common/content_switches.h" |
23 #include "gpu/command_buffer/service/mailbox_manager.h" | 22 #include "gpu/command_buffer/service/mailbox_manager.h" |
24 #include "gpu/command_buffer/service/gpu_scheduler.h" | 23 #include "gpu/command_buffer/service/gpu_scheduler.h" |
25 #include "ipc/ipc_channel.h" | 24 #include "ipc/ipc_channel.h" |
26 #include "ipc/ipc_channel_proxy.h" | 25 #include "ipc/ipc_channel_proxy.h" |
27 #include "ui/gl/gl_context.h" | 26 #include "ui/gl/gl_context.h" |
28 #include "ui/gl/gl_surface.h" | 27 #include "ui/gl/gl_surface.h" |
29 | 28 |
30 #if defined(OS_POSIX) | 29 #if defined(OS_POSIX) |
31 #include "ipc/ipc_channel_posix.h" | 30 #include "ipc/ipc_channel_posix.h" |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 const gfx::GLSurfaceHandle& window, | 298 const gfx::GLSurfaceHandle& window, |
300 int32 surface_id, | 299 int32 surface_id, |
301 const GPUCreateCommandBufferConfig& init_params, | 300 const GPUCreateCommandBufferConfig& init_params, |
302 int32* route_id) { | 301 int32* route_id) { |
303 TRACE_EVENT1("gpu", | 302 TRACE_EVENT1("gpu", |
304 "GpuChannel::CreateViewCommandBuffer", | 303 "GpuChannel::CreateViewCommandBuffer", |
305 "surface_id", | 304 "surface_id", |
306 surface_id); | 305 surface_id); |
307 | 306 |
308 *route_id = MSG_ROUTING_NONE; | 307 *route_id = MSG_ROUTING_NONE; |
309 content::GetContentClient()->SetActiveURL(init_params.active_url); | |
310 | 308 |
311 #if defined(ENABLE_GPU) | 309 #if defined(ENABLE_GPU) |
312 | 310 |
313 GpuCommandBufferStub* share_group = stubs_.Lookup(init_params.share_group_id); | 311 GpuCommandBufferStub* share_group = stubs_.Lookup(init_params.share_group_id); |
314 | 312 |
315 *route_id = GenerateRouteID(); | 313 *route_id = GenerateRouteID(); |
316 scoped_ptr<GpuCommandBufferStub> stub(new GpuCommandBufferStub( | 314 scoped_ptr<GpuCommandBufferStub> stub(new GpuCommandBufferStub( |
317 this, | 315 this, |
318 share_group, | 316 share_group, |
319 window, | 317 window, |
320 mailbox_manager_, | 318 mailbox_manager_, |
321 gfx::Size(), | 319 gfx::Size(), |
322 disallowed_features_, | 320 disallowed_features_, |
323 init_params.allowed_extensions, | 321 init_params.allowed_extensions, |
324 init_params.attribs, | 322 init_params.attribs, |
325 init_params.gpu_preference, | 323 init_params.gpu_preference, |
326 *route_id, | 324 *route_id, |
327 surface_id, | 325 surface_id, |
328 watchdog_, | 326 watchdog_, |
329 software_)); | 327 software_, |
| 328 init_params.active_url)); |
330 if (preempt_by_counter_.get()) | 329 if (preempt_by_counter_.get()) |
331 stub->SetPreemptByCounter(preempt_by_counter_); | 330 stub->SetPreemptByCounter(preempt_by_counter_); |
332 router_.AddRoute(*route_id, stub.get()); | 331 router_.AddRoute(*route_id, stub.get()); |
333 stubs_.AddWithID(stub.release(), *route_id); | 332 stubs_.AddWithID(stub.release(), *route_id); |
334 #endif // ENABLE_GPU | 333 #endif // ENABLE_GPU |
335 } | 334 } |
336 | 335 |
337 GpuCommandBufferStub* GpuChannel::LookupCommandBuffer(int32 route_id) { | 336 GpuCommandBufferStub* GpuChannel::LookupCommandBuffer(int32 route_id) { |
338 return stubs_.Lookup(route_id); | 337 return stubs_.Lookup(route_id); |
339 } | 338 } |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 } | 445 } |
447 | 446 |
448 void GpuChannel::OnCreateOffscreenCommandBuffer( | 447 void GpuChannel::OnCreateOffscreenCommandBuffer( |
449 const gfx::Size& size, | 448 const gfx::Size& size, |
450 const GPUCreateCommandBufferConfig& init_params, | 449 const GPUCreateCommandBufferConfig& init_params, |
451 IPC::Message* reply_message) { | 450 IPC::Message* reply_message) { |
452 TRACE_EVENT0("gpu", "GpuChannel::OnCreateOffscreenCommandBuffer"); | 451 TRACE_EVENT0("gpu", "GpuChannel::OnCreateOffscreenCommandBuffer"); |
453 | 452 |
454 int32 route_id = MSG_ROUTING_NONE; | 453 int32 route_id = MSG_ROUTING_NONE; |
455 | 454 |
456 content::GetContentClient()->SetActiveURL(init_params.active_url); | |
457 #if defined(ENABLE_GPU) | 455 #if defined(ENABLE_GPU) |
458 GpuCommandBufferStub* share_group = stubs_.Lookup(init_params.share_group_id); | 456 GpuCommandBufferStub* share_group = stubs_.Lookup(init_params.share_group_id); |
459 | 457 |
460 route_id = GenerateRouteID(); | 458 route_id = GenerateRouteID(); |
461 | 459 |
462 scoped_ptr<GpuCommandBufferStub> stub(new GpuCommandBufferStub( | 460 scoped_ptr<GpuCommandBufferStub> stub(new GpuCommandBufferStub( |
463 this, | 461 this, |
464 share_group, | 462 share_group, |
465 gfx::GLSurfaceHandle(), | 463 gfx::GLSurfaceHandle(), |
466 mailbox_manager_.get(), | 464 mailbox_manager_.get(), |
467 size, | 465 size, |
468 disallowed_features_, | 466 disallowed_features_, |
469 init_params.allowed_extensions, | 467 init_params.allowed_extensions, |
470 init_params.attribs, | 468 init_params.attribs, |
471 init_params.gpu_preference, | 469 init_params.gpu_preference, |
472 route_id, | 470 route_id, |
473 0, watchdog_, | 471 0, watchdog_, |
474 software_)); | 472 software_, |
| 473 init_params.active_url)); |
475 if (preempt_by_counter_.get()) | 474 if (preempt_by_counter_.get()) |
476 stub->SetPreemptByCounter(preempt_by_counter_); | 475 stub->SetPreemptByCounter(preempt_by_counter_); |
477 router_.AddRoute(route_id, stub.get()); | 476 router_.AddRoute(route_id, stub.get()); |
478 stubs_.AddWithID(stub.release(), route_id); | 477 stubs_.AddWithID(stub.release(), route_id); |
479 TRACE_EVENT1("gpu", "GpuChannel::OnCreateOffscreenCommandBuffer", | 478 TRACE_EVENT1("gpu", "GpuChannel::OnCreateOffscreenCommandBuffer", |
480 "route_id", route_id); | 479 "route_id", route_id); |
481 #endif | 480 #endif |
482 | 481 |
483 GpuChannelMsg_CreateOffscreenCommandBuffer::WriteReplyParams( | 482 GpuChannelMsg_CreateOffscreenCommandBuffer::WriteReplyParams( |
484 reply_message, | 483 reply_message, |
(...skipping 14 matching lines...) Expand all Loading... |
499 // In case the renderer is currently blocked waiting for a sync reply from | 498 // In case the renderer is currently blocked waiting for a sync reply from |
500 // the stub, we need to make sure to reschedule the GpuChannel here. | 499 // the stub, we need to make sure to reschedule the GpuChannel here. |
501 if (need_reschedule) | 500 if (need_reschedule) |
502 OnScheduled(); | 501 OnScheduled(); |
503 } | 502 } |
504 | 503 |
505 if (reply_message) | 504 if (reply_message) |
506 Send(reply_message); | 505 Send(reply_message); |
507 } | 506 } |
508 | 507 |
OLD | NEW |