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

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

Issue 301793003: During image destroy, delete textures only if we have a GL context. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments addressed. Created 6 years, 4 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 "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/memory/shared_memory.h" 10 #include "base/memory/shared_memory.h"
(...skipping 928 matching lines...) Expand 10 before | Expand all | Expand 10 after
939 if (!image) 939 if (!image)
940 return; 940 return;
941 941
942 // For Android specific workaround. 942 // For Android specific workaround.
943 if (context_group_->feature_info()->workarounds().release_image_after_use) 943 if (context_group_->feature_info()->workarounds().release_image_after_use)
944 image->SetReleaseAfterUse(); 944 image->SetReleaseAfterUse();
945 945
946 if (decoder_) { 946 if (decoder_) {
947 gpu::gles2::ImageManager* image_manager = decoder_->GetImageManager(); 947 gpu::gles2::ImageManager* image_manager = decoder_->GetImageManager();
948 DCHECK(image_manager); 948 DCHECK(image_manager);
949 if (image_manager->LookupImage(id)) {
950 LOG(ERROR) << "Image already exists with same ID.";
951 return;
952 }
949 image_manager->AddImage(image.get(), id); 953 image_manager->AddImage(image.get(), id);
950 } 954 }
951 } 955 }
952 956
953 void GpuCommandBufferStub::OnDestroyGpuMemoryBuffer(int32 id) { 957 void GpuCommandBufferStub::OnDestroyGpuMemoryBuffer(int32 id) {
954 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnDestroyGpuMemoryBuffer"); 958 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnDestroyGpuMemoryBuffer");
955 959
956 if (decoder_) { 960 if (decoder_) {
957 gpu::gles2::ImageManager* image_manager = decoder_->GetImageManager(); 961 gpu::gles2::ImageManager* image_manager = decoder_->GetImageManager();
958 DCHECK(image_manager); 962 DCHECK(image_manager);
963 if (!image_manager->LookupImage(id)) {
964 LOG(ERROR) << "Image doesnt exist.";
reveman 2014/07/27 23:58:32 nit: "Image with ID doesn't exist."
sohanjg 2014/07/28 10:15:58 Done.
965 return;
966 }
959 image_manager->RemoveImage(id); 967 image_manager->RemoveImage(id);
960 } 968 }
961 } 969 }
962 970
963 void GpuCommandBufferStub::SendConsoleMessage( 971 void GpuCommandBufferStub::SendConsoleMessage(
964 int32 id, 972 int32 id,
965 const std::string& message) { 973 const std::string& message) {
966 GPUCommandBufferConsoleMessage console_message; 974 GPUCommandBufferConsoleMessage console_message;
967 console_message.id = id; 975 console_message.id = id;
968 console_message.message = message; 976 console_message.message = message;
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
1052 if (decoder_) 1060 if (decoder_)
1053 decoder_->LoseContext(GL_UNKNOWN_CONTEXT_RESET_ARB); 1061 decoder_->LoseContext(GL_UNKNOWN_CONTEXT_RESET_ARB);
1054 command_buffer_->SetParseError(gpu::error::kLostContext); 1062 command_buffer_->SetParseError(gpu::error::kLostContext);
1055 } 1063 }
1056 1064
1057 uint64 GpuCommandBufferStub::GetMemoryUsage() const { 1065 uint64 GpuCommandBufferStub::GetMemoryUsage() const {
1058 return GetMemoryManager()->GetClientMemoryUsage(this); 1066 return GetMemoryManager()->GetClientMemoryUsage(this);
1059 } 1067 }
1060 1068
1061 } // namespace content 1069 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/common/gpu/stream_texture_android.h » ('j') | gpu/command_buffer/service/image_manager.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698