Update to Chromium revision 9ef2aa86 (#550428)

This commit is contained in:
Marshall Greenblatt
2018-04-19 11:44:42 -04:00
parent f6c9a96a12
commit a3c55f1d26
130 changed files with 1601 additions and 1522 deletions

View File

@@ -9,38 +9,6 @@
using namespace crashpad;
namespace {
// Calls CrashReportDatabase::RecordUploadAttempt() with |successful| set to
// false upon destruction unless disarmed by calling Fire() or Disarm(). Fire()
// triggers an immediate call. Armed upon construction.
class CallRecordUploadAttempt {
public:
CallRecordUploadAttempt(CrashReportDatabase* database,
const CrashReportDatabase::Report* report)
: database_(database), report_(report) {}
~CallRecordUploadAttempt() { Fire(); }
void Fire() {
if (report_) {
database_->RecordUploadAttempt(report_, false, std::string());
}
Disarm();
}
void Disarm() { report_ = nullptr; }
private:
CrashReportDatabase* database_; // weak
const CrashReportDatabase::Report* report_; // weak
DISALLOW_COPY_AND_ASSIGN(CallRecordUploadAttempt);
};
} // namespace
CefCrashReportUploadThread::CefCrashReportUploadThread(
CrashReportDatabase* database,
const std::string& url,
@@ -109,7 +77,7 @@ void CefCrashReportUploadThread::ProcessPendingReport(
return;
}
const CrashReportDatabase::Report* upload_report;
std::unique_ptr<const CrashReportDatabase::UploadReport> upload_report;
CrashReportDatabase::OperationStatus status =
database_->GetReportForUploading(report.uuid, &upload_report);
switch (status) {
@@ -133,22 +101,19 @@ void CefCrashReportUploadThread::ProcessPendingReport(
return;
}
CallRecordUploadAttempt call_record_upload_attempt(database_, upload_report);
std::string response_body;
UploadResult upload_result = UploadReport(upload_report, &response_body);
UploadResult upload_result =
UploadReport(upload_report.get(), &response_body);
switch (upload_result) {
case UploadResult::kSuccess:
// The upload completed successfully.
call_record_upload_attempt.Disarm();
database_->RecordUploadAttempt(upload_report, true, response_body);
database_->RecordUploadComplete(std::move(upload_report), response_body);
if (MaxUploadsEnabled())
recent_upload_ct_++;
ResetBackoff();
break;
case UploadResult::kPermanentFailure:
// The upload should never be retried.
call_record_upload_attempt.Fire();
database_->SkipReportUpload(report.uuid,
Metrics::CrashSkippedReason::kUploadFailed);
break;

View File

@@ -204,17 +204,21 @@ void CefContentClient::AddPepperPlugins(
ComputeBuiltInPlugins(plugins);
AddPepperFlashFromCommandLine(plugins);
#if defined(OS_LINUX)
#if defined(WIDEVINE_CDM_AVAILABLE) && BUILDFLAG(ENABLE_LIBRARY_CDMS)
CefWidevineLoader::AddPepperPlugins(plugins);
#endif
#endif
content::PepperPluginInfo plugin;
if (GetSystemPepperFlash(&plugin))
plugins->push_back(plugin);
}
void CefContentClient::AddContentDecryptionModules(
std::vector<content::CdmInfo>* cdms,
std::vector<media::CdmHostFilePath>* cdm_host_file_paths) {
#if defined(OS_LINUX)
#if defined(WIDEVINE_CDM_AVAILABLE) && BUILDFLAG(ENABLE_LIBRARY_CDMS)
CefWidevineLoader::AddContentDecryptionModules(cdms, cdm_host_file_paths);
#endif
#endif
}
void CefContentClient::AddAdditionalSchemes(Schemes* schemes) {
DCHECK(!scheme_info_list_locked_);

View File

@@ -33,6 +33,9 @@ class CefContentClient : public content::ContentClient,
// content::ContentClient methods.
void AddPepperPlugins(
std::vector<content::PepperPluginInfo>* plugins) override;
void AddContentDecryptionModules(
std::vector<content::CdmInfo>* cdms,
std::vector<media::CdmHostFilePath>* cdm_host_file_paths) override;
void AddAdditionalSchemes(Schemes* schemes) override;
std::string GetProduct() const override;
std::string GetChromeProduct() const override;

View File

@@ -556,7 +556,7 @@ void CefCrashReporterClient::InitializeCrashReportingForProcess() {
if (embedded_handler) {
crash_reporter::InitializeCrashpadWithEmbeddedHandler(
process_type.empty(), install_static::UTF16ToUTF8(process_type),
std::string());
std::string(), base::FilePath());
} else {
crash_reporter::InitializeCrashpad(
process_type.empty(), install_static::UTF16ToUTF8(process_type));
@@ -603,6 +603,12 @@ bool CefCrashReporterClient::GetCrashMetricsLocation(
void CefCrashReporterClient::GetProductNameAndVersion(const char** product_name,
const char** version) {
GetProductNameAndVersion(product_name, version, nullptr);
}
void CefCrashReporterClient::GetProductNameAndVersion(const char** product_name,
const char** version,
const char** channel) {
*product_name = product_name_.c_str();
*version = product_version_.c_str();
}

View File

@@ -53,6 +53,9 @@ class CefCrashReporterClient : public crash_reporter::CrashReporterClient {
#elif defined(OS_POSIX)
void GetProductNameAndVersion(const char** product_name,
const char** version) override;
void GetProductNameAndVersion(const char** product_name,
const char** version,
const char** channel) override;
#if !defined(OS_MACOSX)
base::FilePath GetReporterLogFilename() override;
bool EnableBreakpadForProcess(const std::string& process_type) override;

View File

@@ -34,7 +34,7 @@
#include "content/public/common/content_switches.h"
#include "content/public/common/main_function_params.h"
#include "extensions/common/constants.h"
#include "ipc/ipc_features.h"
#include "ipc/ipc_buildflags.h"
#include "pdf/pdf_ppapi.h"
#include "ui/base/layout.h"
#include "ui/base/material_design/material_design_controller.h"

View File

@@ -8,7 +8,7 @@
#include "content/public/common/url_constants.h"
#include "extensions/common/constants.h"
#include "net/net_features.h"
#include "net/net_buildflags.h"
#include "url/url_constants.h"
namespace scheme {

View File

@@ -35,12 +35,12 @@
#include "net/url_request/url_fetcher.h"
#include "net/url_request/url_request.h"
#include "services/network/public/cpp/network_switches.h"
#include "third_party/WebKit/public/platform/WebString.h"
#include "third_party/WebKit/public/platform/WebURL.h"
#include "third_party/WebKit/public/platform/WebURLError.h"
#include "third_party/WebKit/public/platform/WebURLRequest.h"
#include "third_party/WebKit/public/platform/modules/fetch/fetch_api_request.mojom-shared.h"
#include "third_party/WebKit/public/web/WebSecurityPolicy.h"
#include "third_party/blink/public/platform/modules/fetch/fetch_api_request.mojom-shared.h"
#include "third_party/blink/public/platform/web_string.h"
#include "third_party/blink/public/platform/web_url.h"
#include "third_party/blink/public/platform/web_url_error.h"
#include "third_party/blink/public/platform/web_url_request.h"
#include "third_party/blink/public/web/web_security_policy.h"
namespace {

View File

@@ -13,8 +13,8 @@
#include "include/cef_request.h"
#include "base/synchronization/lock.h"
#include "third_party/WebKit/public/platform/WebHTTPBody.h"
#include "third_party/WebKit/public/platform/WebReferrerPolicy.h"
#include "third_party/blink/public/platform/web_http_body.h"
#include "third_party/blink/public/platform/web_referrer_policy.h"
#include "url/gurl.h"
namespace navigation_interception {

View File

@@ -11,10 +11,10 @@
#include "net/http/http_request_headers.h"
#include "net/http/http_response_headers.h"
#include "net/url_request/url_request.h"
#include "third_party/WebKit/public/platform/WebHTTPHeaderVisitor.h"
#include "third_party/WebKit/public/platform/WebString.h"
#include "third_party/WebKit/public/platform/WebURL.h"
#include "third_party/WebKit/public/platform/WebURLResponse.h"
#include "third_party/blink/public/platform/web_http_header_visitor.h"
#include "third_party/blink/public/platform/web_string.h"
#include "third_party/blink/public/platform/web_url.h"
#include "third_party/blink/public/platform/web_url_response.h"
#define CHECK_READONLY_RETURN_VOID() \
if (read_only_) { \

View File

@@ -13,6 +13,7 @@
#include "base/message_loop/message_loop.h"
#include "base/threading/thread_task_runner_handle.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/child_process_launcher_utils.h"
using content::BrowserThread;
@@ -73,6 +74,8 @@ scoped_refptr<base::SingleThreadTaskRunner> CefTaskRunnerImpl::GetTaskRunner(
return client->user_visible_task_runner();
case TID_FILE_USER_BLOCKING:
return client->user_blocking_task_runner();
case TID_PROCESS_LAUNCHER:
return content::GetProcessLauncherTaskRunner();
case TID_IO:
id = BrowserThread::IO;
break;
@@ -81,7 +84,7 @@ scoped_refptr<base::SingleThreadTaskRunner> CefTaskRunnerImpl::GetTaskRunner(
};
if (id >= 0 &&
BrowserThread::IsMessageLoopValid(static_cast<BrowserThread::ID>(id))) {
BrowserThread::IsThreadInitialized(static_cast<BrowserThread::ID>(id))) {
return BrowserThread::GetTaskRunnerForThread(
static_cast<BrowserThread::ID>(id));
}
@@ -98,7 +101,7 @@ CefTaskRunnerImpl::GetCurrentTaskRunner() {
// GetTaskRunner(). Otherwise BelongsToThread() will return incorrect results.
BrowserThread::ID current_id;
if (BrowserThread::GetCurrentThreadIdentifier(&current_id) &&
BrowserThread::IsMessageLoopValid(current_id)) {
BrowserThread::IsThreadInitialized(current_id)) {
task_runner = BrowserThread::GetTaskRunnerForThread(current_id);
}

View File

@@ -19,11 +19,11 @@
#include "base/strings/string_piece.h"
#include "base/strings/string_split.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/common/widevine_cdm_constants.h"
#include "content/browser/plugin_service_impl.h"
#include "content/public/browser/cdm_registry.h"
#include "content/public/common/cdm_info.h"
#include "content/public/common/content_switches.h"
#include "media/cdm/cdm_host_file.h"
#include "media/cdm/supported_cdm_versions.h"
namespace {
@@ -174,31 +174,9 @@ bool IsCompatibleWithChrome(const base::DictionaryValue& manifest,
error_message);
}
// Populate the PepperPluginInfo structure.
void GetPluginInfo(const base::FilePath& cdm_adapter_path,
const base::FilePath& cdm_path,
const std::string& cdm_version,
const std::string& cdm_codecs,
bool supports_persistent_license,
content::PepperPluginInfo* widevine_cdm) {
widevine_cdm->is_out_of_process = true;
widevine_cdm->path = cdm_adapter_path;
widevine_cdm->name = kWidevineCdmDisplayName;
widevine_cdm->description =
kWidevineCdmDescription + std::string(" (version: ") + cdm_version + ")";
widevine_cdm->version = cdm_version;
content::WebPluginMimeType widevine_cdm_mime_type(
kWidevineCdmPluginMimeType, kWidevineCdmPluginExtension,
kWidevineCdmPluginMimeTypeDescription);
widevine_cdm->mime_types.push_back(widevine_cdm_mime_type);
widevine_cdm->permissions = kWidevineCdmPluginPermissions;
}
// Verify and load the contents of |base_path|.
cef_cdm_registration_error_t LoadWidevineCdmInfo(
const base::FilePath& base_path,
base::FilePath* cdm_adapter_path,
base::FilePath* cdm_path,
std::string* cdm_version,
std::string* cdm_codecs,
@@ -206,13 +184,6 @@ cef_cdm_registration_error_t LoadWidevineCdmInfo(
std::string* error_message) {
std::stringstream ss;
*cdm_adapter_path = base_path.AppendASCII(kWidevineCdmAdapterFileName);
if (!base::PathExists(*cdm_adapter_path)) {
ss << "Missing adapter file " << cdm_adapter_path->value();
*error_message = ss.str();
return CEF_CDM_REGISTRATION_ERROR_INCORRECT_CONTENTS;
}
*cdm_path = base_path.AppendASCII(
base::GetNativeLibraryName(kWidevineCdmLibraryName));
if (!base::PathExists(*cdm_path)) {
@@ -286,33 +257,28 @@ std::vector<media::VideoCodec> ConvertCodecsString(const std::string& codecs) {
return supported_video_codecs;
}
void RegisterWidevineCdmOnUIThread(const base::FilePath& cdm_adapter_path,
const base::FilePath& cdm_path,
content::CdmInfo MakeCdmInfo(const base::FilePath& cdm_path,
const std::string& cdm_version,
const std::string& cdm_codecs,
bool supports_persistent_license) {
std::vector<media::VideoCodec> supported_video_codecs =
ConvertCodecsString(cdm_codecs);
return content::CdmInfo(
kWidevineCdmDisplayName, kWidevineCdmGuid, base::Version(cdm_version),
cdm_path, kWidevineCdmFileSystemId, supported_video_codecs,
supports_persistent_license, kWidevineKeySystem, false);
}
void RegisterWidevineCdmOnUIThread(const base::FilePath& cdm_path,
const std::string& cdm_version,
const std::string& cdm_codecs,
bool supports_persistent_license,
CefRefPtr<CefRegisterCdmCallback> callback) {
CEF_REQUIRE_UIT();
content::PepperPluginInfo widevine_cdm;
GetPluginInfo(cdm_adapter_path, cdm_path, cdm_version, cdm_codecs,
supports_persistent_license, &widevine_cdm);
// true = Add to beginning of list to override any existing registrations.
content::PluginService::GetInstance()->RegisterInternalPlugin(
widevine_cdm.ToWebPluginInfo(), true);
// Tell the browser to refresh the plugin list. Then tell all renderers to
// update their plugin list caches.
content::PluginService::GetInstance()->RefreshPlugins();
content::PluginService::GetInstance()->PurgePluginListCache(NULL, false);
// Also register Widevine with the CdmRegistry.
std::vector<media::VideoCodec> supported_video_codecs =
ConvertCodecsString(cdm_codecs);
content::CdmRegistry::GetInstance()->RegisterCdm(content::CdmInfo(
kWidevineCdmDisplayName, kWidevineCdmGuid, base::Version(cdm_version),
cdm_path, kWidevineCdmFileSystemId, supported_video_codecs,
supports_persistent_license, kWidevineKeySystem, false));
// Register Widevine with the CdmRegistry.
content::CdmRegistry::GetInstance()->RegisterCdm(MakeCdmInfo(
cdm_path, cdm_version, cdm_codecs, supports_persistent_license));
DeliverWidevineCdmCallback(CEF_CDM_REGISTRATION_ERROR_NONE, std::string(),
callback);
@@ -323,15 +289,14 @@ void LoadWidevineCdmInfoOnBlockingThread(
CefRefPtr<CefRegisterCdmCallback> callback) {
CEF_REQUIRE_BLOCKING();
base::FilePath cdm_adapter_path;
base::FilePath cdm_path;
std::string cdm_version;
std::string cdm_codecs;
bool supports_persistent_license;
std::string error_message;
cef_cdm_registration_error_t result = LoadWidevineCdmInfo(
base_path, &cdm_adapter_path, &cdm_path, &cdm_version, &cdm_codecs,
&supports_persistent_license, &error_message);
cef_cdm_registration_error_t result =
LoadWidevineCdmInfo(base_path, &cdm_path, &cdm_version, &cdm_codecs,
&supports_persistent_license, &error_message);
if (result != CEF_CDM_REGISTRATION_ERROR_NONE) {
CEF_POST_TASK(CEF_UIT, base::Bind(DeliverWidevineCdmCallback, result,
error_message, callback));
@@ -340,9 +305,8 @@ void LoadWidevineCdmInfoOnBlockingThread(
// Continue execution on the UI thread.
CEF_POST_TASK(CEF_UIT,
base::Bind(RegisterWidevineCdmOnUIThread, cdm_adapter_path,
cdm_path, cdm_version, cdm_codecs,
supports_persistent_license, callback));
base::Bind(RegisterWidevineCdmOnUIThread, cdm_path, cdm_version,
cdm_codecs, supports_persistent_license, callback));
}
} // namespace
@@ -379,8 +343,9 @@ void CefWidevineLoader::OnContextInitialized() {
#if defined(OS_LINUX)
// static
void CefWidevineLoader::AddPepperPlugins(
std::vector<content::PepperPluginInfo>* plugins) {
void CefWidevineLoader::AddContentDecryptionModules(
std::vector<content::CdmInfo>* cdms,
std::vector<media::CdmHostFilePath>* cdm_host_file_paths) {
const base::CommandLine& command_line =
*base::CommandLine::ForCurrentProcess();
@@ -409,18 +374,16 @@ void CefWidevineLoader::AddPepperPlugins(
std::string cdm_codecs;
bool supports_persistent_license;
std::string error_message;
cef_cdm_registration_error_t result = LoadWidevineCdmInfo(
base_path, &cdm_adapter_path, &cdm_path, &cdm_version, &cdm_codecs,
&supports_persistent_license, &error_message);
cef_cdm_registration_error_t result =
LoadWidevineCdmInfo(base_path, &cdm_path, &cdm_version, &cdm_codecs,
&supports_persistent_license, &error_message);
if (result != CEF_CDM_REGISTRATION_ERROR_NONE) {
LOG(ERROR) << "Widevine CDM registration failed; " << error_message;
return;
}
content::PepperPluginInfo widevine_cdm;
GetPluginInfo(cdm_adapter_path, cdm_path, cdm_version, cdm_codecs,
supports_persistent_license, &widevine_cdm);
plugins->push_back(widevine_cdm);
cdms->push_back(MakeCdmInfo(cdm_path, cdm_version, cdm_codecs,
supports_persistent_license));
}
#endif // defined(OS_LINUX)

View File

@@ -19,7 +19,11 @@
#include "base/lazy_instance.h"
namespace content {
struct PepperPluginInfo;
struct CdmInfo;
}
namespace media {
struct CdmHostFilePath;
}
class CefWidevineLoader {
@@ -38,10 +42,12 @@ class CefWidevineLoader {
#if defined(OS_LINUX)
// The zygote process which is used when the sandbox is enabled on Linux
// requires early loading of pepper plugins. Other processes will receive
// requires early loading of CDM modules. Other processes will receive
// load notification in the usual way.
// Called from CefContentClient::AddPepperPlugins.
static void AddPepperPlugins(std::vector<content::PepperPluginInfo>* plugins);
// Called from CefContentClient::AddContentDecryptionModules.
static void AddContentDecryptionModules(
std::vector<content::CdmInfo>* cdms,
std::vector<media::CdmHostFilePath>* cdm_host_file_paths);
const base::FilePath& path() { return path_; }
#endif