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

Side by Side Diff: media/cdm/stub/stub_cdm.cc

Issue 1326413003: Use checked_cast<> to avoid compile errors on Windows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/cdm/stub/stub_cdm.h" 5 #include "media/cdm/stub/stub_cdm.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/numerics/safe_conversions.h"
8 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
9 10
10 // Version number for this stub. The third number represents the 11 // Version number for this stub. The third number represents the
11 // cdm::ContentDecryptionModule version. 12 // cdm::ContentDecryptionModule version.
12 const char kStubCdmVersion[] = "1.4.8.0"; 13 const char kStubCdmVersion[] = "1.4.8.0";
13 14
14 void INITIALIZE_CDM_MODULE() { 15 void INITIALIZE_CDM_MODULE() {
15 } 16 }
16 17
17 void DeinitializeCdmModule() { 18 void DeinitializeCdmModule() {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 55
55 void StubCdm::CreateSessionAndGenerateRequest( 56 void StubCdm::CreateSessionAndGenerateRequest(
56 uint32 promise_id, 57 uint32 promise_id,
57 cdm::SessionType /* session_type */, 58 cdm::SessionType /* session_type */,
58 cdm::InitDataType /* init_data_type */, 59 cdm::InitDataType /* init_data_type */,
59 const uint8* /* init_data */, 60 const uint8* /* init_data */,
60 uint32 /* init_data_size */) { 61 uint32 /* init_data_size */) {
61 // Provide a dummy message (with a trivial session ID) to enable some testing 62 // Provide a dummy message (with a trivial session ID) to enable some testing
62 // and be consistent with existing testing without a license server. 63 // and be consistent with existing testing without a license server.
63 std::string session_id(base::UintToString(next_session_id_++)); 64 std::string session_id(base::UintToString(next_session_id_++));
64 host_->OnResolveNewSessionPromise(promise_id, session_id.data(), 65 host_->OnResolveNewSessionPromise(
65 session_id.length()); 66 promise_id, session_id.data(),
66 host_->OnSessionMessage(session_id.data(), session_id.length(), 67 base::checked_cast<uint32_t>(session_id.length()));
68 host_->OnSessionMessage(session_id.data(),
69 base::checked_cast<uint32_t>(session_id.length()),
67 cdm::kLicenseRequest, nullptr, 0, nullptr, 0); 70 cdm::kLicenseRequest, nullptr, 0, nullptr, 0);
68 } 71 }
69 72
70 void StubCdm::LoadSession(uint32 promise_id, 73 void StubCdm::LoadSession(uint32 promise_id,
71 cdm::SessionType /* session_type */, 74 cdm::SessionType /* session_type */,
72 const char* /* session_id */, 75 const char* /* session_id */,
73 uint32_t /* session_id_length */) { 76 uint32_t /* session_id_length */) {
74 FailRequest(promise_id); 77 FailRequest(promise_id);
75 } 78 }
76 79
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 void StubCdm::OnQueryOutputProtectionStatus( 152 void StubCdm::OnQueryOutputProtectionStatus(
150 cdm::QueryResult /* result */, 153 cdm::QueryResult /* result */,
151 uint32_t /* link_mask */, 154 uint32_t /* link_mask */,
152 uint32_t /* output_protection_mask */) { 155 uint32_t /* output_protection_mask */) {
153 NOTREACHED(); 156 NOTREACHED();
154 }; 157 };
155 158
156 void StubCdm::FailRequest(uint32 promise_id) { 159 void StubCdm::FailRequest(uint32 promise_id) {
157 std::string message("Operation not supported by stub CDM."); 160 std::string message("Operation not supported by stub CDM.");
158 host_->OnRejectPromise(promise_id, cdm::kInvalidAccessError, 0, 161 host_->OnRejectPromise(promise_id, cdm::kInvalidAccessError, 0,
159 message.data(), message.length()); 162 message.data(),
163 base::checked_cast<uint32_t>(message.length()));
160 } 164 }
161 165
162 } // namespace media 166 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698