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

Unified Diff: content/renderer/media/crypto/cdm_initialized_promise.cc

Issue 1102363005: Initialize the CDM asynchronously (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Create() changes Created 5 years, 8 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
Index: content/renderer/media/crypto/cdm_initialized_promise.cc
diff --git a/content/renderer/media/crypto/cdm_initialized_promise.cc b/content/renderer/media/crypto/cdm_initialized_promise.cc
new file mode 100644
index 0000000000000000000000000000000000000000..5a72c6d0fc29ceeca648d0794c1e264e37afa389
--- /dev/null
+++ b/content/renderer/media/crypto/cdm_initialized_promise.cc
@@ -0,0 +1,30 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/renderer/media/crypto/cdm_initialized_promise.h"
+
+namespace content {
+
+CdmInitializedPromise::CdmInitializedPromise(
+ const media::CdmCreatedCB& cdm_created_cb,
+ scoped_ptr<media::MediaKeys> cdm)
+ : cdm_created_cb_(cdm_created_cb), cdm_(cdm.Pass()) {
+}
+
+CdmInitializedPromise::~CdmInitializedPromise() {
+}
+
+void CdmInitializedPromise::resolve() {
+ MarkPromiseSettled();
+ cdm_created_cb_.Run(cdm_.Pass());
+}
+
+void CdmInitializedPromise::reject(media::MediaKeys::Exception exception_code,
+ uint32 system_code,
+ const std::string& error_message) {
+ MarkPromiseSettled();
+ cdm_created_cb_.Run(nullptr);
+}
+
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698