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

Unified Diff: chrome/gpu/gpu_arc_video_service.cc

Issue 2036723002: Limit the number of ARC codec (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address dcheng's comments: static_assert Created 4 years, 6 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') | components/arc/common/video_accelerator.mojom » ('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 3d788ec4c2fc2fde1bc9e4a39d4540f24e6a5a7c..980ca95aeab04d062f18a6b9c80915b21a7a2469 100644
--- a/chrome/gpu/gpu_arc_video_service.cc
+++ b/chrome/gpu/gpu_arc_video_service.cc
@@ -13,6 +13,37 @@
#include "mojo/public/cpp/bindings/type_converter.h"
#include "mojo/public/cpp/system/platform_handle.h"
+// Make sure arc::mojom::VideoAcceleratorService::Result and
+// chromeos::arc::ArcVideoAccelerator::Result match.
+static_assert(
+ static_cast<int>(arc::mojom::VideoAcceleratorService::Result::SUCCESS) ==
+ chromeos::arc::ArcVideoAccelerator::SUCCESS,
+ "enum mismatch");
+static_assert(static_cast<int>(
+ arc::mojom::VideoAcceleratorService::Result::ILLEGAL_STATE) ==
+ chromeos::arc::ArcVideoAccelerator::ILLEGAL_STATE,
+ "enum mismatch");
+static_assert(
+ static_cast<int>(
+ arc::mojom::VideoAcceleratorService::Result::INVALID_ARGUMENT) ==
+ chromeos::arc::ArcVideoAccelerator::INVALID_ARGUMENT,
+ "enum mismatch");
+static_assert(
+ static_cast<int>(
+ arc::mojom::VideoAcceleratorService::Result::UNREADABLE_INPUT) ==
+ chromeos::arc::ArcVideoAccelerator::UNREADABLE_INPUT,
+ "enum mismatch");
+static_assert(
+ static_cast<int>(
+ arc::mojom::VideoAcceleratorService::Result::PLATFORM_FAILURE) ==
+ chromeos::arc::ArcVideoAccelerator::PLATFORM_FAILURE,
+ "enum mismatch");
+static_assert(
+ static_cast<int>(
+ arc::mojom::VideoAcceleratorService::Result::INSUFFICIENT_RESOURCES) ==
+ chromeos::arc::ArcVideoAccelerator::INSUFFICIENT_RESOURCES,
+ "enum mismatch");
+
namespace {
void OnConnectionError() {
DVLOG(2) << "OnConnectionError";
@@ -106,10 +137,11 @@ void GpuArcVideoService::Connect(
client_->Init(std::move(service));
}
-void GpuArcVideoService::OnError(ArcVideoAccelerator::Error error) {
+void GpuArcVideoService::OnError(ArcVideoAccelerator::Result error) {
DVLOG(2) << "OnError " << error;
+ DCHECK_NE(error, ArcVideoAccelerator::SUCCESS);
client_->OnError(
- static_cast<::arc::mojom::VideoAcceleratorServiceClient::Error>(error));
+ static_cast<::arc::mojom::VideoAcceleratorService::Result>(error));
}
void GpuArcVideoService::OnBufferDone(PortType port,
@@ -139,9 +171,19 @@ void GpuArcVideoService::Initialize(
::arc::mojom::ArcVideoAcceleratorConfigPtr config,
const InitializeCallback& callback) {
DVLOG(2) << "Initialize";
- bool result =
+ ArcVideoAccelerator::Result result =
+ accelerator_->Initialize(config.To<ArcVideoAccelerator::Config>(), this);
+ callback.Run(
+ static_cast<::arc::mojom::VideoAcceleratorService::Result>(result));
+}
+
+void GpuArcVideoService::DeprecatedInitialize(
+ ::arc::mojom::ArcVideoAcceleratorConfigPtr config,
+ const DeprecatedInitializeCallback& callback) {
+ DVLOG(2) << "DeprecatedInitialize";
+ ArcVideoAccelerator::Result result =
accelerator_->Initialize(config.To<ArcVideoAccelerator::Config>(), this);
- callback.Run(result);
+ callback.Run(result == ArcVideoAccelerator::SUCCESS);
}
base::ScopedFD GpuArcVideoService::UnwrapFdFromMojoHandle(
@@ -149,7 +191,7 @@ base::ScopedFD GpuArcVideoService::UnwrapFdFromMojoHandle(
if (!handle.is_valid()) {
LOG(ERROR) << "handle is invalid";
client_->OnError(
- ::arc::mojom::VideoAcceleratorServiceClient::Error::INVALID_ARGUMENT);
+ ::arc::mojom::VideoAcceleratorService::Result::INVALID_ARGUMENT);
return base::ScopedFD();
}
@@ -159,7 +201,7 @@ base::ScopedFD GpuArcVideoService::UnwrapFdFromMojoHandle(
if (mojo_result != MOJO_RESULT_OK) {
LOG(ERROR) << "UnwrapPlatformFile failed: " << mojo_result;
client_->OnError(
- ::arc::mojom::VideoAcceleratorServiceClient::Error::PLATFORM_FAILURE);
+ ::arc::mojom::VideoAcceleratorService::Result::PLATFORM_FAILURE);
return base::ScopedFD();
}
« no previous file with comments | « chrome/gpu/gpu_arc_video_service.h ('k') | components/arc/common/video_accelerator.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698