Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(895)

Side by Side Diff: components/mus/public/cpp/lib/window_surface.cc

Issue 2119963002: Move mus to //services/ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "components/mus/public/cpp/window_surface.h"
6
7 #include "base/memory/ptr_util.h"
8 #include "components/mus/public/cpp/window_surface_client.h"
9
10 namespace mus {
11
12 // static
13 std::unique_ptr<WindowSurface> WindowSurface::Create(
14 std::unique_ptr<WindowSurfaceBinding>* surface_binding) {
15 mojom::SurfacePtr surface;
16 mojom::SurfaceClientPtr surface_client;
17 mojo::InterfaceRequest<mojom::SurfaceClient> surface_client_request =
18 GetProxy(&surface_client);
19
20 surface_binding->reset(new WindowSurfaceBinding(
21 GetProxy(&surface), surface_client.PassInterface()));
22 return base::WrapUnique(new WindowSurface(surface.PassInterface(),
23 std::move(surface_client_request)));
24 }
25
26 WindowSurface::~WindowSurface() {}
27
28 void WindowSurface::BindToThread() {
29 DCHECK(!thread_checker_);
30 thread_checker_.reset(new base::ThreadChecker());
31 surface_.Bind(std::move(surface_info_));
32 client_binding_.reset(new mojo::Binding<mojom::SurfaceClient>(
33 this, std::move(client_request_)));
34 }
35
36 void WindowSurface::SubmitCompositorFrame(cc::CompositorFrame frame,
37 const base::Closure& callback) {
38 DCHECK(thread_checker_);
39 DCHECK(thread_checker_->CalledOnValidThread());
40 if (!surface_)
41 return;
42 surface_->SubmitCompositorFrame(std::move(frame), callback);
43 }
44
45 WindowSurface::WindowSurface(
46 mojo::InterfacePtrInfo<mojom::Surface> surface_info,
47 mojo::InterfaceRequest<mojom::SurfaceClient> client_request)
48 : client_(nullptr),
49 surface_info_(std::move(surface_info)),
50 client_request_(std::move(client_request)) {}
51
52 void WindowSurface::ReturnResources(
53 mojo::Array<cc::ReturnedResource> resources) {
54 DCHECK(thread_checker_);
55 DCHECK(thread_checker_->CalledOnValidThread());
56 if (!client_)
57 return;
58 client_->OnResourcesReturned(this, std::move(resources));
59 }
60
61 WindowSurfaceBinding::~WindowSurfaceBinding() {}
62
63 WindowSurfaceBinding::WindowSurfaceBinding(
64 mojo::InterfaceRequest<mojom::Surface> surface_request,
65 mojo::InterfacePtrInfo<mojom::SurfaceClient> surface_client)
66 : surface_request_(std::move(surface_request)),
67 surface_client_(std::move(surface_client)) {}
68
69 } // namespace mus
OLDNEW
« no previous file with comments | « components/mus/public/cpp/lib/window_private.cc ('k') | components/mus/public/cpp/lib/window_tree_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698