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

Side by Side Diff: sky/compositor/resource_manager.cc

Issue 759763002: Fix DCHECK(gr_texture) when running test_sky (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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 | « sky/compositor/layer_host.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "sky/compositor/resource_manager.h" 5 #include "sky/compositor/resource_manager.h"
6 6
7 #ifndef GL_GLEXT_PROTOTYPES 7 #ifndef GL_GLEXT_PROTOTYPES
8 #define GL_GLEXT_PROTOTYPES 8 #define GL_GLEXT_PROTOTYPES
9 #endif 9 #endif
10 10
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/stl_util.h" 12 #include "base/stl_util.h"
13 #include "gpu/GLES2/gl2chromium.h" 13 #include "gpu/GLES2/gl2chromium.h"
14 #include "gpu/GLES2/gl2extchromium.h" 14 #include "gpu/GLES2/gl2extchromium.h"
15 #include "mojo/converters/geometry/geometry_type_converters.h" 15 #include "mojo/converters/geometry/geometry_type_converters.h"
16 #include "mojo/gpu/gl_context.h" 16 #include "mojo/gpu/gl_context.h"
17 #include "mojo/gpu/gl_texture.h" 17 #include "mojo/gpu/gl_texture.h"
18 #include "mojo/public/c/gles2/gles2.h" 18 #include "mojo/public/c/gles2/gles2.h"
19 #include "sky/compositor/layer.h" 19 #include "sky/compositor/layer.h"
20 20
21 namespace sky { 21 namespace sky {
22 22
23 ResourceManager::ResourceManager(base::WeakPtr<mojo::GLContext> gl_context) 23 ResourceManager::ResourceManager(base::WeakPtr<mojo::GLContext> gl_context)
24 : gl_context_(gl_context), next_resource_id_(0) { 24 : gl_context_(gl_context), next_resource_id_(0) {
25 } 25 }
26 26
27 ResourceManager::~ResourceManager() { 27 ResourceManager::~ResourceManager() {
28 STLDeleteContainerPairSecondPointers(resource_to_texture_map_.begin(), 28 STLDeleteContainerPairSecondPointers(resource_to_texture_map_.begin(),
29 resource_to_texture_map_.end()); 29 resource_to_texture_map_.end());
30 } 30 }
31 31
32 scoped_ptr<mojo::GLTexture> ResourceManager::CreateTexture( 32 scoped_ptr<mojo::GLTexture> ResourceManager::CreateTexture(
33 const gfx::Size& size) { 33 const gfx::Size& size) {
34 gl_context_->MakeCurrent(); 34 gl_context_->MakeCurrent();
35 return make_scoped_ptr(new mojo::GLTexture( 35 return make_scoped_ptr(new mojo::GLTexture(
36 gl_context_, mojo::TypeConverter<mojo::Size, gfx::Size>::Convert(size))); 36 gl_context_, mojo::TypeConverter<mojo::Size, gfx::Size>::Convert(size)));
37 } 37 }
38 38
39 mojo::TransferableResourcePtr ResourceManager::CreateTransferableResource( 39 mojo::TransferableResourcePtr ResourceManager::CreateTransferableResource(
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 mojo::GLTexture* texture = iter->second; 82 mojo::GLTexture* texture = iter->second;
83 DCHECK_NE(0u, texture->texture_id()); 83 DCHECK_NE(0u, texture->texture_id());
84 resource_to_texture_map_.erase(iter); 84 resource_to_texture_map_.erase(iter);
85 // TODO(abarth): Consider recycling the texture. 85 // TODO(abarth): Consider recycling the texture.
86 glWaitSyncPointCHROMIUM(resource->sync_point); 86 glWaitSyncPointCHROMIUM(resource->sync_point);
87 delete texture; 87 delete texture;
88 } 88 }
89 } 89 }
90 90
91 } // namespace examples 91 } // namespace examples
OLDNEW
« no previous file with comments | « sky/compositor/layer_host.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698