| 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/surfaces_app/child_impl.h" | 5 #include "examples/surfaces_app/child_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "cc/output/compositor_frame.h" | 8 #include "cc/output/compositor_frame.h" |
| 9 #include "cc/output/delegated_frame_data.h" | 9 #include "cc/output/delegated_frame_data.h" |
| 10 #include "cc/quads/render_pass.h" | 10 #include "cc/quads/render_pass.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 using cc::CompositorFrame; | 29 using cc::CompositorFrame; |
| 30 | 30 |
| 31 static const uint32_t kLocalId = 1u; | 31 static const uint32_t kLocalId = 1u; |
| 32 | 32 |
| 33 ChildImpl::ChildImpl(ApplicationConnection* surfaces_service_connection, | 33 ChildImpl::ChildImpl(ApplicationConnection* surfaces_service_connection, |
| 34 InterfaceRequest<Child> request) | 34 InterfaceRequest<Child> request) |
| 35 : id_namespace_(0u), binding_(this, request.Pass()) { | 35 : id_namespace_(0u), binding_(this, request.Pass()) { |
| 36 surfaces_service_connection->ConnectToService(&surface_); | 36 surfaces_service_connection->ConnectToService(&surface_); |
| 37 surface_->GetIdNamespace( | 37 surface_->GetIdNamespace( |
| 38 base::Bind(&ChildImpl::SetIdNamespace, base::Unretained(this))); | 38 base::Bind(&ChildImpl::SetIdNamespace, base::Unretained(this))); |
| 39 surface_.WaitForIncomingMethodCall(); // Wait for ID namespace to arrive. | 39 surface_.WaitForIncomingResponse(); // Wait for ID namespace to arrive. |
| 40 DCHECK_NE(0u, id_namespace_); | 40 DCHECK_NE(0u, id_namespace_); |
| 41 } | 41 } |
| 42 | 42 |
| 43 ChildImpl::~ChildImpl() { | 43 ChildImpl::~ChildImpl() { |
| 44 surface_->DestroySurface(kLocalId); | 44 surface_->DestroySurface(kLocalId); |
| 45 } | 45 } |
| 46 | 46 |
| 47 void ChildImpl::SetIdNamespace(uint32_t id_namespace) { | 47 void ChildImpl::SetIdNamespace(uint32_t id_namespace) { |
| 48 id_namespace_ = id_namespace; | 48 id_namespace_ = id_namespace; |
| 49 } | 49 } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 74 surface_->CreateSurface(kLocalId); | 74 surface_->CreateSurface(kLocalId); |
| 75 surface_->SubmitFrame(kLocalId, mojo::Frame::From(*frame), mojo::Closure()); | 75 surface_->SubmitFrame(kLocalId, mojo::Frame::From(*frame), mojo::Closure()); |
| 76 auto qualified_id = mojo::SurfaceId::New(); | 76 auto qualified_id = mojo::SurfaceId::New(); |
| 77 qualified_id->id_namespace = id_namespace_; | 77 qualified_id->id_namespace = id_namespace_; |
| 78 qualified_id->local = kLocalId; | 78 qualified_id->local = kLocalId; |
| 79 callback.Run(qualified_id.Pass()); | 79 callback.Run(qualified_id.Pass()); |
| 80 } | 80 } |
| 81 | 81 |
| 82 } // namespace examples | 82 } // namespace examples |
| 83 } // namespace mojo | 83 } // namespace mojo |
| OLD | NEW |