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

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

Issue 1730023004: Revert of Decouple browser-specific GPU IPC messages from GPU service IPCs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « content/common/gpu/gpu_channel_unittest.cc ('k') | content/common/gpu/gpu_host_messages.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
22 #include "content/common/gpu/gpu_memory_manager.h" 21 #include "content/common/gpu/gpu_memory_manager.h"
23 #include "content/common/gpu/gpu_memory_tracking.h" 22 #include "content/common/gpu/gpu_memory_tracking.h"
24 #include "content/common/gpu/gpu_messages.h" 23 #include "content/common/gpu/gpu_messages.h"
25 #include "content/common/gpu/gpu_watchdog.h" 24 #include "content/common/gpu/gpu_watchdog.h"
26 #include "content/common/gpu/image_transport_surface.h" 25 #include "content/common/gpu/image_transport_surface.h"
27 #include "content/common/gpu/media/gpu_video_decode_accelerator.h" 26 #include "content/common/gpu/media/gpu_video_decode_accelerator.h"
28 #include "content/common/gpu/media/gpu_video_encode_accelerator.h" 27 #include "content/common/gpu/media/gpu_video_encode_accelerator.h"
29 #include "content/public/common/content_client.h" 28 #include "content/public/common/content_client.h"
30 #include "content/public/common/content_switches.h" 29 #include "content/public/common/content_switches.h"
31 #include "gpu/command_buffer/common/constants.h" 30 #include "gpu/command_buffer/common/constants.h"
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 Send(wait_for_token_->reply.release()); 460 Send(wait_for_token_->reply.release());
462 wait_for_token_.reset(); 461 wait_for_token_.reset();
463 } 462 }
464 if (wait_for_get_offset_) { 463 if (wait_for_get_offset_) {
465 Send(wait_for_get_offset_->reply.release()); 464 Send(wait_for_get_offset_->reply.release());
466 wait_for_get_offset_.reset(); 465 wait_for_get_offset_.reset();
467 } 466 }
468 467
469 if (initialized_) { 468 if (initialized_) {
470 GpuChannelManager* gpu_channel_manager = channel_->gpu_channel_manager(); 469 GpuChannelManager* gpu_channel_manager = channel_->gpu_channel_manager();
471 if (handle_.is_null() && !active_url_.is_empty()) 470 if (handle_.is_null() && !active_url_.is_empty()) {
472 gpu_channel_manager->delegate()->DidDestroyOffscreenContext(active_url_); 471 gpu_channel_manager->Send(
472 new GpuHostMsg_DidDestroyOffscreenContext(active_url_));
473 }
473 } 474 }
474 475
475 if (decoder_) 476 if (decoder_)
476 decoder_->set_engine(NULL); 477 decoder_->set_engine(NULL);
477 478
478 // The scheduler has raw references to the decoder and the command buffer so 479 // The scheduler has raw references to the decoder and the command buffer so
479 // destroy it before those. 480 // destroy it before those.
480 scheduler_.reset(); 481 scheduler_.reset();
481 482
482 sync_point_client_.reset(); 483 sync_point_client_.reset();
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 } 662 }
662 command_buffer_->SetSharedStateBuffer(gpu::MakeBackingFromSharedMemory( 663 command_buffer_->SetSharedStateBuffer(gpu::MakeBackingFromSharedMemory(
663 std::move(shared_state_shm), kSharedStateSize)); 664 std::move(shared_state_shm), kSharedStateSize));
664 665
665 gpu::Capabilities capabilities = decoder_->GetCapabilities(); 666 gpu::Capabilities capabilities = decoder_->GetCapabilities();
666 667
667 GpuCommandBufferMsg_Initialize::WriteReplyParams( 668 GpuCommandBufferMsg_Initialize::WriteReplyParams(
668 reply_message, true, capabilities); 669 reply_message, true, capabilities);
669 Send(reply_message); 670 Send(reply_message);
670 671
671 if (handle_.is_null() && !active_url_.is_empty()) 672 if (handle_.is_null() && !active_url_.is_empty()) {
672 manager->delegate()->DidCreateOffscreenContext(active_url_); 673 manager->Send(new GpuHostMsg_DidCreateOffscreenContext(
674 active_url_));
675 }
673 676
674 initialized_ = true; 677 initialized_ = true;
675 } 678 }
676 679
677 void GpuCommandBufferStub::OnCreateStreamTexture(uint32_t texture_id, 680 void GpuCommandBufferStub::OnCreateStreamTexture(uint32_t texture_id,
678 int32_t stream_id, 681 int32_t stream_id,
679 bool* succeeded) { 682 bool* succeeded) {
680 #if defined(OS_ANDROID) 683 #if defined(OS_ANDROID)
681 *succeeded = StreamTexture::Create(this, texture_id, stream_id); 684 *succeeded = StreamTexture::Create(this, texture_id, stream_id);
682 #else 685 #else
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
725 gpu::CommandBuffer::State state = command_buffer_->GetLastState(); 728 gpu::CommandBuffer::State state = command_buffer_->GetLastState();
726 IPC::Message* msg = new GpuCommandBufferMsg_Destroyed( 729 IPC::Message* msg = new GpuCommandBufferMsg_Destroyed(
727 route_id_, state.context_lost_reason, state.error); 730 route_id_, state.context_lost_reason, state.error);
728 msg->set_unblock(true); 731 msg->set_unblock(true);
729 Send(msg); 732 Send(msg);
730 733
731 // Tell the browser about this context loss as well, so it can 734 // Tell the browser about this context loss as well, so it can
732 // determine whether client APIs like WebGL need to be immediately 735 // determine whether client APIs like WebGL need to be immediately
733 // blocked from automatically running. 736 // blocked from automatically running.
734 GpuChannelManager* gpu_channel_manager = channel_->gpu_channel_manager(); 737 GpuChannelManager* gpu_channel_manager = channel_->gpu_channel_manager();
735 gpu_channel_manager->delegate()->DidLoseContext( 738 gpu_channel_manager->Send(new GpuHostMsg_DidLoseContext(
736 handle_.is_null(), state.context_lost_reason, active_url_); 739 handle_.is_null(), state.context_lost_reason, active_url_));
737 740
738 CheckContextLost(); 741 CheckContextLost();
739 } 742 }
740 743
741 void GpuCommandBufferStub::OnSchedulingChanged(bool scheduled) { 744 void GpuCommandBufferStub::OnSchedulingChanged(bool scheduled) {
742 TRACE_EVENT1("gpu", "GpuCommandBufferStub::OnSchedulingChanged", "scheduled", 745 TRACE_EVENT1("gpu", "GpuCommandBufferStub::OnSchedulingChanged", "scheduled",
743 scheduled); 746 scheduled);
744 channel_->OnStreamRescheduled(stream_id_, scheduled); 747 channel_->OnStreamRescheduled(stream_id_, scheduled);
745 } 748 }
746 749
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
1171 result)); 1174 result));
1172 } 1175 }
1173 1176
1174 void GpuCommandBufferStub::SendUpdateVSyncParameters(base::TimeTicks timebase, 1177 void GpuCommandBufferStub::SendUpdateVSyncParameters(base::TimeTicks timebase,
1175 base::TimeDelta interval) { 1178 base::TimeDelta interval) {
1176 Send(new GpuCommandBufferMsg_UpdateVSyncParameters(route_id_, timebase, 1179 Send(new GpuCommandBufferMsg_UpdateVSyncParameters(route_id_, timebase,
1177 interval)); 1180 interval));
1178 } 1181 }
1179 1182
1180 } // namespace content 1183 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/gpu_channel_unittest.cc ('k') | content/common/gpu/gpu_host_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698