| Index: components/mus/public/cpp/lib/window_surface.cc
|
| diff --git a/components/mus/public/cpp/lib/window_surface.cc b/components/mus/public/cpp/lib/window_surface.cc
|
| index 83c4be011dda8a7549267aeaae1e63c8f4ed2e43..076243cadfdcb7a98f6777d795f9541ec4087dbe 100644
|
| --- a/components/mus/public/cpp/lib/window_surface.cc
|
| +++ b/components/mus/public/cpp/lib/window_surface.cc
|
| @@ -9,11 +9,25 @@
|
|
|
| namespace mus {
|
|
|
| +// static
|
| +scoped_ptr<WindowSurface> WindowSurface::Create(
|
| + scoped_ptr<WindowSurfaceBinding>* surface_binding) {
|
| + mojom::SurfacePtr surface;
|
| + mojom::SurfaceClientPtr surface_client;
|
| + mojo::InterfaceRequest<mojom::SurfaceClient> surface_client_request =
|
| + GetProxy(&surface_client);
|
| +
|
| + surface_binding->reset(
|
| + new WindowSurfaceBinding(GetProxy(&surface), surface_client.Pass()));
|
| + return make_scoped_ptr(new WindowSurface(surface.PassInterface(),
|
| + surface_client_request.Pass()));
|
| +}
|
| +
|
| WindowSurface::~WindowSurface() {}
|
|
|
| void WindowSurface::BindToThread() {
|
| - DCHECK(!bound_to_thread_);
|
| - bound_to_thread_ = true;
|
| + DCHECK(!thread_checker_);
|
| + thread_checker_.reset(new base::ThreadChecker());
|
| surface_.Bind(surface_info_.Pass());
|
| client_binding_.reset(
|
| new mojo::Binding<mojom::SurfaceClient>(this, client_request_.Pass()));
|
| @@ -21,7 +35,8 @@ void WindowSurface::BindToThread() {
|
|
|
| void WindowSurface::SubmitCompositorFrame(mojom::CompositorFramePtr frame,
|
| const mojo::Closure& callback) {
|
| - DCHECK(bound_to_thread_);
|
| + DCHECK(thread_checker_);
|
| + DCHECK(thread_checker_->CalledOnValidThread());
|
| if (!surface_)
|
| return;
|
| surface_->SubmitCompositorFrame(frame.Pass(), callback);
|
| @@ -32,14 +47,23 @@ WindowSurface::WindowSurface(
|
| mojo::InterfaceRequest<mojom::SurfaceClient> client_request)
|
| : client_(nullptr),
|
| surface_info_(surface_info.Pass()),
|
| - client_request_(client_request.Pass()),
|
| - bound_to_thread_(false) {}
|
| + client_request_(client_request.Pass()) {}
|
|
|
| void WindowSurface::ReturnResources(
|
| mojo::Array<mojom::ReturnedResourcePtr> resources) {
|
| + DCHECK(thread_checker_);
|
| + DCHECK(thread_checker_->CalledOnValidThread());
|
| if (!client_)
|
| return;
|
| client_->OnResourcesReturned(this, resources.Pass());
|
| }
|
|
|
| +WindowSurfaceBinding::~WindowSurfaceBinding() {}
|
| +
|
| +WindowSurfaceBinding::WindowSurfaceBinding(
|
| + mojo::InterfaceRequest<mojom::Surface> surface_request,
|
| + mojom::SurfaceClientPtr surface_client)
|
| + : surface_request_(surface_request.Pass()),
|
| + surface_client_(surface_client.Pass()) {}
|
| +
|
| } // namespace mus
|
|
|