| OLD | NEW |
| 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 "examples/ganesh_app/texture_uploader.h" | 5 #include "examples/ganesh_app/texture_uploader.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 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 : client_(client), | 28 : client_(client), |
| 29 context_(context), | 29 context_(context), |
| 30 next_resource_id_(0u), | 30 next_resource_id_(0u), |
| 31 id_namespace_(0u), | 31 id_namespace_(0u), |
| 32 local_id_(0u), | 32 local_id_(0u), |
| 33 weak_factory_(this) { | 33 weak_factory_(this) { |
| 34 context_->AddObserver(this); | 34 context_->AddObserver(this); |
| 35 | 35 |
| 36 mojo::ServiceProviderPtr surfaces_service_provider; | 36 mojo::ServiceProviderPtr surfaces_service_provider; |
| 37 shell->ConnectToApplication("mojo:surfaces_service", | 37 shell->ConnectToApplication("mojo:surfaces_service", |
| 38 mojo::GetProxy(&surfaces_service_provider)); | 38 mojo::GetProxy(&surfaces_service_provider), |
| 39 nullptr); |
| 39 mojo::ConnectToService(surfaces_service_provider.get(), &surface_); | 40 mojo::ConnectToService(surfaces_service_provider.get(), &surface_); |
| 40 surface_.set_client(this); | 41 surface_.set_client(this); |
| 41 } | 42 } |
| 42 | 43 |
| 43 TextureUploader::~TextureUploader() { | 44 TextureUploader::~TextureUploader() { |
| 44 if (context_.get()) | 45 if (context_.get()) |
| 45 context_->RemoveObserver(this); | 46 context_->RemoveObserver(this); |
| 46 } | 47 } |
| 47 | 48 |
| 48 void TextureUploader::Upload(scoped_ptr<mojo::GLTexture> texture) { | 49 void TextureUploader::Upload(scoped_ptr<mojo::GLTexture> texture) { |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 DCHECK_EQ(1, resource->count); | 162 DCHECK_EQ(1, resource->count); |
| 162 glWaitSyncPointCHROMIUM(resource->sync_point); | 163 glWaitSyncPointCHROMIUM(resource->sync_point); |
| 163 mojo::GLTexture* texture = resource_to_texture_map_[resource->id]; | 164 mojo::GLTexture* texture = resource_to_texture_map_[resource->id]; |
| 164 DCHECK_NE(0u, texture->texture_id()); | 165 DCHECK_NE(0u, texture->texture_id()); |
| 165 resource_to_texture_map_.erase(resource->id); | 166 resource_to_texture_map_.erase(resource->id); |
| 166 delete texture; | 167 delete texture; |
| 167 } | 168 } |
| 168 } | 169 } |
| 169 | 170 |
| 170 } // namespace examples | 171 } // namespace examples |
| OLD | NEW |