| 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/callback.h" | 6 #include "base/callback.h" |
| 7 #include "base/containers/hash_tables.h" | 7 #include "base/containers/hash_tables.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "components/mus/public/cpp/scoped_window_ptr.h" | 9 #include "components/mus/public/cpp/scoped_window_ptr.h" |
| 10 #include "components/mus/public/cpp/types.h" | 10 #include "components/mus/public/cpp/types.h" |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 resource_to_texture_id_map_[resource->id] = texture_id; | 167 resource_to_texture_id_map_[resource->id] = texture_id; |
| 168 resource->format = mus::mojom::RESOURCE_FORMAT_RGBA_8888; | 168 resource->format = mus::mojom::RESOURCE_FORMAT_RGBA_8888; |
| 169 resource->filter = GL_LINEAR; | 169 resource->filter = GL_LINEAR; |
| 170 resource->size = bitmap_size.Clone(); | 170 resource->size = bitmap_size.Clone(); |
| 171 mus::mojom::MailboxHolderPtr mailbox_holder = | 171 mus::mojom::MailboxHolderPtr mailbox_holder = |
| 172 mus::mojom::MailboxHolder::New(); | 172 mus::mojom::MailboxHolder::New(); |
| 173 mailbox_holder->mailbox = mus::mojom::Mailbox::New(); | 173 mailbox_holder->mailbox = mus::mojom::Mailbox::New(); |
| 174 for (int i = 0; i < GL_MAILBOX_SIZE_CHROMIUM; ++i) | 174 for (int i = 0; i < GL_MAILBOX_SIZE_CHROMIUM; ++i) |
| 175 mailbox_holder->mailbox->name.push_back(mailbox[i]); | 175 mailbox_holder->mailbox->name.push_back(mailbox[i]); |
| 176 mailbox_holder->texture_target = GL_TEXTURE_2D; | 176 mailbox_holder->texture_target = GL_TEXTURE_2D; |
| 177 mailbox_holder->sync_point = sync_point; | 177 mailbox_holder->sync_token = gpu::SyncToken(sync_point); |
| 178 resource->mailbox_holder = mailbox_holder.Pass(); | 178 resource->mailbox_holder = mailbox_holder.Pass(); |
| 179 resource->is_repeated = false; | 179 resource->is_repeated = false; |
| 180 resource->is_software = false; | 180 resource->is_software = false; |
| 181 | 181 |
| 182 mus::mojom::QuadPtr quad = mus::mojom::Quad::New(); | 182 mus::mojom::QuadPtr quad = mus::mojom::Quad::New(); |
| 183 quad->material = mus::mojom::MATERIAL_TEXTURE_CONTENT; | 183 quad->material = mus::mojom::MATERIAL_TEXTURE_CONTENT; |
| 184 | 184 |
| 185 mojo::RectPtr rect = mojo::Rect::New(); | 185 mojo::RectPtr rect = mojo::Rect::New(); |
| 186 if (width_ <= bounds.width() && height_ <= bounds.height()) { | 186 if (width_ <= bounds.width() && height_ <= bounds.height()) { |
| 187 rect->width = width_; | 187 rect->width = width_; |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 } | 278 } |
| 279 | 279 |
| 280 // SurfaceClient implementation. | 280 // SurfaceClient implementation. |
| 281 void ReturnResources( | 281 void ReturnResources( |
| 282 mojo::Array<mus::mojom::ReturnedResourcePtr> resources) override { | 282 mojo::Array<mus::mojom::ReturnedResourcePtr> resources) override { |
| 283 MojoGLES2MakeCurrent(gles2_context_); | 283 MojoGLES2MakeCurrent(gles2_context_); |
| 284 // TODO(jamesr): Recycle. | 284 // TODO(jamesr): Recycle. |
| 285 for (size_t i = 0; i < resources.size(); ++i) { | 285 for (size_t i = 0; i < resources.size(); ++i) { |
| 286 mus::mojom::ReturnedResourcePtr resource = resources[i].Pass(); | 286 mus::mojom::ReturnedResourcePtr resource = resources[i].Pass(); |
| 287 DCHECK_EQ(1, resource->count); | 287 DCHECK_EQ(1, resource->count); |
| 288 glWaitSyncPointCHROMIUM(resource->sync_point); | 288 glWaitSyncTokenCHROMIUM(resource->sync_token); |
| 289 uint32_t texture_id = resource_to_texture_id_map_[resource->id]; | 289 uint32_t texture_id = resource_to_texture_id_map_[resource->id]; |
| 290 DCHECK_NE(0u, texture_id); | 290 DCHECK_NE(0u, texture_id); |
| 291 resource_to_texture_id_map_.erase(resource->id); | 291 resource_to_texture_id_map_.erase(resource->id); |
| 292 glDeleteTextures(1, &texture_id); | 292 glDeleteTextures(1, &texture_id); |
| 293 } | 293 } |
| 294 } | 294 } |
| 295 | 295 |
| 296 mus::Window* view_; | 296 mus::Window* view_; |
| 297 mus::mojom::GpuPtr gpu_service_; | 297 mus::mojom::GpuPtr gpu_service_; |
| 298 scoped_ptr<mus::WindowSurface> surface_; | 298 scoped_ptr<mus::WindowSurface> surface_; |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 624 | 624 |
| 625 DISALLOW_COPY_AND_ASSIGN(PDFViewer); | 625 DISALLOW_COPY_AND_ASSIGN(PDFViewer); |
| 626 }; | 626 }; |
| 627 } // namespace | 627 } // namespace |
| 628 } // namespace pdf_viewer | 628 } // namespace pdf_viewer |
| 629 | 629 |
| 630 MojoResult MojoMain(MojoHandle application_request) { | 630 MojoResult MojoMain(MojoHandle application_request) { |
| 631 mojo::ApplicationRunner runner(new pdf_viewer::PDFViewer()); | 631 mojo::ApplicationRunner runner(new pdf_viewer::PDFViewer()); |
| 632 return runner.Run(application_request); | 632 return runner.Run(application_request); |
| 633 } | 633 } |
| OLD | NEW |