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

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

Issue 2867633002: Fetch the surface from GpuSurfaceTracker for mojo AndroidOverlay. (Closed)
Patch Set: started checking surface obj 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
« no previous file with comments | « media/mojo/clients/BUILD.gn ('k') | media/mojo/clients/mojo_android_overlay_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "services/service_manager/public/cpp/connect.h" 8 #include "services/service_manager/public/cpp/connect.h"
8 #include "services/service_manager/public/interfaces/interface_provider.mojom.h" 9 #include "services/service_manager/public/interfaces/interface_provider.mojom.h"
9 10
10 namespace media { 11 namespace media {
11 12
12 MojoAndroidOverlay::MojoAndroidOverlay( 13 MojoAndroidOverlay::MojoAndroidOverlay(
13 service_manager::mojom::InterfaceProvider* interface_provider, 14 service_manager::mojom::InterfaceProvider* interface_provider,
14 AndroidOverlayConfig config, 15 AndroidOverlayConfig config,
15 const base::UnguessableToken& routing_token) 16 const base::UnguessableToken& routing_token)
16 : interface_provider_(interface_provider), config_(std::move(config)) { 17 : interface_provider_(interface_provider), config_(std::move(config)) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 49
49 overlay_ptr_->ScheduleLayout(rect); 50 overlay_ptr_->ScheduleLayout(rect);
50 } 51 }
51 52
52 const base::android::JavaRef<jobject>& MojoAndroidOverlay::GetJavaSurface() 53 const base::android::JavaRef<jobject>& MojoAndroidOverlay::GetJavaSurface()
53 const { 54 const {
54 return surface_.j_surface(); 55 return surface_.j_surface();
55 } 56 }
56 57
57 void MojoAndroidOverlay::OnSurfaceReady(uint64_t surface_key) { 58 void MojoAndroidOverlay::OnSurfaceReady(uint64_t surface_key) {
58 // TODO(liberato): ask binder for the surface here, and fill in |surface_|.
59 received_surface_ = true; 59 received_surface_ = true;
60
61 // Get the surface and notify our client.
62 surface_ =
63 gpu::GpuSurfaceLookup::GetInstance()->AcquireJavaSurface(surface_key);
64
65 // If no surface was returned, then fail instead.
66 if (surface_.IsEmpty()) {
67 config_.is_failed(this);
68 // |this| may be deleted.
69 return;
70 }
71
60 config_.is_ready(this); 72 config_.is_ready(this);
61 } 73 }
62 74
63 void MojoAndroidOverlay::OnDestroyed() { 75 void MojoAndroidOverlay::OnDestroyed() {
64 // Note that |overlay_ptr_| might not be bound yet, or we might not have ever 76 // Note that |overlay_ptr_| might not be bound yet, or we might not have ever
65 // gotten a surface. Regardless, the overlay cannot be used. 77 // gotten a surface. Regardless, the overlay cannot be used.
66 78
67 if (!received_surface_) 79 if (!received_surface_)
68 config_.is_failed(this); 80 config_.is_failed(this);
69 else 81 else
70 config_.is_destroyed(this); 82 config_.is_destroyed(this);
71 83
72 // Note: we do not delete |overlay_ptr_| here. Our client must delete us to 84 // Note: we do not delete |overlay_ptr_| here. Our client must delete us to
73 // signal that we should do that, since it still might be in use. 85 // signal that we should do that, since it still might be in use.
74 } 86 }
75 87
76 } // namespace media 88 } // namespace media
OLDNEW
« no previous file with comments | « media/mojo/clients/BUILD.gn ('k') | media/mojo/clients/mojo_android_overlay_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698