| 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 #include "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
| 9 #include "base/hash.h" | 9 #include "base/hash.h" |
| 10 #include "base/shared_memory.h" | 10 #include "base/shared_memory.h" |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 return scheduler_.get() && scheduler_->HasMoreWork(); | 236 return scheduler_.get() && scheduler_->HasMoreWork(); |
| 237 } | 237 } |
| 238 | 238 |
| 239 void GpuCommandBufferStub::PollWork() { | 239 void GpuCommandBufferStub::PollWork() { |
| 240 TRACE_EVENT0("gpu", "GpuCommandBufferStub::PollWork"); | 240 TRACE_EVENT0("gpu", "GpuCommandBufferStub::PollWork"); |
| 241 delayed_work_scheduled_ = false; | 241 delayed_work_scheduled_ = false; |
| 242 FastSetActiveURL(active_url_, active_url_hash_); | 242 FastSetActiveURL(active_url_, active_url_hash_); |
| 243 if (decoder_.get() && !MakeCurrent()) | 243 if (decoder_.get() && !MakeCurrent()) |
| 244 return; | 244 return; |
| 245 | 245 |
| 246 if (scheduler_.get()) { | 246 if (scheduler_) { |
| 247 bool fences_complete = scheduler_->PollUnscheduleFences(); | 247 bool fences_complete = scheduler_->PollUnscheduleFences(); |
| 248 // Perform idle work if all fences are complete. | 248 // Perform idle work if all fences are complete. |
| 249 if (fences_complete) { | 249 if (fences_complete) { |
| 250 uint64 current_messages_processed = | 250 uint64 current_messages_processed = |
| 251 channel()->gpu_channel_manager()->MessagesProcessed(); | 251 channel()->gpu_channel_manager()->MessagesProcessed(); |
| 252 // We're idle when no messages were processed or scheduled. | 252 // We're idle when no messages were processed or scheduled. |
| 253 bool is_idle = | 253 bool is_idle = |
| 254 (previous_messages_processed_ == current_messages_processed) && | 254 (previous_messages_processed_ == current_messages_processed) && |
| 255 !channel()->gpu_channel_manager()->HandleMessagesScheduled(); | 255 !channel()->gpu_channel_manager()->HandleMessagesScheduled(); |
| 256 if (!is_idle && !last_idle_time_.is_null()) { | 256 if (!is_idle && !last_idle_time_.is_null()) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 267 if (is_idle) { | 267 if (is_idle) { |
| 268 last_idle_time_ = base::TimeTicks::Now(); | 268 last_idle_time_ = base::TimeTicks::Now(); |
| 269 scheduler_->PerformIdleWork(); | 269 scheduler_->PerformIdleWork(); |
| 270 } | 270 } |
| 271 } | 271 } |
| 272 } | 272 } |
| 273 ScheduleDelayedWork(kHandleMoreWorkPeriodBusyMs); | 273 ScheduleDelayedWork(kHandleMoreWorkPeriodBusyMs); |
| 274 } | 274 } |
| 275 | 275 |
| 276 bool GpuCommandBufferStub::HasUnprocessedCommands() { | 276 bool GpuCommandBufferStub::HasUnprocessedCommands() { |
| 277 if (command_buffer_.get()) { | 277 if (command_buffer_) { |
| 278 gpu::CommandBuffer::State state = command_buffer_->GetLastState(); | 278 gpu::CommandBuffer::State state = command_buffer_->GetLastState(); |
| 279 return state.put_offset != state.get_offset && | 279 return state.put_offset != state.get_offset && |
| 280 !gpu::error::IsError(state.error); | 280 !gpu::error::IsError(state.error); |
| 281 } | 281 } |
| 282 return false; | 282 return false; |
| 283 } | 283 } |
| 284 | 284 |
| 285 void GpuCommandBufferStub::ScheduleDelayedWork(int64 delay) { | 285 void GpuCommandBufferStub::ScheduleDelayedWork(int64 delay) { |
| 286 if (!HasMoreWork()) { | 286 if (!HasMoreWork()) { |
| 287 last_idle_time_ = base::TimeTicks(); | 287 last_idle_time_ = base::TimeTicks(); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 GpuChannelManager* gpu_channel_manager = channel_->gpu_channel_manager(); | 339 GpuChannelManager* gpu_channel_manager = channel_->gpu_channel_manager(); |
| 340 gpu_channel_manager->Send(new GpuHostMsg_DidDestroyOffscreenContext( | 340 gpu_channel_manager->Send(new GpuHostMsg_DidDestroyOffscreenContext( |
| 341 active_url_)); | 341 active_url_)); |
| 342 } | 342 } |
| 343 | 343 |
| 344 memory_manager_client_state_.reset(); | 344 memory_manager_client_state_.reset(); |
| 345 | 345 |
| 346 while (!sync_points_.empty()) | 346 while (!sync_points_.empty()) |
| 347 OnRetireSyncPoint(sync_points_.front()); | 347 OnRetireSyncPoint(sync_points_.front()); |
| 348 | 348 |
| 349 if (decoder_.get()) | 349 if (decoder_) |
| 350 decoder_->set_engine(NULL); | 350 decoder_->set_engine(NULL); |
| 351 | 351 |
| 352 // The scheduler has raw references to the decoder and the command buffer so | 352 // The scheduler has raw references to the decoder and the command buffer so |
| 353 // destroy it before those. | 353 // destroy it before those. |
| 354 scheduler_.reset(); | 354 scheduler_.reset(); |
| 355 | 355 |
| 356 bool have_context = false; | 356 bool have_context = false; |
| 357 if (decoder_.get()) | 357 if (decoder_) |
| 358 have_context = decoder_->MakeCurrent(); | 358 have_context = decoder_->MakeCurrent(); |
| 359 FOR_EACH_OBSERVER(DestructionObserver, | 359 FOR_EACH_OBSERVER(DestructionObserver, |
| 360 destruction_observers_, | 360 destruction_observers_, |
| 361 OnWillDestroyStub(this)); | 361 OnWillDestroyStub(this)); |
| 362 | 362 |
| 363 scoped_refptr<gfx::GLContext> context; | 363 scoped_refptr<gfx::GLContext> context; |
| 364 if (decoder_.get()) { | 364 if (decoder_) { |
| 365 context = decoder_->GetGLContext(); | 365 context = decoder_->GetGLContext(); |
| 366 decoder_->Destroy(have_context); | 366 decoder_->Destroy(have_context); |
| 367 decoder_.reset(); | 367 decoder_.reset(); |
| 368 } | 368 } |
| 369 | 369 |
| 370 command_buffer_.reset(); | 370 command_buffer_.reset(); |
| 371 | 371 |
| 372 // Make sure that context_ is current while we destroy surface_, because | 372 // Make sure that context_ is current while we destroy surface_, because |
| 373 // surface_ may have GL resources that it needs to destroy, and will need | 373 // surface_ may have GL resources that it needs to destroy, and will need |
| 374 // context_ to be current in order to not leak these resources. | 374 // context_ to be current in order to not leak these resources. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 401 DLOG(ERROR) << "CommandBufferService failed to initialize.\n"; | 401 DLOG(ERROR) << "CommandBufferService failed to initialize.\n"; |
| 402 OnInitializeFailed(reply_message); | 402 OnInitializeFailed(reply_message); |
| 403 return; | 403 return; |
| 404 } | 404 } |
| 405 | 405 |
| 406 decoder_.reset(::gpu::gles2::GLES2Decoder::Create(context_group_.get())); | 406 decoder_.reset(::gpu::gles2::GLES2Decoder::Create(context_group_.get())); |
| 407 | 407 |
| 408 scheduler_.reset(new gpu::GpuScheduler(command_buffer_.get(), | 408 scheduler_.reset(new gpu::GpuScheduler(command_buffer_.get(), |
| 409 decoder_.get(), | 409 decoder_.get(), |
| 410 decoder_.get())); | 410 decoder_.get())); |
| 411 if (preemption_flag_.get()) | 411 if (preemption_flag_) |
| 412 scheduler_->SetPreemptByFlag(preemption_flag_); | 412 scheduler_->SetPreemptByFlag(preemption_flag_); |
| 413 | 413 |
| 414 decoder_->set_engine(scheduler_.get()); | 414 decoder_->set_engine(scheduler_.get()); |
| 415 | 415 |
| 416 if (!handle_.is_null()) { | 416 if (!handle_.is_null()) { |
| 417 #if defined(OS_MACOSX) || defined(UI_COMPOSITOR_IMAGE_TRANSPORT) | 417 #if defined(OS_MACOSX) || defined(UI_COMPOSITOR_IMAGE_TRANSPORT) |
| 418 if (software_) { | 418 if (software_) { |
| 419 DLOG(ERROR) << "No software support.\n"; | 419 DLOG(ERROR) << "No software support.\n"; |
| 420 OnInitializeFailed(reply_message); | 420 OnInitializeFailed(reply_message); |
| 421 return; | 421 return; |
| 422 } | 422 } |
| 423 #endif | 423 #endif |
| 424 | 424 |
| 425 surface_ = ImageTransportSurface::CreateSurface( | 425 surface_ = ImageTransportSurface::CreateSurface( |
| 426 channel_->gpu_channel_manager(), | 426 channel_->gpu_channel_manager(), |
| 427 this, | 427 this, |
| 428 handle_); | 428 handle_); |
| 429 } else { | 429 } else { |
| 430 GpuChannelManager* manager = channel_->gpu_channel_manager(); | 430 GpuChannelManager* manager = channel_->gpu_channel_manager(); |
| 431 surface_ = manager->GetDefaultOffscreenSurface(); | 431 surface_ = manager->GetDefaultOffscreenSurface(); |
| 432 } | 432 } |
| 433 | 433 |
| 434 if (!surface_.get()) { | 434 if (!surface_) { |
| 435 DLOG(ERROR) << "Failed to create surface.\n"; | 435 DLOG(ERROR) << "Failed to create surface.\n"; |
| 436 OnInitializeFailed(reply_message); | 436 OnInitializeFailed(reply_message); |
| 437 return; | 437 return; |
| 438 } | 438 } |
| 439 | 439 |
| 440 scoped_refptr<gfx::GLContext> context; | 440 scoped_refptr<gfx::GLContext> context; |
| 441 if ((CommandLine::ForCurrentProcess()->HasSwitch( | 441 if ((CommandLine::ForCurrentProcess()->HasSwitch( |
| 442 switches::kEnableVirtualGLContexts) || use_virtualized_gl_context_) && | 442 switches::kEnableVirtualGLContexts) || use_virtualized_gl_context_) && |
| 443 channel_->share_group()) { | 443 channel_->share_group()) { |
| 444 context = channel_->share_group()->GetSharedContext(); | 444 context = channel_->share_group()->GetSharedContext(); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 473 channel_->share_group(), | 473 channel_->share_group(), |
| 474 surface_.get(), | 474 surface_.get(), |
| 475 gpu_preference_); | 475 gpu_preference_); |
| 476 } | 476 } |
| 477 if (!context) { | 477 if (!context) { |
| 478 DLOG(ERROR) << "Failed to create context.\n"; | 478 DLOG(ERROR) << "Failed to create context.\n"; |
| 479 OnInitializeFailed(reply_message); | 479 OnInitializeFailed(reply_message); |
| 480 return; | 480 return; |
| 481 } | 481 } |
| 482 | 482 |
| 483 if (!context->MakeCurrent(surface_.get())) { | 483 if (!context->MakeCurrent(surface_)) { |
| 484 LOG(ERROR) << "Failed to make context current."; | 484 LOG(ERROR) << "Failed to make context current."; |
| 485 OnInitializeFailed(reply_message); | 485 OnInitializeFailed(reply_message); |
| 486 return; | 486 return; |
| 487 } | 487 } |
| 488 | 488 |
| 489 if (!context->GetTotalGpuMemory(&total_gpu_memory_)) | 489 if (!context->GetTotalGpuMemory(&total_gpu_memory_)) |
| 490 total_gpu_memory_ = 0; | 490 total_gpu_memory_ = 0; |
| 491 | 491 |
| 492 if (!context_group_->has_program_cache()) { | 492 if (!context_group_->has_program_cache()) { |
| 493 context_group_->set_program_cache( | 493 context_group_->set_program_cache( |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 573 } | 573 } |
| 574 | 574 |
| 575 void GpuCommandBufferStub::SetLatencyInfoCallback( | 575 void GpuCommandBufferStub::SetLatencyInfoCallback( |
| 576 const LatencyInfoCallback& callback) { | 576 const LatencyInfoCallback& callback) { |
| 577 latency_info_callback_ = callback; | 577 latency_info_callback_ = callback; |
| 578 } | 578 } |
| 579 | 579 |
| 580 void GpuCommandBufferStub::OnSetGetBuffer(int32 shm_id, | 580 void GpuCommandBufferStub::OnSetGetBuffer(int32 shm_id, |
| 581 IPC::Message* reply_message) { | 581 IPC::Message* reply_message) { |
| 582 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnSetGetBuffer"); | 582 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnSetGetBuffer"); |
| 583 if (command_buffer_.get()) | 583 if (command_buffer_) |
| 584 command_buffer_->SetGetBuffer(shm_id); | 584 command_buffer_->SetGetBuffer(shm_id); |
| 585 Send(reply_message); | 585 Send(reply_message); |
| 586 } | 586 } |
| 587 | 587 |
| 588 void GpuCommandBufferStub::OnSetParent(int32 parent_route_id, | 588 void GpuCommandBufferStub::OnSetParent(int32 parent_route_id, |
| 589 uint32 parent_texture_id, | 589 uint32 parent_texture_id, |
| 590 IPC::Message* reply_message) { | 590 IPC::Message* reply_message) { |
| 591 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnSetParent"); | 591 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnSetParent"); |
| 592 GpuCommandBufferStub* parent_stub = NULL; | 592 GpuCommandBufferStub* parent_stub = NULL; |
| 593 if (parent_route_id != MSG_ROUTING_NONE) { | 593 if (parent_route_id != MSG_ROUTING_NONE) { |
| 594 parent_stub = channel_->LookupCommandBuffer(parent_route_id); | 594 parent_stub = channel_->LookupCommandBuffer(parent_route_id); |
| 595 } | 595 } |
| 596 | 596 |
| 597 bool result = true; | 597 bool result = true; |
| 598 if (scheduler_.get()) { | 598 if (scheduler_) { |
| 599 gpu::gles2::GLES2Decoder* parent_decoder = | 599 gpu::gles2::GLES2Decoder* parent_decoder = |
| 600 parent_stub ? parent_stub->decoder_.get() : NULL; | 600 parent_stub ? parent_stub->decoder_.get() : NULL; |
| 601 result = decoder_->SetParent(parent_decoder, parent_texture_id); | 601 result = decoder_->SetParent(parent_decoder, parent_texture_id); |
| 602 } else { | 602 } else { |
| 603 // If we don't have a scheduler, it means that Initialize hasn't been called | 603 // If we don't have a scheduler, it means that Initialize hasn't been called |
| 604 // yet. Keep around the requested parent stub and texture so that we can set | 604 // yet. Keep around the requested parent stub and texture so that we can set |
| 605 // it in Initialize(). | 605 // it in Initialize(). |
| 606 parent_stub_for_initialization_ = parent_stub ? | 606 parent_stub_for_initialization_ = parent_stub ? |
| 607 parent_stub->AsWeakPtr() : base::WeakPtr<GpuCommandBufferStub>(); | 607 parent_stub->AsWeakPtr() : base::WeakPtr<GpuCommandBufferStub>(); |
| 608 parent_texture_for_initialization_ = parent_texture_id; | 608 parent_texture_for_initialization_ = parent_texture_id; |
| 609 } | 609 } |
| 610 GpuCommandBufferMsg_SetParent::WriteReplyParams(reply_message, result); | 610 GpuCommandBufferMsg_SetParent::WriteReplyParams(reply_message, result); |
| 611 Send(reply_message); | 611 Send(reply_message); |
| 612 } | 612 } |
| 613 | 613 |
| 614 void GpuCommandBufferStub::OnGetState(IPC::Message* reply_message) { | 614 void GpuCommandBufferStub::OnGetState(IPC::Message* reply_message) { |
| 615 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnGetState"); | 615 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnGetState"); |
| 616 if (command_buffer_.get()) { | 616 if (command_buffer_) { |
| 617 gpu::CommandBuffer::State state = command_buffer_->GetState(); | 617 gpu::CommandBuffer::State state = command_buffer_->GetState(); |
| 618 if (state.error == gpu::error::kLostContext && | 618 if (state.error == gpu::error::kLostContext && |
| 619 gfx::GLContext::LosesAllContextsOnContextLost()) | 619 gfx::GLContext::LosesAllContextsOnContextLost()) |
| 620 channel_->LoseAllContexts(); | 620 channel_->LoseAllContexts(); |
| 621 | 621 |
| 622 GpuCommandBufferMsg_GetState::WriteReplyParams(reply_message, state); | 622 GpuCommandBufferMsg_GetState::WriteReplyParams(reply_message, state); |
| 623 } else { | 623 } else { |
| 624 DLOG(ERROR) << "no command_buffer."; | 624 DLOG(ERROR) << "no command_buffer."; |
| 625 reply_message->set_reply_error(); | 625 reply_message->set_reply_error(); |
| 626 } | 626 } |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 682 ReportState(); | 682 ReportState(); |
| 683 } | 683 } |
| 684 | 684 |
| 685 void GpuCommandBufferStub::OnRegisterTransferBuffer( | 685 void GpuCommandBufferStub::OnRegisterTransferBuffer( |
| 686 int32 id, | 686 int32 id, |
| 687 base::SharedMemoryHandle transfer_buffer, | 687 base::SharedMemoryHandle transfer_buffer, |
| 688 uint32 size) { | 688 uint32 size) { |
| 689 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnRegisterTransferBuffer"); | 689 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnRegisterTransferBuffer"); |
| 690 base::SharedMemory shared_memory(transfer_buffer, false); | 690 base::SharedMemory shared_memory(transfer_buffer, false); |
| 691 | 691 |
| 692 if (command_buffer_.get()) | 692 if (command_buffer_) |
| 693 command_buffer_->RegisterTransferBuffer(id, &shared_memory, size); | 693 command_buffer_->RegisterTransferBuffer(id, &shared_memory, size); |
| 694 } | 694 } |
| 695 | 695 |
| 696 void GpuCommandBufferStub::OnDestroyTransferBuffer(int32 id) { | 696 void GpuCommandBufferStub::OnDestroyTransferBuffer(int32 id) { |
| 697 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnDestroyTransferBuffer"); | 697 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnDestroyTransferBuffer"); |
| 698 | 698 |
| 699 if (command_buffer_.get()) | 699 if (command_buffer_) |
| 700 command_buffer_->DestroyTransferBuffer(id); | 700 command_buffer_->DestroyTransferBuffer(id); |
| 701 } | 701 } |
| 702 | 702 |
| 703 void GpuCommandBufferStub::OnGetTransferBuffer( | 703 void GpuCommandBufferStub::OnGetTransferBuffer( |
| 704 int32 id, | 704 int32 id, |
| 705 IPC::Message* reply_message) { | 705 IPC::Message* reply_message) { |
| 706 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnGetTransferBuffer"); | 706 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnGetTransferBuffer"); |
| 707 if (command_buffer_.get()) { | 707 if (command_buffer_) { |
| 708 base::SharedMemoryHandle transfer_buffer = base::SharedMemoryHandle(); | 708 base::SharedMemoryHandle transfer_buffer = base::SharedMemoryHandle(); |
| 709 uint32 size = 0; | 709 uint32 size = 0; |
| 710 | 710 |
| 711 gpu::Buffer buffer = command_buffer_->GetTransferBuffer(id); | 711 gpu::Buffer buffer = command_buffer_->GetTransferBuffer(id); |
| 712 if (buffer.shared_memory) { | 712 if (buffer.shared_memory) { |
| 713 #if defined(OS_WIN) | 713 #if defined(OS_WIN) |
| 714 transfer_buffer = NULL; | 714 transfer_buffer = NULL; |
| 715 BrokerDuplicateHandle(buffer.shared_memory->handle(), | 715 BrokerDuplicateHandle(buffer.shared_memory->handle(), |
| 716 channel_->renderer_pid(), &transfer_buffer, FILE_MAP_READ | | 716 channel_->renderer_pid(), &transfer_buffer, FILE_MAP_READ | |
| 717 FILE_MAP_WRITE, 0); | 717 FILE_MAP_WRITE, 0); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 758 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnCreateVideoDecoder"); | 758 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnCreateVideoDecoder"); |
| 759 int decoder_route_id = channel_->GenerateRouteID(); | 759 int decoder_route_id = channel_->GenerateRouteID(); |
| 760 GpuVideoDecodeAccelerator* decoder = | 760 GpuVideoDecodeAccelerator* decoder = |
| 761 new GpuVideoDecodeAccelerator(decoder_route_id, this); | 761 new GpuVideoDecodeAccelerator(decoder_route_id, this); |
| 762 video_decoders_.push_back(decoder); | 762 video_decoders_.push_back(decoder); |
| 763 decoder->Initialize(profile, reply_message); | 763 decoder->Initialize(profile, reply_message); |
| 764 } | 764 } |
| 765 | 765 |
| 766 void GpuCommandBufferStub::OnSetSurfaceVisible(bool visible) { | 766 void GpuCommandBufferStub::OnSetSurfaceVisible(bool visible) { |
| 767 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnSetSurfaceVisible"); | 767 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnSetSurfaceVisible"); |
| 768 if (memory_manager_client_state_.get()) | 768 if (memory_manager_client_state_) |
| 769 memory_manager_client_state_->SetVisible(visible); | 769 memory_manager_client_state_->SetVisible(visible); |
| 770 } | 770 } |
| 771 | 771 |
| 772 void GpuCommandBufferStub::OnDiscardBackbuffer() { | 772 void GpuCommandBufferStub::OnDiscardBackbuffer() { |
| 773 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnDiscardBackbuffer"); | 773 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnDiscardBackbuffer"); |
| 774 if (!surface_) | 774 if (!surface_) |
| 775 return; | 775 return; |
| 776 if (surface_->DeferDraws()) { | 776 if (surface_->DeferDraws()) { |
| 777 DCHECK(!IsScheduled()); | 777 DCHECK(!IsScheduled()); |
| 778 channel_->RequeueMessage(); | 778 channel_->RequeueMessage(); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 841 | 841 |
| 842 void GpuCommandBufferStub::OnSignalSyncPointAck(uint32 id) { | 842 void GpuCommandBufferStub::OnSignalSyncPointAck(uint32 id) { |
| 843 Send(new GpuCommandBufferMsg_SignalSyncPointAck(route_id_, id)); | 843 Send(new GpuCommandBufferMsg_SignalSyncPointAck(route_id_, id)); |
| 844 } | 844 } |
| 845 | 845 |
| 846 void GpuCommandBufferStub::OnReceivedClientManagedMemoryStats( | 846 void GpuCommandBufferStub::OnReceivedClientManagedMemoryStats( |
| 847 const GpuManagedMemoryStats& stats) { | 847 const GpuManagedMemoryStats& stats) { |
| 848 TRACE_EVENT0( | 848 TRACE_EVENT0( |
| 849 "gpu", | 849 "gpu", |
| 850 "GpuCommandBufferStub::OnReceivedClientManagedMemoryStats"); | 850 "GpuCommandBufferStub::OnReceivedClientManagedMemoryStats"); |
| 851 if (memory_manager_client_state_.get()) | 851 if (memory_manager_client_state_) |
| 852 memory_manager_client_state_->SetManagedMemoryStats(stats); | 852 memory_manager_client_state_->SetManagedMemoryStats(stats); |
| 853 } | 853 } |
| 854 | 854 |
| 855 void GpuCommandBufferStub::OnSetClientHasMemoryAllocationChangedCallback( | 855 void GpuCommandBufferStub::OnSetClientHasMemoryAllocationChangedCallback( |
| 856 bool has_callback) { | 856 bool has_callback) { |
| 857 TRACE_EVENT0( | 857 TRACE_EVENT0( |
| 858 "gpu", | 858 "gpu", |
| 859 "GpuCommandBufferStub::OnSetClientHasMemoryAllocationChangedCallback"); | 859 "GpuCommandBufferStub::OnSetClientHasMemoryAllocationChangedCallback"); |
| 860 if (has_callback) { | 860 if (has_callback) { |
| 861 if (!memory_manager_client_state_.get()) { | 861 if (!memory_manager_client_state_) { |
| 862 memory_manager_client_state_.reset(GetMemoryManager()->CreateClientState( | 862 memory_manager_client_state_.reset(GetMemoryManager()->CreateClientState( |
| 863 this, surface_id_ != 0, true)); | 863 this, surface_id_ != 0, true)); |
| 864 } | 864 } |
| 865 } else { | 865 } else { |
| 866 memory_manager_client_state_.reset(); | 866 memory_manager_client_state_.reset(); |
| 867 } | 867 } |
| 868 } | 868 } |
| 869 | 869 |
| 870 void GpuCommandBufferStub::SendConsoleMessage( | 870 void GpuCommandBufferStub::SendConsoleMessage( |
| 871 int32 id, | 871 int32 id, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 890 } | 890 } |
| 891 | 891 |
| 892 void GpuCommandBufferStub::RemoveDestructionObserver( | 892 void GpuCommandBufferStub::RemoveDestructionObserver( |
| 893 DestructionObserver* observer) { | 893 DestructionObserver* observer) { |
| 894 destruction_observers_.RemoveObserver(observer); | 894 destruction_observers_.RemoveObserver(observer); |
| 895 } | 895 } |
| 896 | 896 |
| 897 void GpuCommandBufferStub::SetPreemptByFlag( | 897 void GpuCommandBufferStub::SetPreemptByFlag( |
| 898 scoped_refptr<gpu::PreemptionFlag> flag) { | 898 scoped_refptr<gpu::PreemptionFlag> flag) { |
| 899 preemption_flag_ = flag; | 899 preemption_flag_ = flag; |
| 900 if (scheduler_.get()) | 900 if (scheduler_) |
| 901 scheduler_->SetPreemptByFlag(preemption_flag_); | 901 scheduler_->SetPreemptByFlag(preemption_flag_); |
| 902 } | 902 } |
| 903 | 903 |
| 904 bool GpuCommandBufferStub::GetTotalGpuMemory(uint64* bytes) { | 904 bool GpuCommandBufferStub::GetTotalGpuMemory(uint64* bytes) { |
| 905 *bytes = total_gpu_memory_; | 905 *bytes = total_gpu_memory_; |
| 906 return !!total_gpu_memory_; | 906 return !!total_gpu_memory_; |
| 907 } | 907 } |
| 908 | 908 |
| 909 gfx::Size GpuCommandBufferStub::GetSurfaceSize() const { | 909 gfx::Size GpuCommandBufferStub::GetSurfaceSize() const { |
| 910 if (!surface_) | 910 if (!surface_) |
| (...skipping 22 matching lines...) Expand all Loading... |
| 933 if (surface_ && MakeCurrent()) | 933 if (surface_ && MakeCurrent()) |
| 934 surface_->SetFrontbufferAllocation( | 934 surface_->SetFrontbufferAllocation( |
| 935 allocation.browser_allocation.suggest_have_frontbuffer); | 935 allocation.browser_allocation.suggest_have_frontbuffer); |
| 936 } | 936 } |
| 937 | 937 |
| 938 last_memory_allocation_valid_ = true; | 938 last_memory_allocation_valid_ = true; |
| 939 last_memory_allocation_ = allocation; | 939 last_memory_allocation_ = allocation; |
| 940 } | 940 } |
| 941 | 941 |
| 942 } // namespace content | 942 } // namespace content |
| OLD | NEW |