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 "sky/compositor/surface_holder.h" | 5 #include "sky/compositor/surface_holder.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/message_loop/message_loop.h" |
8 #include "mojo/converters/geometry/geometry_type_converters.h" | 9 #include "mojo/converters/geometry/geometry_type_converters.h" |
9 #include "mojo/public/cpp/application/connect.h" | 10 #include "mojo/public/cpp/application/connect.h" |
10 #include "mojo/public/interfaces/application/shell.mojom.h" | 11 #include "mojo/public/interfaces/application/shell.mojom.h" |
11 #include "sky/compositor/surface_allocator.h" | 12 #include "sky/compositor/surface_allocator.h" |
12 | 13 |
13 namespace sky { | 14 namespace sky { |
14 | 15 |
15 SurfaceHolder::Client::~Client() { | 16 SurfaceHolder::Client::~Client() { |
16 } | 17 } |
17 | 18 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 | 52 |
52 client_->OnSurfaceIdAvailable(surface_id_.Clone()); | 53 client_->OnSurfaceIdAvailable(surface_id_.Clone()); |
53 } | 54 } |
54 | 55 |
55 void SurfaceHolder::ReturnResources( | 56 void SurfaceHolder::ReturnResources( |
56 mojo::Array<mojo::ReturnedResourcePtr> resources) { | 57 mojo::Array<mojo::ReturnedResourcePtr> resources) { |
57 // TODO(abarth): The surface service shouldn't spam us with empty calls. | 58 // TODO(abarth): The surface service shouldn't spam us with empty calls. |
58 if (!resources.size()) | 59 if (!resources.size()) |
59 return; | 60 return; |
60 client_->ReturnResources(resources.Pass()); | 61 client_->ReturnResources(resources.Pass()); |
61 client_->OnReadyForNextFrame(); | |
62 } | 62 } |
63 | 63 |
64 void SurfaceHolder::OnSurfaceConnectionCreated(mojo::SurfacePtr surface, | 64 void SurfaceHolder::OnSurfaceConnectionCreated(mojo::SurfacePtr surface, |
65 uint32_t id_namespace) { | 65 uint32_t id_namespace) { |
66 surface_ = surface.Pass(); | 66 surface_ = surface.Pass(); |
67 surface_.set_client(this); | 67 surface_.set_client(this); |
68 surface_allocator_.reset(new SurfaceAllocator(id_namespace)); | 68 surface_allocator_.reset(new SurfaceAllocator(id_namespace)); |
69 | |
70 client_->OnReadyForNextFrame(); | |
71 } | 69 } |
72 | 70 |
73 } // namespace sky | 71 } // namespace sky |
OLD | NEW |