OLD | NEW |
1 // TODO(jam): move this file to src/content once we have an interface that the | 1 // TODO(jam): move this file to src/content once we have an interface that the |
2 // embedder provides. We can then use it to get the resource and resize the | 2 // embedder provides. We can then use it to get the resource and resize the |
3 // window. | 3 // window. |
4 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 4 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
5 // Use of this source code is governed by a BSD-style license that can be | 5 // Use of this source code is governed by a BSD-style license that can be |
6 // found in the LICENSE file. | 6 // found in the LICENSE file. |
7 | 7 |
8 #include "chrome/browser/gpu_process_host_ui_shim.h" | 8 #include "chrome/browser/gpu_process_host_ui_shim.h" |
9 | 9 |
10 #include "base/id_map.h" | 10 #include "base/id_map.h" |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 | 409 |
410 // The GPU process should have launched at this point and this object should | 410 // The GPU process should have launched at this point and this object should |
411 // have been notified of its process handle. | 411 // have been notified of its process handle. |
412 DCHECK(gpu_process_); | 412 DCHECK(gpu_process_); |
413 | 413 |
414 linked_ptr<EstablishChannelCallback> callback = channel_requests_.front(); | 414 linked_ptr<EstablishChannelCallback> callback = channel_requests_.front(); |
415 channel_requests_.pop(); | 415 channel_requests_.pop(); |
416 | 416 |
417 // Currently if any of the GPU features are blacklisted, we don't establish a | 417 // Currently if any of the GPU features are blacklisted, we don't establish a |
418 // GPU channel. | 418 // GPU channel. |
419 if (channel_handle.name.size() != 0 && | 419 if (!channel_handle.name.empty() && |
420 gpu_data_manager_->GetGpuFeatureFlags().flags() != 0) { | 420 gpu_data_manager_->GetGpuFeatureFlags().flags() != 0) { |
421 Send(new GpuMsg_CloseChannel(channel_handle)); | 421 Send(new GpuMsg_CloseChannel(channel_handle)); |
422 EstablishChannelError(callback.release(), | 422 EstablishChannelError(callback.release(), |
423 IPC::ChannelHandle(), | 423 IPC::ChannelHandle(), |
424 NULL, | 424 NULL, |
425 gpu_info); | 425 gpu_info); |
426 AddCustomLogMessage(logging::LOG_WARNING, "WARNING", "GPU is blacklisted."); | 426 AddCustomLogMessage(logging::LOG_WARNING, "WARNING", "GPU is blacklisted."); |
427 return; | 427 return; |
428 } | 428 } |
429 | 429 |
430 callback->Run(channel_handle, gpu_process_, gpu_info); | 430 callback->Run(channel_handle, gpu_process_, gpu_info); |
431 } | 431 } |
432 | 432 |
433 void GpuProcessHostUIShim::OnSynchronizeReply() { | 433 void GpuProcessHostUIShim::OnSynchronizeReply() { |
434 // Guard against race conditions in abrupt GPU process termination. | 434 // Guard against race conditions in abrupt GPU process termination. |
435 if (synchronize_requests_.size() > 0) { | 435 if (!synchronize_requests_.empty()) { |
436 linked_ptr<SynchronizeCallback> callback(synchronize_requests_.front()); | 436 linked_ptr<SynchronizeCallback> callback(synchronize_requests_.front()); |
437 synchronize_requests_.pop(); | 437 synchronize_requests_.pop(); |
438 callback->Run(); | 438 callback->Run(); |
439 } | 439 } |
440 } | 440 } |
441 | 441 |
442 void GpuProcessHostUIShim::OnCommandBufferCreated(const int32 route_id) { | 442 void GpuProcessHostUIShim::OnCommandBufferCreated(const int32 route_id) { |
443 if (create_command_buffer_requests_.size() > 0) { | 443 if (!create_command_buffer_requests_.empty()) { |
444 linked_ptr<CreateCommandBufferCallback> callback = | 444 linked_ptr<CreateCommandBufferCallback> callback = |
445 create_command_buffer_requests_.front(); | 445 create_command_buffer_requests_.front(); |
446 create_command_buffer_requests_.pop(); | 446 create_command_buffer_requests_.pop(); |
447 if (route_id == MSG_ROUTING_NONE) | 447 if (route_id == MSG_ROUTING_NONE) |
448 CreateCommandBufferError(callback.release(), route_id); | 448 CreateCommandBufferError(callback.release(), route_id); |
449 else | 449 else |
450 callback->Run(route_id); | 450 callback->Run(route_id); |
451 } | 451 } |
452 } | 452 } |
453 | 453 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 RenderViewHost* host = RenderViewHost::FromID(renderer_id, | 541 RenderViewHost* host = RenderViewHost::FromID(renderer_id, |
542 render_view_id); | 542 render_view_id); |
543 if (!host) { | 543 if (!host) { |
544 return; | 544 return; |
545 } | 545 } |
546 host->ScheduleComposite(); | 546 host->ScheduleComposite(); |
547 } | 547 } |
548 | 548 |
549 #endif | 549 #endif |
550 | 550 |
OLD | NEW |