| 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 "services/ui/demo/bitmap_uploader.h" | 5 #include "services/ui/demo/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" |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/threading/thread_task_runner_handle.h" | 12 #include "base/threading/thread_task_runner_handle.h" |
| 13 #include "cc/ipc/compositor_frame.mojom.h" | 13 #include "cc/ipc/compositor_frame.mojom.h" |
| 14 #include "cc/quads/render_pass.h" | 14 #include "cc/quads/render_pass.h" |
| 15 #include "cc/quads/solid_color_draw_quad.h" | 15 #include "cc/quads/solid_color_draw_quad.h" |
| 16 #include "cc/quads/texture_draw_quad.h" | 16 #include "cc/quads/texture_draw_quad.h" |
| 17 #include "services/ui/public/cpp/context_provider.h" | 17 #include "services/ui/public/cpp/context_provider.h" |
| 18 #include "services/ui/public/cpp/gles2_context.h" | 18 #include "services/ui/public/cpp/gles2_context.h" |
| 19 #include "services/ui/public/cpp/gpu_service.h" | 19 #include "services/ui/public/cpp/gpu_service.h" |
| 20 #include "services/ui/public/cpp/window.h" | 20 #include "services/ui/public/cpp/window.h" |
| 21 #include "services/ui/public/cpp/window_surface.h" | |
| 22 | 21 |
| 23 namespace ui { | 22 namespace ui { |
| 24 namespace { | 23 namespace { |
| 25 | 24 |
| 26 const uint32_t g_transparent_color = 0x00000000; | 25 const uint32_t g_transparent_color = 0x00000000; |
| 27 | 26 |
| 28 } // namespace | 27 } // namespace |
| 29 | 28 |
| 30 const char kBitmapUploaderForAcceleratedWidget[] = | 29 const char kBitmapUploaderForAcceleratedWidget[] = |
| 31 "__BITMAP_UPLOADER_ACCELERATED_WIDGET__"; | 30 "__BITMAP_UPLOADER_ACCELERATED_WIDGET__"; |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 | 168 |
| 170 frame.delegated_frame_data->render_pass_list.push_back(std::move(pass)); | 169 frame.delegated_frame_data->render_pass_list.push_back(std::move(pass)); |
| 171 | 170 |
| 172 // TODO(rjkroege, fsamuel): We should throttle frames. | 171 // TODO(rjkroege, fsamuel): We should throttle frames. |
| 173 compositor_frame_sink_->SubmitCompositorFrame(std::move(frame)); | 172 compositor_frame_sink_->SubmitCompositorFrame(std::move(frame)); |
| 174 } | 173 } |
| 175 | 174 |
| 176 void BitmapUploader::OnGpuChannelEstablished( | 175 void BitmapUploader::OnGpuChannelEstablished( |
| 177 scoped_refptr<gpu::GpuChannelHost> gpu_channel) { | 176 scoped_refptr<gpu::GpuChannelHost> gpu_channel) { |
| 178 compositor_frame_sink_ = window_->RequestCompositorFrameSink( | 177 compositor_frame_sink_ = window_->RequestCompositorFrameSink( |
| 179 mojom::SurfaceType::DEFAULT, | 178 mojom::CompositorFrameSinkType::DEFAULT, |
| 180 new ContextProvider(gpu_channel)); | 179 new ContextProvider(std::move(gpu_channel))); |
| 181 compositor_frame_sink_->BindToClient(this); | 180 compositor_frame_sink_->BindToClient(this); |
| 182 } | 181 } |
| 183 | 182 |
| 184 uint32_t BitmapUploader::BindTextureForSize(const gfx::Size& size) { | 183 uint32_t BitmapUploader::BindTextureForSize(const gfx::Size& size) { |
| 185 gpu::gles2::GLES2Interface* gl = | 184 gpu::gles2::GLES2Interface* gl = |
| 186 compositor_frame_sink_->context_provider()->ContextGL(); | 185 compositor_frame_sink_->context_provider()->ContextGL(); |
| 187 // TODO(jamesr): Recycle textures. | 186 // TODO(jamesr): Recycle textures. |
| 188 GLuint texture = 0u; | 187 GLuint texture = 0u; |
| 189 gl->GenTextures(1, &texture); | 188 gl->GenTextures(1, &texture); |
| 190 gl->BindTexture(GL_TEXTURE_2D, texture); | 189 gl->BindTexture(GL_TEXTURE_2D, texture); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 // TODO(fsamuel): Implement this. | 233 // TODO(fsamuel): Implement this. |
| 235 } | 234 } |
| 236 | 235 |
| 237 void BitmapUploader::SetExternalTilePriorityConstraints( | 236 void BitmapUploader::SetExternalTilePriorityConstraints( |
| 238 const gfx::Rect& viewport_rect, | 237 const gfx::Rect& viewport_rect, |
| 239 const gfx::Transform& transform) { | 238 const gfx::Transform& transform) { |
| 240 // TODO(fsamuel): Implement this. | 239 // TODO(fsamuel): Implement this. |
| 241 } | 240 } |
| 242 | 241 |
| 243 } // namespace ui | 242 } // namespace ui |
| OLD | NEW |