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

Unified Diff: chrome/gpu/gpu_arc_video_service.cc

Issue 2326913003: Privatize StrongBinding lifetime management (Closed)
Patch Set: rebase Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/gpu/gpu_arc_video_service.h ('k') | chrome/renderer/chrome_render_thread_observer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/gpu/gpu_arc_video_service.cc
diff --git a/chrome/gpu/gpu_arc_video_service.cc b/chrome/gpu/gpu_arc_video_service.cc
index b765b10085cdc392b7b4e6ff0488cba76c61b498..b18feac72d07437542c41fa3cc32e94feff8169b 100644
--- a/chrome/gpu/gpu_arc_video_service.cc
+++ b/chrome/gpu/gpu_arc_video_service.cc
@@ -8,8 +8,10 @@
#include "base/bind.h"
#include "base/logging.h"
+#include "base/memory/ptr_util.h"
#include "base/threading/thread_task_runner_handle.h"
#include "chrome/gpu/arc_gpu_video_decode_accelerator.h"
+#include "mojo/public/cpp/bindings/strong_binding.h"
#include "mojo/public/cpp/bindings/type_converter.h"
#include "mojo/public/cpp/system/platform_handle.h"
@@ -134,37 +136,31 @@ namespace arc {
GpuArcVideoService::GpuArcVideoService(
const gpu::GpuPreferences& gpu_preferences)
- : gpu_preferences_(gpu_preferences), binding_(this) {}
-
-GpuArcVideoService::GpuArcVideoService(
- ::arc::mojom::VideoAcceleratorServiceRequest request,
- const gpu::GpuPreferences& gpu_preferences)
: gpu_preferences_(gpu_preferences),
- accelerator_(new ArcGpuVideoDecodeAccelerator(gpu_preferences_)),
- binding_(this, std::move(request)) {
- DVLOG(2) << "GpuArcVideoService connected";
- binding_.set_connection_error_handler(base::Bind(&OnConnectionError));
-}
+ accelerator_(new ArcGpuVideoDecodeAccelerator(gpu_preferences_)) {}
GpuArcVideoService::~GpuArcVideoService() {
DCHECK(thread_checker_.CalledOnValidThread());
}
-void GpuArcVideoService::Connect(
- ::arc::mojom::VideoAcceleratorServiceClientRequest request) {
+// static
+void GpuArcVideoService::DeprecatedConnect(
+ std::unique_ptr<GpuArcVideoService> service,
+ ::arc::mojom::VideoAcceleratorServiceClientRequest client_request) {
DVLOG(2) << "Connect";
- client_.Bind(::arc::mojom::VideoAcceleratorServiceClientPtrInfo(
- request.PassMessagePipe(), 0u));
- client_.set_connection_error_handler(base::Bind(&OnConnectionError));
-
- accelerator_.reset(new ArcGpuVideoDecodeAccelerator(gpu_preferences_));
+ service->client_.Bind(::arc::mojom::VideoAcceleratorServiceClientPtrInfo(
+ client_request.PassMessagePipe(), 0u));
+ service->client_.set_connection_error_handler(base::Bind(&OnConnectionError));
- ::arc::mojom::VideoAcceleratorServicePtr service;
- binding_.Bind(GetProxy(&service));
- binding_.set_connection_error_handler(base::Bind(&OnConnectionError));
+ ::arc::mojom::VideoAcceleratorServicePtr service_proxy;
+ ::arc::mojom::VideoAcceleratorServiceRequest request =
+ mojo::GetProxy(&service_proxy);
+ service->client_->DeprecatedInit(std::move(service_proxy));
- client_->DeprecatedInit(std::move(service));
+ auto binding = mojo::MakeStrongBinding(std::move(service),
+ mojo::GetProxy(&service_proxy));
+ binding->set_connection_error_handler(base::Bind(&OnConnectionError));
}
void GpuArcVideoService::OnError(ArcVideoAccelerator::Result error) {
« no previous file with comments | « chrome/gpu/gpu_arc_video_service.h ('k') | chrome/renderer/chrome_render_thread_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698