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

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

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.h
diff --git a/content/renderer/media/crypto/cdm_initialized_promise.h b/content/renderer/media/crypto/cdm_initialized_promise.h
new file mode 100644
index 0000000000000000000000000000000000000000..7c3d4c38116c98bac993876ad46c494b0dee8f27
--- /dev/null
+++ b/content/renderer/media/crypto/cdm_initialized_promise.h
@@ -0,0 +1,39 @@
+// 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.
+
+#ifndef CONTENT_RENDERER_MEDIA_CRYPTO_CDM_INITIALIZED_PROMISE_H_
+#define CONTENT_RENDERER_MEDIA_CRYPTO_CDM_INITIALIZED_PROMISE_H_
+
+#include <string>
+
+#include "base/memory/scoped_ptr.h"
+#include "media/base/cdm_factory.h"
+#include "media/base/cdm_promise.h"
+#include "media/base/media_keys.h"
+
+namespace content {
+
+// Promise to be resolved when the CDM is initialized. It owns the MediaKeys
+// object until the initialization completes, which it then passes to
+// |cdm_created_cb|.
+class CdmInitializedPromise : public media::SimpleCdmPromise {
+ public:
+ CdmInitializedPromise(const media::CdmCreatedCB& cdm_created_cb,
+ scoped_ptr<media::MediaKeys> cdm);
+ ~CdmInitializedPromise() override;
+
+ // SimpleCdmPromise implementation.
+ void resolve() override;
+ void reject(media::MediaKeys::Exception exception_code,
+ uint32 system_code,
+ const std::string& error_message) override;
+
+ private:
+ media::CdmCreatedCB cdm_created_cb_;
+ scoped_ptr<media::MediaKeys> cdm_;
+};
+
+} // namespace content
+
+#endif // CONTENT_RENDERER_MEDIA_CRYPTO_CDM_INITIALIZED_PROMISE_H_

Powered by Google App Engine
This is Rietveld 408576698