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

Side by Side Diff: media/mojo/clients/mojo_android_overlay.cc

Issue 2864603002: Provide callback to create mojo AndroidOverlays to AVDA. (Closed)
Patch Set: rebased Created 3 years, 7 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
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 "media/mojo/clients/mojo_android_overlay.h" 5 #include "media/mojo/clients/mojo_android_overlay.h"
6 6
7 #include "gpu/ipc/common/gpu_surface_lookup.h" 7 #include "gpu/ipc/common/gpu_surface_lookup.h"
8 #include "services/service_manager/public/cpp/connect.h" 8 #include "services/service_manager/public/cpp/connect.h"
9 #include "services/service_manager/public/interfaces/interface_provider.mojom.h"
10 9
11 namespace media { 10 namespace media {
12 11
13 MojoAndroidOverlay::MojoAndroidOverlay( 12 MojoAndroidOverlay::MojoAndroidOverlay(
14 service_manager::mojom::InterfaceProvider* interface_provider, 13 mojom::AndroidOverlayProviderPtr provider_ptr,
15 AndroidOverlayConfig config, 14 AndroidOverlayConfig config,
16 const base::UnguessableToken& routing_token) 15 const base::UnguessableToken& routing_token)
17 : interface_provider_(interface_provider), config_(std::move(config)) { 16 : config_(std::move(config)) {
18 // Connect to the provider service.
19 mojom::AndroidOverlayProviderPtr provider_ptr;
20 service_manager::GetInterface<mojom::AndroidOverlayProvider>(
21 interface_provider_, &provider_ptr_);
22
23 // Fill in details of |config| into |mojo_config|. Our caller could do this 17 // Fill in details of |config| into |mojo_config|. Our caller could do this
24 // too, but since we want to retain |config_| anyway, we do it here. 18 // too, but since we want to retain |config_| anyway, we do it here.
25 mojom::AndroidOverlayConfigPtr mojo_config = 19 mojom::AndroidOverlayConfigPtr mojo_config =
26 mojom::AndroidOverlayConfig::New(); 20 mojom::AndroidOverlayConfig::New();
27 mojo_config->routing_token = routing_token; 21 mojo_config->routing_token = routing_token;
28 mojo_config->rect = config_.rect; 22 mojo_config->rect = config_.rect;
29 mojo_config->secure = config_.secure; 23 mojo_config->secure = config_.secure;
30 24
31 mojom::AndroidOverlayClientPtr ptr; 25 mojom::AndroidOverlayClientPtr ptr;
32 binding_ = base::MakeUnique<mojo::Binding<mojom::AndroidOverlayClient>>( 26 binding_ = base::MakeUnique<mojo::Binding<mojom::AndroidOverlayClient>>(
33 this, mojo::MakeRequest(&ptr)); 27 this, mojo::MakeRequest(&ptr));
34 28
35 provider_ptr_->CreateOverlay(mojo::MakeRequest(&overlay_ptr_), std::move(ptr), 29 provider_ptr->CreateOverlay(mojo::MakeRequest(&overlay_ptr_), std::move(ptr),
36 std::move(mojo_config)); 30 std::move(mojo_config));
37 } 31 }
38 32
39 MojoAndroidOverlay::~MojoAndroidOverlay() { 33 MojoAndroidOverlay::~MojoAndroidOverlay() {
40 // Dropping |overlay_ptr_| will signal to the implementation that we're done 34 // Dropping |overlay_ptr_| will signal to the implementation that we're done
41 // with the surface. If a synchronous destroy is pending, then it can be 35 // with the surface. If a synchronous destroy is pending, then it can be
42 // allowed to continue. 36 // allowed to continue.
43 } 37 }
44 38
45 void MojoAndroidOverlay::ScheduleLayout(const gfx::Rect& rect) { 39 void MojoAndroidOverlay::ScheduleLayout(const gfx::Rect& rect) {
46 // If we haven't gotten the surface yet, then ignore this. 40 // If we haven't gotten the surface yet, then ignore this.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 if (!received_surface_) 73 if (!received_surface_)
80 config_.is_failed(this); 74 config_.is_failed(this);
81 else 75 else
82 config_.is_destroyed(this); 76 config_.is_destroyed(this);
83 77
84 // Note: we do not delete |overlay_ptr_| here. Our client must delete us to 78 // Note: we do not delete |overlay_ptr_| here. Our client must delete us to
85 // signal that we should do that, since it still might be in use. 79 // signal that we should do that, since it still might be in use.
86 } 80 }
87 81
88 } // namespace media 82 } // namespace media
OLDNEW
« no previous file with comments | « media/mojo/clients/mojo_android_overlay.h ('k') | media/mojo/clients/mojo_android_overlay_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698