Chromium Code Reviews| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 42 void BitmapUploader::Init(shell::Connector* connector) { | 42 void BitmapUploader::Init(shell::Connector* connector) { |
| 43 surface_ = window_->RequestSurface(mus::mojom::SurfaceType::DEFAULT); | 43 surface_ = window_->RequestSurface(mus::mojom::SurfaceType::DEFAULT); |
| 44 surface_->BindToThread(); | 44 surface_->BindToThread(); |
| 45 surface_->set_client(this); | 45 surface_->set_client(this); |
| 46 | 46 |
| 47 connector->ConnectToInterface("mojo:mus", &gpu_service_); | 47 connector->ConnectToInterface("mojo:mus", &gpu_service_); |
| 48 mus::mojom::CommandBufferPtr gles2_client; | 48 mus::mojom::CommandBufferPtr gles2_client; |
| 49 gpu_service_->CreateOffscreenGLES2Context(GetProxy(&gles2_client)); | 49 gpu_service_->CreateOffscreenGLES2Context(GetProxy(&gles2_client)); |
| 50 gles2_context_.reset(new mus::GLES2Context( | 50 gles2_context_.reset(new mus::GLES2Context( |
| 51 std::vector<int32_t>(), gles2_client.PassInterface().PassHandle())); | 51 std::vector<int32_t>(), gles2_client.PassInterface().PassHandle())); |
| 52 DCHECK(gles2_context_->Initialize()); | 52 if (!gles2_context_->Initialize()) |
| 53 gles2_context_.reset(); | |
|
sadrul
2016/05/26 15:41:35
Can you add a DCHECK here that if Initialize() ret
Peng
2016/05/30 14:04:25
gpu_service_.encountered_error() is not true at he
| |
| 53 } | 54 } |
| 54 | 55 |
| 55 // Sets the color which is RGBA. | 56 // Sets the color which is RGBA. |
| 56 void BitmapUploader::SetColor(uint32_t color) { | 57 void BitmapUploader::SetColor(uint32_t color) { |
| 57 if (color_ == color) | 58 if (color_ == color) |
| 58 return; | 59 return; |
| 59 color_ = color; | 60 color_ = color; |
| 60 if (surface_) | 61 if (surface_) |
| 61 Upload(); | 62 Upload(); |
| 62 } | 63 } |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 227 DCHECK_EQ(1, resource->count); | 228 DCHECK_EQ(1, resource->count); |
| 228 gl->WaitSyncTokenCHROMIUM(resource->sync_token.GetConstData()); | 229 gl->WaitSyncTokenCHROMIUM(resource->sync_token.GetConstData()); |
| 229 uint32_t texture_id = resource_to_texture_id_map_[resource->id]; | 230 uint32_t texture_id = resource_to_texture_id_map_[resource->id]; |
| 230 DCHECK_NE(0u, texture_id); | 231 DCHECK_NE(0u, texture_id); |
| 231 resource_to_texture_id_map_.erase(resource->id); | 232 resource_to_texture_id_map_.erase(resource->id); |
| 232 gl->DeleteTextures(1, &texture_id); | 233 gl->DeleteTextures(1, &texture_id); |
| 233 } | 234 } |
| 234 } | 235 } |
| 235 | 236 |
| 236 } // namespace bitmap_uploader | 237 } // namespace bitmap_uploader |
| OLD | NEW |