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

Side by Side Diff: content/browser/gpu/gpu_process_host.cc

Issue 383303004: Added more detailed result codes for CreateViewCommandBuffer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
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/browser/gpu/gpu_process_host.h" 5 #include "content/browser/gpu/gpu_process_host.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/base_switches.h" 8 #include "base/base_switches.h"
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 639
640 DCHECK(CalledOnValidThread()); 640 DCHECK(CalledOnValidThread());
641 641
642 if (!compositing_surface.is_null() && 642 if (!compositing_surface.is_null() &&
643 Send(new GpuMsg_CreateViewCommandBuffer( 643 Send(new GpuMsg_CreateViewCommandBuffer(
644 compositing_surface, surface_id, client_id, init_params, route_id))) { 644 compositing_surface, surface_id, client_id, init_params, route_id))) {
645 create_command_buffer_requests_.push(callback); 645 create_command_buffer_requests_.push(callback);
646 surface_refs_.insert(std::make_pair(surface_id, 646 surface_refs_.insert(std::make_pair(surface_id,
647 GpuSurfaceTracker::GetInstance()->GetSurfaceRefForSurface(surface_id))); 647 GpuSurfaceTracker::GetInstance()->GetSurfaceRefForSurface(surface_id)));
648 } else { 648 } else {
649 callback.Run(false); 649 // Could distinguish here between compositing_surface being NULL
650 // and Send failing, if desired.
piman 2014/07/11 23:20:09 Really, we should assert and fix it upstream
651 callback.Run(CREATE_CMDBUF_FAILED_AND_CHANNEL_LOST);
650 } 652 }
651 } 653 }
652 654
653 void GpuProcessHost::CreateImage(gfx::PluginWindowHandle window, 655 void GpuProcessHost::CreateImage(gfx::PluginWindowHandle window,
654 int client_id, 656 int client_id,
655 int image_id, 657 int image_id,
656 const CreateImageCallback& callback) { 658 const CreateImageCallback& callback) {
657 TRACE_EVENT0("gpu", "GpuProcessHost::CreateImage"); 659 TRACE_EVENT0("gpu", "GpuProcessHost::CreateImage");
658 660
659 DCHECK(CalledOnValidThread()); 661 DCHECK(CalledOnValidThread());
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
747 749
748 void GpuProcessHost::OnCommandBufferCreated(bool succeeded) { 750 void GpuProcessHost::OnCommandBufferCreated(bool succeeded) {
749 TRACE_EVENT0("gpu", "GpuProcessHost::OnCommandBufferCreated"); 751 TRACE_EVENT0("gpu", "GpuProcessHost::OnCommandBufferCreated");
750 752
751 if (create_command_buffer_requests_.empty()) 753 if (create_command_buffer_requests_.empty())
752 return; 754 return;
753 755
754 CreateCommandBufferCallback callback = 756 CreateCommandBufferCallback callback =
755 create_command_buffer_requests_.front(); 757 create_command_buffer_requests_.front();
756 create_command_buffer_requests_.pop(); 758 create_command_buffer_requests_.pop();
757 callback.Run(succeeded); 759 callback.Run(succeeded ? CREATE_CMDBUF_SUCCEEDED : CREATE_CMDBUF_FAILED);
piman 2014/07/11 23:20:09 ideally we'd pass a CreateCommandBufferResult back
Ken Russell (switch to Gerrit) 2014/07/12 00:44:52 Thanks, that sounds cleaner. I've implemented this
758 } 760 }
759 761
760 void GpuProcessHost::OnDestroyCommandBuffer(int32 surface_id) { 762 void GpuProcessHost::OnDestroyCommandBuffer(int32 surface_id) {
761 TRACE_EVENT0("gpu", "GpuProcessHost::OnDestroyCommandBuffer"); 763 TRACE_EVENT0("gpu", "GpuProcessHost::OnDestroyCommandBuffer");
762 SurfaceRefMap::iterator it = surface_refs_.find(surface_id); 764 SurfaceRefMap::iterator it = surface_refs_.find(surface_id);
763 if (it != surface_refs_.end()) { 765 if (it != surface_refs_.end()) {
764 surface_refs_.erase(it); 766 surface_refs_.erase(it);
765 } 767 }
766 } 768 }
767 769
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
1054 while (!channel_requests_.empty()) { 1056 while (!channel_requests_.empty()) {
1055 EstablishChannelCallback callback = channel_requests_.front(); 1057 EstablishChannelCallback callback = channel_requests_.front();
1056 channel_requests_.pop(); 1058 channel_requests_.pop();
1057 callback.Run(IPC::ChannelHandle(), gpu::GPUInfo()); 1059 callback.Run(IPC::ChannelHandle(), gpu::GPUInfo());
1058 } 1060 }
1059 1061
1060 while (!create_command_buffer_requests_.empty()) { 1062 while (!create_command_buffer_requests_.empty()) {
1061 CreateCommandBufferCallback callback = 1063 CreateCommandBufferCallback callback =
1062 create_command_buffer_requests_.front(); 1064 create_command_buffer_requests_.front();
1063 create_command_buffer_requests_.pop(); 1065 create_command_buffer_requests_.pop();
1064 callback.Run(false); 1066 callback.Run(CREATE_CMDBUF_FAILED_AND_CHANNEL_LOST);
1065 } 1067 }
1066 } 1068 }
1067 1069
1068 void GpuProcessHost::BlockLiveOffscreenContexts() { 1070 void GpuProcessHost::BlockLiveOffscreenContexts() {
1069 for (std::multiset<GURL>::iterator iter = 1071 for (std::multiset<GURL>::iterator iter =
1070 urls_with_live_offscreen_contexts_.begin(); 1072 urls_with_live_offscreen_contexts_.begin();
1071 iter != urls_with_live_offscreen_contexts_.end(); ++iter) { 1073 iter != urls_with_live_offscreen_contexts_.end(); ++iter) {
1072 GpuDataManagerImpl::GetInstance()->BlockDomainFrom3DAPIs( 1074 GpuDataManagerImpl::GetInstance()->BlockDomainFrom3DAPIs(
1073 *iter, GpuDataManagerImpl::DOMAIN_GUILT_UNKNOWN); 1075 *iter, GpuDataManagerImpl::DOMAIN_GUILT_UNKNOWN);
1074 } 1076 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1119 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); 1121 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader");
1120 ClientIdToShaderCacheMap::iterator iter = 1122 ClientIdToShaderCacheMap::iterator iter =
1121 client_id_to_shader_cache_.find(client_id); 1123 client_id_to_shader_cache_.find(client_id);
1122 // If the cache doesn't exist then this is an off the record profile. 1124 // If the cache doesn't exist then this is an off the record profile.
1123 if (iter == client_id_to_shader_cache_.end()) 1125 if (iter == client_id_to_shader_cache_.end())
1124 return; 1126 return;
1125 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); 1127 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader);
1126 } 1128 }
1127 1129
1128 } // namespace content 1130 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698