| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/bitmap_uploader/bitmap_uploader.h" | 5 #include "components/bitmap_uploader/bitmap_uploader.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 } | 47 } |
| 48 | 48 |
| 49 void BitmapUploader::Init(mojo::Shell* shell) { | 49 void BitmapUploader::Init(mojo::Shell* shell) { |
| 50 surface_ = window_->RequestSurface(mus::mojom::SurfaceType::DEFAULT); | 50 surface_ = window_->RequestSurface(mus::mojom::SurfaceType::DEFAULT); |
| 51 surface_->BindToThread(); | 51 surface_->BindToThread(); |
| 52 | 52 |
| 53 shell->ConnectToInterface("mojo:mus", &gpu_service_); | 53 shell->ConnectToInterface("mojo:mus", &gpu_service_); |
| 54 mus::mojom::CommandBufferPtr gles2_client; | 54 mus::mojom::CommandBufferPtr gles2_client; |
| 55 gpu_service_->CreateOffscreenGLES2Context(GetProxy(&gles2_client)); | 55 gpu_service_->CreateOffscreenGLES2Context(GetProxy(&gles2_client)); |
| 56 gles2_context_ = MojoGLES2CreateContext( | 56 gles2_context_ = MojoGLES2CreateContext( |
| 57 gles2_client.PassInterface().PassHandle().release().value(), | 57 gles2_client.PassInterface().PassHandle().release().value(), nullptr, |
| 58 nullptr, | 58 &LostContext, nullptr); |
| 59 &LostContext, nullptr, mojo::Environment::GetDefaultAsyncWaiter()); | |
| 60 MojoGLES2MakeCurrent(gles2_context_); | 59 MojoGLES2MakeCurrent(gles2_context_); |
| 61 } | 60 } |
| 62 | 61 |
| 63 // Sets the color which is RGBA. | 62 // Sets the color which is RGBA. |
| 64 void BitmapUploader::SetColor(uint32_t color) { | 63 void BitmapUploader::SetColor(uint32_t color) { |
| 65 if (color_ == color) | 64 if (color_ == color) |
| 66 return; | 65 return; |
| 67 color_ = color; | 66 color_ = color; |
| 68 if (surface_) | 67 if (surface_) |
| 69 Upload(); | 68 Upload(); |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 glWaitSyncTokenCHROMIUM( | 241 glWaitSyncTokenCHROMIUM( |
| 243 resource->sync_token.GetConstData()); | 242 resource->sync_token.GetConstData()); |
| 244 uint32_t texture_id = resource_to_texture_id_map_[resource->id]; | 243 uint32_t texture_id = resource_to_texture_id_map_[resource->id]; |
| 245 DCHECK_NE(0u, texture_id); | 244 DCHECK_NE(0u, texture_id); |
| 246 resource_to_texture_id_map_.erase(resource->id); | 245 resource_to_texture_id_map_.erase(resource->id); |
| 247 glDeleteTextures(1, &texture_id); | 246 glDeleteTextures(1, &texture_id); |
| 248 } | 247 } |
| 249 } | 248 } |
| 250 | 249 |
| 251 } // namespace bitmap_uploader | 250 } // namespace bitmap_uploader |
| OLD | NEW |