Commit af34a40c authored by Xiaohan Wang's avatar Xiaohan Wang Committed by Commit Bot

Warn unused result for ScopedHString::ResolveCoreWinRTStringDelayload()

Also fix MediaFoundationProtectionManager to check the result of
ScopedHString::ResolveCoreWinRTStringDelayload().

Change-Id: Ic9e37cfe3a7a53fd38332002d2396345ea1f78cf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2119373
Commit-Queue: Xiaohan Wang <xhwang@chromium.org>
Reviewed-by: default avatarRobert Liao <robliao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#753238}
parent ba434773
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <hstring.h> #include <hstring.h>
#include "base/compiler_specific.h"
#include "base/scoped_generic.h" #include "base/scoped_generic.h"
#include "base/strings/string_piece_forward.h" #include "base/strings/string_piece_forward.h"
...@@ -61,7 +62,7 @@ class BASE_EXPORT ScopedHString ...@@ -61,7 +62,7 @@ class BASE_EXPORT ScopedHString
static ScopedHString Create(StringPiece str); static ScopedHString Create(StringPiece str);
// Loads all required HSTRING functions, available from Win8 and onwards. // Loads all required HSTRING functions, available from Win8 and onwards.
static bool ResolveCoreWinRTStringDelayload(); static bool ResolveCoreWinRTStringDelayload() WARN_UNUSED_RESULT;
// Returns a view into the memory buffer managed by the instance. The returned // Returns a view into the memory buffer managed by the instance. The returned
// StringPiece is only valid during the lifetime of this ScopedHString // StringPiece is only valid during the lifetime of this ScopedHString
......
...@@ -24,9 +24,11 @@ MediaFoundationProtectionManager::~MediaFoundationProtectionManager() = default; ...@@ -24,9 +24,11 @@ MediaFoundationProtectionManager::~MediaFoundationProtectionManager() = default;
HRESULT MediaFoundationProtectionManager::RuntimeClassInitialize() { HRESULT MediaFoundationProtectionManager::RuntimeClassInitialize() {
DVLOG(1) << __func__ << ": this=" << this; DVLOG(1) << __func__ << ": this=" << this;
if (!base::win::ScopedHString::ResolveCoreWinRTStringDelayload())
return E_FAIL;
// Init an empty |property_set_| as MFMediaEngine could access it via // Init an empty |property_set_| as MFMediaEngine could access it via
// |get_Properties| before we populate it within SetPMPServer. // |get_Properties| before we populate it within SetPMPServer.
base::win::ScopedHString::ResolveCoreWinRTStringDelayload();
base::win::ScopedHString property_set_id = base::win::ScopedHString::Create( base::win::ScopedHString property_set_id = base::win::ScopedHString::Create(
RuntimeClass_Windows_Foundation_Collections_PropertySet); RuntimeClass_Windows_Foundation_Collections_PropertySet);
RETURN_IF_FAILED( RETURN_IF_FAILED(
...@@ -53,11 +55,11 @@ HRESULT MediaFoundationProtectionManager::SetPMPServer( ...@@ -53,11 +55,11 @@ HRESULT MediaFoundationProtectionManager::SetPMPServer(
ComPtr<ABI::Windows::Foundation::Collections::IMap<HSTRING, IInspectable*>> ComPtr<ABI::Windows::Foundation::Collections::IMap<HSTRING, IInspectable*>>
property_map; property_map;
RETURN_IF_FAILED(property_set_.As(&property_map)); RETURN_IF_FAILED(property_set_.As(&property_map));
boolean replaced = false;
base::win::ScopedHString::ResolveCoreWinRTStringDelayload();
// MFMediaEngine uses |pmp_server_key| to get the Protected Media Path (PMP) // MFMediaEngine uses |pmp_server_key| to get the Protected Media Path (PMP)
// server used for playing protected content. This is not currently documented // server used for playing protected content. This is not currently documented
// in MSDN. // in MSDN.
boolean replaced = false;
base::win::ScopedHString pmp_server_key = base::win::ScopedHString::Create( base::win::ScopedHString pmp_server_key = base::win::ScopedHString::Create(
L"Windows.Media.Protection.MediaProtectionPMPServer"); L"Windows.Media.Protection.MediaProtectionPMPServer");
RETURN_IF_FAILED( RETURN_IF_FAILED(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment