| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "cc/resources/resource_provider.h" | 5 #include "cc/resources/resource_provider.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 1166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1177 desc.fOrigin = kTopLeft_GrSurfaceOrigin; | 1177 desc.fOrigin = kTopLeft_GrSurfaceOrigin; |
| 1178 desc.fTextureHandle = skia::GrGLTextureInfoToGrBackendObject(texture_info); | 1178 desc.fTextureHandle = skia::GrGLTextureInfoToGrBackendObject(texture_info); |
| 1179 sk_image_ = SkImage::MakeFromTexture( | 1179 sk_image_ = SkImage::MakeFromTexture( |
| 1180 resource_provider->compositor_context_provider_->GrContext(), desc); | 1180 resource_provider->compositor_context_provider_->GrContext(), desc); |
| 1181 } else if (resource->pixels) { | 1181 } else if (resource->pixels) { |
| 1182 SkBitmap sk_bitmap; | 1182 SkBitmap sk_bitmap; |
| 1183 ResourceProvider::PopulateSkBitmapWithResource(&sk_bitmap, resource); | 1183 ResourceProvider::PopulateSkBitmapWithResource(&sk_bitmap, resource); |
| 1184 sk_bitmap.setImmutable(); | 1184 sk_bitmap.setImmutable(); |
| 1185 sk_image_ = SkImage::MakeFromBitmap(sk_bitmap); | 1185 sk_image_ = SkImage::MakeFromBitmap(sk_bitmap); |
| 1186 } else { | 1186 } else { |
| 1187 NOTREACHED() << "Image not valid"; | 1187 // TODO(enne): fix race condition of shared bitmap manager going away |
| 1188 // that can cause this to happen. This will cause the read lock |
| 1189 // to not be valid. |
| 1188 } | 1190 } |
| 1189 } | 1191 } |
| 1190 | 1192 |
| 1191 ResourceProvider::ScopedReadLockSkImage::~ScopedReadLockSkImage() { | 1193 ResourceProvider::ScopedReadLockSkImage::~ScopedReadLockSkImage() { |
| 1192 resource_provider_->UnlockForRead(resource_id_); | 1194 resource_provider_->UnlockForRead(resource_id_); |
| 1193 } | 1195 } |
| 1194 | 1196 |
| 1195 ResourceProvider::ScopedWriteLockSoftware::ScopedWriteLockSoftware( | 1197 ResourceProvider::ScopedWriteLockSoftware::ScopedWriteLockSoftware( |
| 1196 ResourceProvider* resource_provider, | 1198 ResourceProvider* resource_provider, |
| 1197 ResourceId resource_id) | 1199 ResourceId resource_id) |
| (...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1983 | 1985 |
| 1984 const int kImportance = 2; | 1986 const int kImportance = 2; |
| 1985 pmd->CreateSharedGlobalAllocatorDump(guid); | 1987 pmd->CreateSharedGlobalAllocatorDump(guid); |
| 1986 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); | 1988 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); |
| 1987 } | 1989 } |
| 1988 | 1990 |
| 1989 return true; | 1991 return true; |
| 1990 } | 1992 } |
| 1991 | 1993 |
| 1992 } // namespace cc | 1994 } // namespace cc |
| OLD | NEW |