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

Side by Side Diff: content/common/gpu/gpu_command_buffer_stub.cc

Issue 1711533002: Decouple browser-specific GPU IPC messages from GPU service IPCs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added a couple of missings sends in GpuChildThread Created 4 years, 10 months 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
OLDNEW
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 "content/common/gpu/gpu_command_buffer_stub.h" 5 #include "content/common/gpu/gpu_command_buffer_stub.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/hash.h" 12 #include "base/hash.h"
13 #include "base/json/json_writer.h" 13 #include "base/json/json_writer.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/memory/shared_memory.h" 15 #include "base/memory/shared_memory.h"
16 #include "base/time/time.h" 16 #include "base/time/time.h"
17 #include "base/trace_event/trace_event.h" 17 #include "base/trace_event/trace_event.h"
18 #include "build/build_config.h" 18 #include "build/build_config.h"
19 #include "content/common/gpu/gpu_channel.h" 19 #include "content/common/gpu/gpu_channel.h"
20 #include "content/common/gpu/gpu_channel_manager.h" 20 #include "content/common/gpu/gpu_channel_manager.h"
21 #include "content/common/gpu/gpu_channel_manager_delegate.h"
21 #include "content/common/gpu/gpu_memory_manager.h" 22 #include "content/common/gpu/gpu_memory_manager.h"
22 #include "content/common/gpu/gpu_memory_tracking.h" 23 #include "content/common/gpu/gpu_memory_tracking.h"
23 #include "content/common/gpu/gpu_messages.h" 24 #include "content/common/gpu/gpu_messages.h"
24 #include "content/common/gpu/gpu_watchdog.h" 25 #include "content/common/gpu/gpu_watchdog.h"
25 #include "content/common/gpu/image_transport_surface.h" 26 #include "content/common/gpu/image_transport_surface.h"
26 #include "content/common/gpu/media/gpu_video_decode_accelerator.h" 27 #include "content/common/gpu/media/gpu_video_decode_accelerator.h"
27 #include "content/common/gpu/media/gpu_video_encode_accelerator.h" 28 #include "content/common/gpu/media/gpu_video_encode_accelerator.h"
28 #include "content/public/common/content_client.h" 29 #include "content/public/common/content_client.h"
29 #include "content/public/common/content_switches.h" 30 #include "content/public/common/content_switches.h"
30 #include "gpu/command_buffer/common/constants.h" 31 #include "gpu/command_buffer/common/constants.h"
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 Send(wait_for_token_->reply.release()); 464 Send(wait_for_token_->reply.release());
464 wait_for_token_.reset(); 465 wait_for_token_.reset();
465 } 466 }
466 if (wait_for_get_offset_) { 467 if (wait_for_get_offset_) {
467 Send(wait_for_get_offset_->reply.release()); 468 Send(wait_for_get_offset_->reply.release());
468 wait_for_get_offset_.reset(); 469 wait_for_get_offset_.reset();
469 } 470 }
470 471
471 if (initialized_) { 472 if (initialized_) {
472 GpuChannelManager* gpu_channel_manager = channel_->gpu_channel_manager(); 473 GpuChannelManager* gpu_channel_manager = channel_->gpu_channel_manager();
473 if (handle_.is_null() && !active_url_.is_empty()) { 474 if (handle_.is_null() && !active_url_.is_empty())
474 gpu_channel_manager->Send( 475 gpu_channel_manager->delegate()->DidDestroyOffscreenContext(active_url_);
475 new GpuHostMsg_DidDestroyOffscreenContext(active_url_));
476 }
477 } 476 }
478 477
479 if (decoder_) 478 if (decoder_)
480 decoder_->set_engine(NULL); 479 decoder_->set_engine(NULL);
481 480
482 // The scheduler has raw references to the decoder and the command buffer so 481 // The scheduler has raw references to the decoder and the command buffer so
483 // destroy it before those. 482 // destroy it before those.
484 scheduler_.reset(); 483 scheduler_.reset();
485 484
486 sync_point_client_.reset(); 485 sync_point_client_.reset();
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 } 665 }
667 command_buffer_->SetSharedStateBuffer(gpu::MakeBackingFromSharedMemory( 666 command_buffer_->SetSharedStateBuffer(gpu::MakeBackingFromSharedMemory(
668 std::move(shared_state_shm), kSharedStateSize)); 667 std::move(shared_state_shm), kSharedStateSize));
669 668
670 gpu::Capabilities capabilities = decoder_->GetCapabilities(); 669 gpu::Capabilities capabilities = decoder_->GetCapabilities();
671 670
672 GpuCommandBufferMsg_Initialize::WriteReplyParams( 671 GpuCommandBufferMsg_Initialize::WriteReplyParams(
673 reply_message, true, capabilities); 672 reply_message, true, capabilities);
674 Send(reply_message); 673 Send(reply_message);
675 674
676 if (handle_.is_null() && !active_url_.is_empty()) { 675 if (handle_.is_null() && !active_url_.is_empty())
677 manager->Send(new GpuHostMsg_DidCreateOffscreenContext( 676 manager->delegate()->DidCreateOffscreenContext(active_url_);
678 active_url_));
679 }
680 677
681 initialized_ = true; 678 initialized_ = true;
682 } 679 }
683 680
684 void GpuCommandBufferStub::OnCreateStreamTexture(uint32_t texture_id, 681 void GpuCommandBufferStub::OnCreateStreamTexture(uint32_t texture_id,
685 int32_t stream_id, 682 int32_t stream_id,
686 bool* succeeded) { 683 bool* succeeded) {
687 #if defined(OS_ANDROID) 684 #if defined(OS_ANDROID)
688 *succeeded = StreamTexture::Create(this, texture_id, stream_id); 685 *succeeded = StreamTexture::Create(this, texture_id, stream_id);
689 #else 686 #else
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
732 gpu::CommandBuffer::State state = command_buffer_->GetLastState(); 729 gpu::CommandBuffer::State state = command_buffer_->GetLastState();
733 IPC::Message* msg = new GpuCommandBufferMsg_Destroyed( 730 IPC::Message* msg = new GpuCommandBufferMsg_Destroyed(
734 route_id_, state.context_lost_reason, state.error); 731 route_id_, state.context_lost_reason, state.error);
735 msg->set_unblock(true); 732 msg->set_unblock(true);
736 Send(msg); 733 Send(msg);
737 734
738 // Tell the browser about this context loss as well, so it can 735 // Tell the browser about this context loss as well, so it can
739 // determine whether client APIs like WebGL need to be immediately 736 // determine whether client APIs like WebGL need to be immediately
740 // blocked from automatically running. 737 // blocked from automatically running.
741 GpuChannelManager* gpu_channel_manager = channel_->gpu_channel_manager(); 738 GpuChannelManager* gpu_channel_manager = channel_->gpu_channel_manager();
742 gpu_channel_manager->Send(new GpuHostMsg_DidLoseContext( 739 gpu_channel_manager->delegate()->DidLoseContext(
743 handle_.is_null(), state.context_lost_reason, active_url_)); 740 handle_.is_null(), state.context_lost_reason, active_url_);
744 741
745 CheckContextLost(); 742 CheckContextLost();
746 } 743 }
747 744
748 void GpuCommandBufferStub::OnSchedulingChanged(bool scheduled) { 745 void GpuCommandBufferStub::OnSchedulingChanged(bool scheduled) {
749 TRACE_EVENT1("gpu", "GpuCommandBufferStub::OnSchedulingChanged", "scheduled", 746 TRACE_EVENT1("gpu", "GpuCommandBufferStub::OnSchedulingChanged", "scheduled",
750 scheduled); 747 scheduled);
751 channel_->OnStubSchedulingChanged(this, scheduled); 748 channel_->OnStubSchedulingChanged(this, scheduled);
752 } 749 }
753 750
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
1178 result)); 1175 result));
1179 } 1176 }
1180 1177
1181 void GpuCommandBufferStub::SendUpdateVSyncParameters(base::TimeTicks timebase, 1178 void GpuCommandBufferStub::SendUpdateVSyncParameters(base::TimeTicks timebase,
1182 base::TimeDelta interval) { 1179 base::TimeDelta interval) {
1183 Send(new GpuCommandBufferMsg_UpdateVSyncParameters(route_id_, timebase, 1180 Send(new GpuCommandBufferMsg_UpdateVSyncParameters(route_id_, timebase,
1184 interval)); 1181 interval));
1185 } 1182 }
1186 1183
1187 } // namespace content 1184 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698