Merge pull request #13756 from electron/chromium-upgrade/67

chore: Chromium 67
This commit is contained in:
Jeremy Apthorp 2018-09-11 14:56:11 -07:00 committed by GitHub
commit f8828aa804
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
95 changed files with 511 additions and 495 deletions

View file

@ -232,7 +232,7 @@ static_library("electron_lib") {
"//ppapi/shared_impl",
"//printing",
"//skia",
"//third_party/WebKit/public:blink",
"//third_party/blink/public:blink",
"//third_party/boringssl",
"//third_party/electron_node:node_lib",
"//third_party/leveldatabase",
@ -258,7 +258,7 @@ static_library("electron_lib") {
# TODO(nornagon): replace usage of SchemeRegistry by an actually exported
# API of blink, then remove this from the include_dirs.
"//third_party/WebKit/Source",
"//third_party/blink/renderer",
]
defines = []
@ -400,6 +400,7 @@ static_library("electron_lib") {
]
deps += [
"//components/viz/service",
"//services/viz/public/interfaces",
"//ui/compositor",
]
}
@ -437,8 +438,6 @@ static_library("electron_lib") {
if (enable_widevine) {
sources += [
"//chrome/common/widevine_cdm_constants.cc",
"//chrome/common/widevine_cdm_constants.h",
"//chrome/renderer/media/chrome_key_systems.cc",
"//chrome/renderer/media/chrome_key_systems.h",
"//chrome/renderer/media/chrome_key_systems_provider.cc",
@ -763,8 +762,8 @@ group("blink_unittests") {
testonly = true
deps = [
"//third_party/WebKit/public:all_blink",
"//third_party/WebKit/public:test_support",
"//third_party/blink/public:all_blink",
"//third_party/blink/public:test_support",
]
}
@ -780,7 +779,6 @@ group("chromium_unittests") {
"//device:device_unittests",
"//gin:gin_unittests",
"//gpu:gpu_unittests",
"//gpu/ipc/service:gpu_ipc_service_unittests",
"//ipc:ipc_tests",
"//media:media_unittests",
"//media/capture:capture_unittests",

6
DEPS
View file

@ -1,10 +1,10 @@
vars = {
'chromium_version':
'66.0.3359.181',
'67.0.3396.99',
'libchromiumcontent_revision':
'f3a3f588281aba034a0f1f85ca3c65eb5a3f7b66',
'5db6529f9663a48ee3e6f4265a6abe7806f1dfbf',
'node_version':
'6d1bdd3ebf860ff878a1b5db4fd26fdda3932e21',
'95bb1b1046a648994dfe85340aca21fee0179855',
'chromium_git':
'https://chromium.googlesource.com',

View file

@ -1,6 +1,6 @@
version: 1.0.{build}
build_cloud: libcc-20
image: libcc-20-vs2017-15.4.5
image: libcc-20-vs2017-15.7.4
environment:
GIT_CACHE_PATH: C:\Users\electron\libcc_cache
DISABLE_CRASH_REPORTER_TESTS: true

View file

@ -18,7 +18,6 @@
#include "content/public/common/content_constants.h"
#include "content/public/common/pepper_plugin_info.h"
#include "content/public/common/user_agent.h"
#include "media/media_features.h"
#include "ppapi/shared_impl/ppapi_permissions.h"
#include "ui/base/l10n/l10n_util.h"
#include "url/url_constants.h"
@ -27,8 +26,6 @@
#if defined(WIDEVINE_CDM_AVAILABLE)
#include "base/native_library.h"
#include "base/strings/stringprintf.h"
#include "chrome/common/widevine_cdm_constants.h"
#include "content/public/common/cdm_info.h"
#include "media/base/video_codecs.h"
#endif // defined(WIDEVINE_CDM_AVAILABLE)
@ -43,8 +40,7 @@ namespace atom {
namespace {
#if defined(WIDEVINE_CDM_AVAILABLE)
bool IsWidevineAvailable(base::FilePath* adapter_path,
base::FilePath* cdm_path,
bool IsWidevineAvailable(base::FilePath* cdm_path,
std::vector<media::VideoCodec>* codecs_supported) {
static enum {
NOT_CHECKED,
@ -52,60 +48,30 @@ bool IsWidevineAvailable(base::FilePath* adapter_path,
NOT_FOUND,
} widevine_cdm_file_check = NOT_CHECKED;
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
*adapter_path = command_line->GetSwitchValuePath(switches::kWidevineCdmPath);
if (!adapter_path->empty()) {
*cdm_path = adapter_path->DirName().AppendASCII(
base::GetNativeLibraryName(kWidevineCdmLibraryName));
if (widevine_cdm_file_check == NOT_CHECKED) {
widevine_cdm_file_check =
(base::PathExists(*adapter_path) && base::PathExists(*cdm_path))
? FOUND
: NOT_FOUND;
if (widevine_cdm_file_check == NOT_CHECKED) {
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
*cdm_path = command_line->GetSwitchValuePath(switches::kWidevineCdmPath);
if (!cdm_path->empty()) {
*cdm_path = cdm_path->AppendASCII(
base::GetNativeLibraryName(kWidevineCdmLibraryName));
widevine_cdm_file_check = base::PathExists(*cdm_path) ? FOUND : NOT_FOUND;
}
if (widevine_cdm_file_check == FOUND) {
// Add the supported codecs as if they came from the component manifest.
// This list must match the CDM that is being bundled with Chrome.
codecs_supported->push_back(media::VideoCodec::kCodecVP8);
codecs_supported->push_back(media::VideoCodec::kCodecVP9);
}
if (widevine_cdm_file_check == FOUND) {
// Add the supported codecs as if they came from the component manifest.
// This list must match the CDM that is being bundled with Chrome.
codecs_supported->push_back(media::VideoCodec::kCodecVP8);
codecs_supported->push_back(media::VideoCodec::kCodecVP9);
#if BUILDFLAG(USE_PROPRIETARY_CODECS)
codecs_supported->push_back(media::VideoCodec::kCodecH264);
codecs_supported->push_back(media::VideoCodec::kCodecH264);
#endif // BUILDFLAG(USE_PROPRIETARY_CODECS)
return true;
}
return true;
}
return false;
}
void AddWidevineAdapterFromCommandLine(
base::CommandLine* command_line,
std::vector<content::PepperPluginInfo>* plugins) {
base::FilePath adapter_path;
base::FilePath cdm_path;
std::vector<media::VideoCodec> video_codecs_supported;
if (IsWidevineAvailable(&adapter_path, &cdm_path, &video_codecs_supported)) {
auto cdm_version_string =
command_line->GetSwitchValueASCII(switches::kWidevineCdmVersion);
content::PepperPluginInfo info;
info.is_out_of_process = true;
info.path = adapter_path;
info.name = kWidevineCdmDisplayName;
info.description =
base::StringPrintf("%s (version: %s)", kWidevineCdmDescription,
cdm_version_string.c_str());
info.version = cdm_version_string;
info.permissions = kWidevineCdmPluginPermissions;
content::WebPluginMimeType mime_type(kWidevineCdmPluginMimeType,
kWidevineCdmPluginExtension,
kWidevineCdmPluginMimeTypeDescription);
info.mime_types.push_back(mime_type);
plugins->push_back(info);
}
}
#endif // defined(WIDEVINE_CDM_AVAILABLE)
#if defined(ENABLE_PEPPER_FLASH)
@ -235,9 +201,6 @@ void AtomContentClient::AddPepperPlugins(
#if defined(ENABLE_PEPPER_FLASH)
AddPepperFlashFromCommandLine(command_line, plugins);
#endif // defined(ENABLE_PEPPER_FLASH)
#if defined(WIDEVINE_CDM_AVAILABLE)
AddWidevineAdapterFromCommandLine(command_line, plugins);
#endif // defined(WIDEVINE_CDM_AVAILABLE)
ComputeBuiltInPlugins(plugins);
}
@ -246,12 +209,10 @@ void AtomContentClient::AddContentDecryptionModules(
std::vector<media::CdmHostFilePath>* cdm_host_file_paths) {
if (cdms) {
#if defined(WIDEVINE_CDM_AVAILABLE)
base::FilePath adapter_path;
base::FilePath cdm_path;
std::vector<media::VideoCodec> video_codecs_supported;
bool supports_persistent_license = false;
if (IsWidevineAvailable(&adapter_path, &cdm_path,
&video_codecs_supported)) {
if (IsWidevineAvailable(&cdm_path, &video_codecs_supported)) {
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
auto cdm_version_string =
command_line->GetSwitchValueASCII(switches::kWidevineCdmVersion);

View file

@ -21,7 +21,7 @@
#include "base/logging.h"
#include "chrome/common/chrome_paths.h"
#include "content/public/common/content_switches.h"
#include "ipc/ipc_features.h"
#include "ipc/ipc_buildflags.h"
#include "services/service_manager/sandbox/switches.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"

View file

@ -65,7 +65,7 @@ int NodeMain(int argc, char* argv[]) {
// Enable support for v8 inspector.
NodeDebugger node_debugger(env);
node_debugger.Start(gin_env.platform());
node_debugger.Start();
mate::Dictionary process(gin_env.isolate(), env->process_object());
#if defined(OS_WIN)

View file

@ -1112,30 +1112,11 @@ std::vector<mate::Dictionary> App::GetAppMetrics(v8::Isolate* isolate) {
for (const auto& process_metric : app_metrics_) {
mate::Dictionary pid_dict = mate::Dictionary::CreateEmpty(isolate);
mate::Dictionary memory_dict = mate::Dictionary::CreateEmpty(isolate);
mate::Dictionary cpu_dict = mate::Dictionary::CreateEmpty(isolate);
pid_dict.SetHidden("simple", true);
memory_dict.SetHidden("simple", true);
cpu_dict.SetHidden("simple", true);
memory_dict.Set(
"workingSetSize",
static_cast<double>(
process_metric.second->metrics->GetWorkingSetSize() >> 10));
memory_dict.Set(
"peakWorkingSetSize",
static_cast<double>(
process_metric.second->metrics->GetPeakWorkingSetSize() >> 10));
size_t private_bytes, shared_bytes;
if (process_metric.second->metrics->GetMemoryBytes(&private_bytes,
&shared_bytes)) {
memory_dict.Set("privateBytes", static_cast<double>(private_bytes >> 10));
memory_dict.Set("sharedBytes", static_cast<double>(shared_bytes >> 10));
}
pid_dict.Set("memory", memory_dict);
cpu_dict.Set(
"percentCPUUsage",
process_metric.second->metrics->GetPlatformIndependentCPUUsage() /

View file

@ -50,7 +50,7 @@ void RegisterStandardSchemes(const std::vector<std::string>& schemes,
// Dynamically register the schemes.
auto* policy = content::ChildProcessSecurityPolicy::GetInstance();
for (const std::string& scheme : schemes) {
url::AddStandardScheme(scheme.c_str(), url::SCHEME_WITHOUT_PORT);
url::AddStandardScheme(scheme.c_str(), url::SCHEME_WITH_HOST);
if (secure) {
url::AddSecureScheme(scheme.c_str());
}

View file

@ -47,7 +47,9 @@
#include "net/http/http_auth_handler_factory.h"
#include "net/http/http_auth_preferences.h"
#include "net/proxy_resolution/proxy_config_service_fixed.h"
#include "net/proxy_resolution/proxy_service.h"
#include "net/proxy_resolution/proxy_config_with_annotation.h"
#include "net/proxy_resolution/proxy_resolution_service.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "net/url_request/static_http_user_agent_settings.h"
#include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_context_getter.h"
@ -349,7 +351,8 @@ void SetProxyInIO(scoped_refptr<net::URLRequestContextGetter> getter,
auto* proxy_service =
getter->GetURLRequestContext()->proxy_resolution_service();
proxy_service->ResetConfigService(
base::WrapUnique(new net::ProxyConfigServiceFixed(config)));
base::WrapUnique(new net::ProxyConfigServiceFixed(
net::ProxyConfigWithAnnotation(config, NO_TRAFFIC_ANNOTATION_YET))));
// Refetches and applies the new pac script if provided.
proxy_service->ForceReloadProxyConfig();
RunCallbackInUI(callback);

View file

@ -92,8 +92,8 @@
#include "native_mate/dictionary.h"
#include "native_mate/object_template_builder.h"
#include "net/url_request/url_request_context.h"
#include "third_party/WebKit/public/platform/WebInputEvent.h"
#include "third_party/WebKit/public/web/WebFindOptions.h"
#include "third_party/blink/public/platform/web_input_event.h"
#include "third_party/blink/public/web/web_find_options.h"
#include "ui/display/screen.h"
#include "ui/events/base_event_utils.h"
@ -315,7 +315,8 @@ WebContents::WebContents(v8::Isolate* isolate,
: content::WebContentsObserver(web_contents), type_(type) {
const mate::Dictionary options = mate::Dictionary::CreateEmpty(isolate);
if (type == REMOTE) {
web_contents->SetUserAgentOverride(GetBrowserContext()->GetUserAgent());
web_contents->SetUserAgentOverride(GetBrowserContext()->GetUserAgent(),
false);
Init(isolate);
AttachAsUserData(web_contents);
InitZoomController(web_contents, options);
@ -456,7 +457,8 @@ void WebContents::InitWithSessionAndOptions(v8::Isolate* isolate,
// Initialize zoom controller.
InitZoomController(web_contents, options);
web_contents->SetUserAgentOverride(GetBrowserContext()->GetUserAgent());
web_contents->SetUserAgentOverride(GetBrowserContext()->GetUserAgent(),
false);
if (IsGuest()) {
NativeWindow* owner_window = nullptr;
@ -718,9 +720,12 @@ void WebContents::FindReply(content::WebContents* web_contents,
Emit("found-in-page", result);
}
bool WebContents::CheckMediaAccessPermission(content::WebContents* web_contents,
const GURL& security_origin,
content::MediaStreamType type) {
bool WebContents::CheckMediaAccessPermission(
content::RenderFrameHost* render_frame_host,
const GURL& security_origin,
content::MediaStreamType type) {
auto* web_contents =
content::WebContents::FromRenderFrameHost(render_frame_host);
auto* permission_helper =
WebContentsPermissionHelper::FromWebContents(web_contents);
return permission_helper->CheckMediaAccessPermission(security_origin, type);
@ -1123,7 +1128,7 @@ void WebContents::LoadURL(const GURL& url, const mate::Dictionary& options) {
std::string user_agent;
if (options.Get("userAgent", &user_agent))
web_contents()->SetUserAgentOverride(user_agent);
web_contents()->SetUserAgentOverride(user_agent, false);
std::string extra_headers;
if (options.Get("extraHeaders", &extra_headers))
@ -1233,7 +1238,7 @@ bool WebContents::IsCrashed() const {
void WebContents::SetUserAgent(const std::string& user_agent,
mate::Arguments* args) {
web_contents()->SetUserAgentOverride(user_agent);
web_contents()->SetUserAgentOverride(user_agent, false);
}
std::string WebContents::GetUserAgent() {

View file

@ -330,7 +330,7 @@ class WebContents : public mate::TrackableObject<WebContents>,
const gfx::Rect& selection_rect,
int active_match_ordinal,
bool final_update) override;
bool CheckMediaAccessPermission(content::WebContents* web_contents,
bool CheckMediaAccessPermission(content::RenderFrameHost* render_frame_host,
const GURL& security_origin,
content::MediaStreamType type) override;
void RequestMediaAccessPermission(

View file

@ -24,12 +24,14 @@
#include "atom/browser/window_list.h"
#include "atom/common/google_api_key.h"
#include "atom/common/options_switches.h"
#include "atom/common/platform_util.h"
#include "base/command_line.h"
#include "base/environment.h"
#include "base/files/file_util.h"
#include "base/stl_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/printing/printing_message_filter.h"
#include "chrome/browser/speech/tts_message_filter.h"
#include "content/public/browser/browser_ppapi_host.h"
@ -45,6 +47,7 @@
#include "content/public/common/url_constants.h"
#include "content/public/common/web_preferences.h"
#include "device/geolocation/public/cpp/location_provider.h"
#include "net/base/escape.h"
#include "net/ssl/ssl_cert_request_info.h"
#include "ppapi/host/ppapi_host.h"
#include "services/network/public/cpp/resource_request_body.h"
@ -561,4 +564,49 @@ void AtomBrowserClient::RenderProcessExited(content::RenderProcessHost* host,
}
}
void OnOpenExternal(const GURL& escaped_url, bool allowed) {
if (allowed)
platform_util::OpenExternal(
#if defined(OS_WIN)
base::UTF8ToUTF16(escaped_url.spec()),
#else
escaped_url,
#endif
true);
}
void HandleExternalProtocolInUI(
const GURL& url,
const content::ResourceRequestInfo::WebContentsGetter& web_contents_getter,
bool has_user_gesture) {
content::WebContents* web_contents = web_contents_getter.Run();
if (!web_contents)
return;
auto* permission_helper =
WebContentsPermissionHelper::FromWebContents(web_contents);
if (!permission_helper)
return;
GURL escaped_url(net::EscapeExternalHandlerValue(url.spec()));
auto callback = base::Bind(&OnOpenExternal, escaped_url);
permission_helper->RequestOpenExternalPermission(callback, has_user_gesture,
url);
}
bool AtomBrowserClient::HandleExternalProtocol(
const GURL& url,
content::ResourceRequestInfo::WebContentsGetter web_contents_getter,
int child_id,
content::NavigationUIData* navigation_data,
bool is_main_frame,
ui::PageTransition page_transition,
bool has_user_gesture) {
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
base::BindOnce(&HandleExternalProtocolInUI, url, web_contents_getter,
has_user_gesture));
return true;
}
} // namespace atom

View file

@ -122,6 +122,14 @@ class AtomBrowserClient : public brightray::BrowserClient,
void RenderProcessExited(content::RenderProcessHost* host,
base::TerminationStatus status,
int exit_code) override;
bool HandleExternalProtocol(
const GURL& url,
content::ResourceRequestInfo::WebContentsGetter web_contents_getter,
int child_id,
content::NavigationUIData* navigation_data,
bool is_main_frame,
ui::PageTransition page_transition,
bool has_user_gesture) override;
private:
struct ProcessPreferences {

View file

@ -144,7 +144,7 @@ void AtomBrowserMainParts::PostEarlyInitialization() {
// Enable support for v8 inspector
node_debugger_.reset(new NodeDebugger(env));
node_debugger_->Start(js_env_->platform());
node_debugger_->Start();
// Add Electron extended APIs.
atom_bindings_->BindTo(js_env_->isolate(), env->process_object());

View file

@ -242,4 +242,12 @@ bool AtomPermissionManager::CheckPermissionWithDetails(
*details);
}
blink::mojom::PermissionStatus
AtomPermissionManager::GetPermissionStatusForFrame(
content::PermissionType permission,
content::RenderFrameHost* render_frame_host,
const GURL& requesting_origin) {
return blink::mojom::PermissionStatus::GRANTED;
}
} // namespace atom

View file

@ -71,6 +71,10 @@ class AtomPermissionManager : public content::PermissionManager {
const base::DictionaryValue* details,
const base::Callback<
void(const std::vector<blink::mojom::PermissionStatus>&)>& callback);
blink::mojom::PermissionStatus GetPermissionStatusForFrame(
content::PermissionType permission,
content::RenderFrameHost* render_frame_host,
const GURL& requesting_origin) override;
bool CheckPermissionWithDetails(content::PermissionType permission,
content::RenderFrameHost* render_frame_host,

View file

@ -5,9 +5,7 @@
#include "atom/browser/atom_resource_dispatcher_host_delegate.h"
#include "atom/browser/atom_browser_context.h"
#include "atom/browser/web_contents_permission_helper.h"
#include "atom/browser/web_contents_preferences.h"
#include "atom/common/platform_util.h"
#include "base/strings/utf_string_conversions.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/download_manager.h"
@ -28,36 +26,6 @@ namespace atom {
namespace {
void OnOpenExternal(const GURL& escaped_url, bool allowed) {
if (allowed)
platform_util::OpenExternal(
#if defined(OS_WIN)
base::UTF8ToUTF16(escaped_url.spec()),
#else
escaped_url,
#endif
true);
}
void HandleExternalProtocolInUI(
const GURL& url,
const content::ResourceRequestInfo::WebContentsGetter& web_contents_getter,
bool has_user_gesture) {
content::WebContents* web_contents = web_contents_getter.Run();
if (!web_contents)
return;
auto* permission_helper =
WebContentsPermissionHelper::FromWebContents(web_contents);
if (!permission_helper)
return;
GURL escaped_url(net::EscapeExternalHandlerValue(url.spec()));
auto callback = base::Bind(&OnOpenExternal, escaped_url);
permission_helper->RequestOpenExternalPermission(callback, has_user_gesture,
url);
}
#if defined(ENABLE_PDF_VIEWER)
void OnPdfResourceIntercepted(
const GURL& original_url,
@ -103,16 +71,6 @@ void OnPdfResourceIntercepted(
AtomResourceDispatcherHostDelegate::AtomResourceDispatcherHostDelegate() {}
bool AtomResourceDispatcherHostDelegate::HandleExternalProtocol(
const GURL& url,
content::ResourceRequestInfo* info) {
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
base::BindOnce(&HandleExternalProtocolInUI, url,
info->GetWebContentsGetterForRequest(),
info->HasUserGesture()));
return true;
}
bool AtomResourceDispatcherHostDelegate::ShouldInterceptResourceAsStream(
net::URLRequest* request,
const std::string& mime_type,

View file

@ -17,8 +17,6 @@ class AtomResourceDispatcherHostDelegate
AtomResourceDispatcherHostDelegate();
// content::ResourceDispatcherHostDelegate:
bool HandleExternalProtocol(const GURL& url,
content::ResourceRequestInfo* info) override;
bool ShouldInterceptResourceAsStream(net::URLRequest* request,
const std::string& mime_type,
GURL* origin,

View file

@ -49,11 +49,12 @@ bool JavascriptEnvironment::Initialize() {
// The V8Platform of gin relies on Chromium's task schedule, which has not
// been started at this point, so we have to rely on Node's V8Platform.
auto* tracing_controller = new v8::TracingController();
node::tracing::TraceEventHelper::SetTracingController(tracing_controller);
platform_ = node::CreatePlatform(
base::RecommendedMaxNumberOfThreadsInPool(3, 8, 0.1, 0), nullptr);
base::RecommendedMaxNumberOfThreadsInPool(3, 8, 0.1, 0),
tracing_controller);
v8::V8::InitializePlatform(platform_);
node::tracing::TraceEventHelper::SetTracingController(
new v8::TracingController());
gin::IsolateHolder::Initialize(
gin::IsolateHolder::kNonStrictMode, gin::IsolateHolder::kStableV8Extras,
gin::ArrayBufferAllocator::SharedInstance(),

View file

@ -60,7 +60,10 @@ NativeWindow::NativeWindow(const mate::Dictionary& options,
NativeWindow::~NativeWindow() {
// It's possible that the windows gets destroyed before it's closed, in that
// case we need to ensure the OnWindowClosed message is still notified.
// case we need to ensure the Widget delegate gets destroyed and
// OnWindowClosed message is still notified.
if (widget_->widget_delegate())
widget_->OnNativeWidgetDestroyed();
NotifyWindowClosed();
}

View file

@ -19,7 +19,7 @@ NodeDebugger::NodeDebugger(node::Environment* env) : env_(env) {}
NodeDebugger::~NodeDebugger() {}
void NodeDebugger::Start(node::MultiIsolatePlatform* platform) {
void NodeDebugger::Start() {
auto* inspector = env_->inspector_agent();
if (inspector == nullptr)
return;
@ -45,8 +45,7 @@ void NodeDebugger::Start(node::MultiIsolatePlatform* platform) {
process.Set("_breakFirstLine", true);
}
inspector->Start(static_cast<node::NodePlatform*>(platform), nullptr,
options);
inspector->Start(/* path */ nullptr, options);
DCHECK(env_->inspector_agent()->IsStarted());
}

View file

@ -9,7 +9,6 @@
namespace node {
class Environment;
class MultiIsolatePlatform;
} // namespace node
namespace atom {
@ -20,7 +19,7 @@ class NodeDebugger {
explicit NodeDebugger(node::Environment* env);
~NodeDebugger();
void Start(node::MultiIsolatePlatform* platform);
void Start();
private:
node::Environment* env_;

View file

@ -27,7 +27,7 @@
#include "content/public/browser/context_factory.h"
#include "content/public/browser/render_process_host.h"
#include "media/base/video_frame.h"
#include "third_party/WebKit/public/platform/WebInputEvent.h"
#include "third_party/blink/public/platform/web_input_event.h"
#include "ui/compositor/compositor.h"
#include "ui/compositor/layer.h"
#include "ui/compositor/layer_type.h"
@ -254,7 +254,8 @@ OffScreenRenderWidgetHostView::OffScreenRenderWidgetHostView(
content::RenderWidgetHost* host,
OffScreenRenderWidgetHostView* parent_host_view,
NativeWindow* native_window)
: render_widget_host_(content::RenderWidgetHostImpl::From(host)),
: content::RenderWidgetHostViewBase(host),
render_widget_host_(content::RenderWidgetHostImpl::From(host)),
parent_host_view_(parent_host_view),
native_window_(native_window),
transparent_(transparent),
@ -264,7 +265,7 @@ OffScreenRenderWidgetHostView::OffScreenRenderWidgetHostView(
size_(native_window->GetSize()),
painting_(painting),
is_showing_(!render_widget_host_->is_hidden()),
mouse_wheel_phase_handler_(render_widget_host_, this),
mouse_wheel_phase_handler_(this),
weak_ptr_factory_(this) {
DCHECK(render_widget_host_);
bool is_guest_view_hack = parent_host_view_ != nullptr;
@ -283,7 +284,13 @@ OffScreenRenderWidgetHostView::OffScreenRenderWidgetHostView(
#if defined(OS_MACOSX)
last_frame_root_background_color_ = SK_ColorTRANSPARENT;
CreatePlatformWidget(is_guest_view_hack);
#else
#endif
bool opaque = SkColorGetA(background_color()) == SK_AlphaOPAQUE;
GetRootLayer()->SetFillsBoundsOpaquely(opaque);
GetRootLayer()->SetColor(background_color());
#if !defined(OS_MACOSX)
// On macOS the ui::Compositor is created/owned by the platform view.
content::ImageTransportFactory* factory =
content::ImageTransportFactory::GetInstance();
@ -397,10 +404,6 @@ void OffScreenRenderWidgetHostView::SetBounds(const gfx::Rect& new_bounds) {
SetSize(new_bounds.size());
}
gfx::Vector2dF OffScreenRenderWidgetHostView::GetLastScrollOffset() const {
return last_scroll_offset_;
}
gfx::NativeView OffScreenRenderWidgetHostView::GetNativeView() const {
return gfx::NativeView();
}
@ -497,6 +500,22 @@ bool OffScreenRenderWidgetHostView::LockMouse() {
void OffScreenRenderWidgetHostView::UnlockMouse() {}
void OffScreenRenderWidgetHostView::TakeFallbackContentFrom(
content::RenderWidgetHostView* view) {
DCHECK(!static_cast<content::RenderWidgetHostViewBase*>(view)
->IsRenderWidgetHostViewChildFrame());
DCHECK(!static_cast<content::RenderWidgetHostViewBase*>(view)
->IsRenderWidgetHostViewGuest());
OffScreenRenderWidgetHostView* view_osr =
static_cast<OffScreenRenderWidgetHostView*>(view);
SetBackgroundColor(view_osr->background_color());
if (GetDelegatedFrameHost() && view_osr->GetDelegatedFrameHost()) {
GetDelegatedFrameHost()->TakeFallbackContentFrom(
view_osr->GetDelegatedFrameHost());
}
host()->GetContentRenderingTimeoutFrom(view_osr->host());
}
void OffScreenRenderWidgetHostView::DidCreateNewRendererCompositorFrameSink(
viz::mojom::CompositorFrameSinkClient* renderer_compositor_frame_sink) {
renderer_compositor_frame_sink_ = renderer_compositor_frame_sink;
@ -672,11 +691,6 @@ gfx::Rect OffScreenRenderWidgetHostView::GetBoundsInRootWindow() {
return gfx::Rect(size_);
}
content::RenderWidgetHostImpl*
OffScreenRenderWidgetHostView::GetRenderWidgetHostImpl() const {
return render_widget_host_;
}
viz::SurfaceId OffScreenRenderWidgetHostView::GetCurrentSurfaceId() const {
return GetDelegatedFrameHost()
? GetDelegatedFrameHost()->GetCurrentSurfaceId()
@ -1116,7 +1130,7 @@ void OffScreenRenderWidgetHostView::SendMouseWheelEvent(
blink::WebMouseWheelEvent mouse_wheel_event(event);
mouse_wheel_phase_handler_.SendWheelEndIfNeeded();
mouse_wheel_phase_handler_.SendWheelEndForTouchpadScrollingIfNeeded();
mouse_wheel_phase_handler_.AddPhaseIfNeededAndScheduleEndEvent(
mouse_wheel_event, false);
@ -1147,7 +1161,7 @@ void OffScreenRenderWidgetHostView::SendMouseWheelEvent(
popup_host_view_->weak_ptr_factory_.GetWeakPtr()));
}
} else if (!guest_host_views_.empty()) {
for (auto guest_host_view : guest_host_views_) {
for (auto* guest_host_view : guest_host_views_) {
if (!guest_host_view->render_widget_host_ ||
!guest_host_view->render_widget_host_->GetView()) {
continue;
@ -1291,7 +1305,7 @@ void OffScreenRenderWidgetHostView::ResizeRootLayer(bool force) {
local_surface_id_);
#if defined(OS_MACOSX)
bool resized = browser_compositor_->UpdateNSViewAndDisplay();
bool resized = UpdateNSViewAndDisplay();
#else
bool resized = true;
GetDelegatedFrameHost()->WasResized(local_surface_id_, size,

View file

@ -31,7 +31,7 @@
#include "content/browser/renderer_host/render_widget_host_impl.h"
#include "content/browser/renderer_host/render_widget_host_view_base.h"
#include "content/browser/web_contents/web_contents_view.h"
#include "third_party/WebKit/public/platform/WebVector.h"
#include "third_party/blink/public/platform/web_vector.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/base/ime/text_input_client.h"
#include "ui/compositor/compositor.h"
@ -89,7 +89,6 @@ class OffScreenRenderWidgetHostView
void InitAsChild(gfx::NativeView) override;
void SetSize(const gfx::Size&) override;
void SetBounds(const gfx::Rect&) override;
gfx::Vector2dF GetLastScrollOffset(void) const override;
gfx::NativeView GetNativeView(void) const override;
gfx::NativeViewAccessible GetNativeViewAccessible(void) override;
ui::TextInputClient* GetTextInputClient() override;
@ -106,6 +105,7 @@ class OffScreenRenderWidgetHostView
SkColor background_color() const override;
bool LockMouse(void) override;
void UnlockMouse(void) override;
void TakeFallbackContentFrom(content::RenderWidgetHostView* view) override;
void SetNeedsBeginFrames(bool needs_begin_frames) override;
void SetWantsAnimateOnlyBeginFrames() override;
#if defined(OS_MACOSX)
@ -116,6 +116,7 @@ class OffScreenRenderWidgetHostView
bool IsSpeaking() const override;
bool ShouldContinueToPauseForFrame() override;
void StopSpeaking() override;
bool UpdateNSViewAndDisplay();
#endif // defined(OS_MACOSX)
// content::RenderWidgetHostViewBase:
@ -149,7 +150,6 @@ class OffScreenRenderWidgetHostView
content::RenderWidgetHostViewGuest*) override;
gfx::Vector2d GetOffsetFromRootSurface() override;
gfx::Rect GetBoundsInRootWindow(void) override;
content::RenderWidgetHostImpl* GetRenderWidgetHostImpl() const override;
viz::SurfaceId GetCurrentSurfaceId() const override;
void ImeCompositionRangeChanged(const gfx::Range&,
const std::vector<gfx::Rect>&) override;

View file

@ -10,6 +10,14 @@
#include "content/common/view_messages.h"
#include "ui/accelerated_widget_mac/accelerated_widget_mac.h"
namespace {
display::Display GetDisplay() {
return display::Screen::GetScreen()->GetDisplayNearestView(nullptr);
}
} // namespace
namespace atom {
class MacHelper : public content::BrowserCompositorMacClient,
@ -33,7 +41,7 @@ class MacHelper : public content::BrowserCompositorMacClient,
return view_->last_frame_root_background_color();
}
void BrowserCompositorMacOnBeginFrame() override {}
void BrowserCompositorMacOnBeginFrame(base::TimeTicks frame_time) override {}
void OnFrameTokenChanged(uint32_t frame_token) override {
view_->render_widget_host()->DidProcessFrame(frame_token);
@ -81,6 +89,11 @@ bool OffScreenRenderWidgetHostView::IsSpeaking() const {
void OffScreenRenderWidgetHostView::StopSpeaking() {}
bool OffScreenRenderWidgetHostView::UpdateNSViewAndDisplay() {
return browser_compositor_->UpdateNSViewAndDisplay(
GetRootLayer()->bounds().size(), GetDisplay());
}
bool OffScreenRenderWidgetHostView::ShouldContinueToPauseForFrame() {
return browser_compositor_->ShouldContinueToPauseForFrame();
}
@ -90,7 +103,7 @@ void OffScreenRenderWidgetHostView::CreatePlatformWidget(
mac_helper_ = new MacHelper(this);
browser_compositor_.reset(new content::BrowserCompositorMac(
mac_helper_, mac_helper_, render_widget_host_->is_hidden(), true,
AllocateFrameSinkId(is_guest_view_hack)));
GetDisplay(), AllocateFrameSinkId(is_guest_view_hack)));
}
void OffScreenRenderWidgetHostView::DestroyPlatformWidget() {

View file

@ -7,7 +7,7 @@
#include "atom/common/api/api_messages.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/public/browser/render_view_host.h"
#include "third_party/WebKit/public/platform/WebScreenInfo.h"
#include "third_party/blink/public/platform/web_screen_info.h"
#include "ui/display/screen.h"
namespace atom {

View file

@ -4,6 +4,9 @@
#include "atom/browser/special_storage_policy.h"
#include "base/bind.h"
#include "base/callback.h"
namespace atom {
SpecialStoragePolicy::SpecialStoragePolicy() {}
@ -34,8 +37,9 @@ bool SpecialStoragePolicy::HasSessionOnlyOrigins() {
return false;
}
bool SpecialStoragePolicy::ShouldDeleteCookieOnExit(const GURL& origin) {
return false;
storage::SpecialStoragePolicy::DeleteCookiePredicate
SpecialStoragePolicy::CreateDeleteCookieOnExitPredicate() {
return storage::SpecialStoragePolicy::DeleteCookiePredicate();
}
} // namespace atom

View file

@ -20,7 +20,8 @@ class SpecialStoragePolicy : public storage::SpecialStoragePolicy {
bool HasIsolatedStorage(const GURL& origin) override;
bool IsStorageSessionOnly(const GURL& origin) override;
bool HasSessionOnlyOrigins() override;
bool ShouldDeleteCookieOnExit(const GURL& origin) override;
storage::SpecialStoragePolicy::DeleteCookiePredicate
CreateDeleteCookieOnExitPredicate() override;
protected:
~SpecialStoragePolicy() override;

View file

@ -55,7 +55,6 @@ void AtomBindings::BindTo(v8::Isolate* isolate, v8::Local<v8::Object> process) {
dict.SetMethod("hang", &Hang);
dict.SetMethod("log", &Log);
dict.SetMethod("getHeapStatistics", &GetHeapStatistics);
dict.SetMethod("getProcessMemoryInfo", &GetProcessMemoryInfo);
dict.SetMethod("getCreationTime", &GetCreationTime);
dict.SetMethod("getSystemMemoryInfo", &GetSystemMemoryInfo);
dict.SetMethod("getCPUUsage", base::Bind(&AtomBindings::GetCPUUsage,
@ -159,26 +158,6 @@ v8::Local<v8::Value> AtomBindings::GetHeapStatistics(v8::Isolate* isolate) {
return dict.GetHandle();
}
// static
v8::Local<v8::Value> AtomBindings::GetProcessMemoryInfo(v8::Isolate* isolate) {
auto metrics = base::ProcessMetrics::CreateCurrentProcessMetrics();
mate::Dictionary dict = mate::Dictionary::CreateEmpty(isolate);
dict.SetHidden("simple", true);
dict.Set("workingSetSize",
static_cast<double>(metrics->GetWorkingSetSize() >> 10));
dict.Set("peakWorkingSetSize",
static_cast<double>(metrics->GetPeakWorkingSetSize() >> 10));
size_t private_bytes, shared_bytes;
if (metrics->GetMemoryBytes(&private_bytes, &shared_bytes)) {
dict.Set("privateBytes", static_cast<double>(private_bytes >> 10));
dict.Set("sharedBytes", static_cast<double>(shared_bytes >> 10));
}
return dict.GetHandle();
}
// static
v8::Local<v8::Value> AtomBindings::GetCreationTime(v8::Isolate* isolate) {
auto timeValue = base::CurrentProcessInfo::CreationTime();

View file

@ -36,7 +36,6 @@ class AtomBindings {
static void Crash();
static void Hang();
static v8::Local<v8::Value> GetHeapStatistics(v8::Isolate* isolate);
static v8::Local<v8::Value> GetProcessMemoryInfo(v8::Isolate* isolate);
static v8::Local<v8::Value> GetCreationTime(v8::Isolate* isolate);
static v8::Local<v8::Value> GetSystemMemoryInfo(v8::Isolate* isolate,
mate::Arguments* args);

View file

@ -2,8 +2,10 @@
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "atom/common/node_includes.h"
#include "native_mate/dictionary.h"
// clang-format off
#include "atom/common/node_includes.h" // NOLINT(build/include_alpha)
// clang-format on
namespace {

View file

@ -8,7 +8,7 @@
#include "base/strings/utf_string_conversions.h"
#include "base/values.h"
#include "content/public/renderer/render_frame.h"
#include "third_party/WebKit/public/web/WebLocalFrame.h"
#include "third_party/blink/public/web/web_local_frame.h"
using blink::WebLocalFrame;

View file

@ -8,7 +8,7 @@
#ifndef ATOM_COMMON_CHROME_VERSION_H_
#define ATOM_COMMON_CHROME_VERSION_H_
#define CHROME_VERSION_STRING "66.0.3359.181"
#define CHROME_VERSION_STRING "67.0.3396.99"
#define CHROME_VERSION "v" CHROME_VERSION_STRING
#endif // ATOM_COMMON_CHROME_VERSION_H_

View file

@ -112,7 +112,8 @@ bool RegisterNonABICompliantCodeRange(void* start, size_t size_in_bytes) {
// mov imm64, rax
record->thunk[0] = 0x48;
record->thunk[1] = 0xb8;
void* handler = &CrashForExceptionInNonABICompliantCodeRange;
void* handler =
reinterpret_cast<void*>(&CrashForExceptionInNonABICompliantCodeRange);
memcpy(&record->thunk[2], &handler, 8);
// jmp rax

View file

@ -7,7 +7,7 @@
#include "atom/common/keyboard_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "third_party/WebKit/public/platform/WebInputEvent.h"
#include "third_party/blink/public/platform/web_input_event.h"
#include "ui/events/event_constants.h"
namespace atom {

View file

@ -13,11 +13,11 @@
#include "base/strings/utf_string_conversions.h"
#include "content/public/browser/native_web_keyboard_event.h"
#include "native_mate/dictionary.h"
#include "third_party/WebKit/public/platform/WebInputEvent.h"
#include "third_party/WebKit/public/platform/WebMouseEvent.h"
#include "third_party/WebKit/public/platform/WebMouseWheelEvent.h"
#include "third_party/WebKit/public/web/WebDeviceEmulationParams.h"
#include "third_party/WebKit/public/web/WebFindOptions.h"
#include "third_party/blink/public/platform/web_input_event.h"
#include "third_party/blink/public/platform/web_mouse_event.h"
#include "third_party/blink/public/platform/web_mouse_wheel_event.h"
#include "third_party/blink/public/web/web_device_emulation_params.h"
#include "third_party/blink/public/web/web_find_options.h"
#include "ui/base/clipboard/clipboard.h"
#include "ui/events/keycodes/dom/keycode_converter.h"
#include "ui/events/keycodes/keyboard_code_conversion.h"

View file

@ -6,9 +6,9 @@
#define ATOM_COMMON_NATIVE_MATE_CONVERTERS_BLINK_CONVERTER_H_
#include "native_mate/converter.h"
#include "third_party/WebKit/public/platform/WebCache.h"
#include "third_party/WebKit/public/platform/WebInputEvent.h"
#include "third_party/WebKit/public/web/WebContextMenuData.h"
#include "third_party/blink/public/platform/web_cache.h"
#include "third_party/blink/public/platform/web_input_event.h"
#include "third_party/blink/public/web/web_context_menu_data.h"
namespace blink {
class WebMouseEvent;

View file

@ -12,7 +12,7 @@
#include "content/public/common/referrer.h"
#include "content/public/common/stop_find_action.h"
#include "native_mate/converter.h"
#include "third_party/WebKit/public/platform/modules/permissions/permission_status.mojom.h"
#include "third_party/blink/public/platform/modules/permissions/permission_status.mojom.h"
namespace content {
struct ContextMenuParams;

View file

@ -32,16 +32,15 @@ bool XDGUtilV(const std::vector<std::string>& argv, const bool wait_for_exit) {
if (!process.IsValid())
return false;
if (!wait_for_exit) {
base::EnsureProcessGetsReaped(process.Pid());
return true;
if (wait_for_exit) {
int exit_code = -1;
if (!process.WaitForExit(&exit_code))
return false;
return (exit_code == 0);
}
int exit_code = -1;
if (!process.WaitForExit(&exit_code))
return false;
return (exit_code == 0);
base::EnsureProcessGetsReaped(std::move(process));
return true;
}
bool XDGUtil(const std::string& util,

View file

@ -10,7 +10,7 @@
#include "atom/common/node_includes.h"
#include "content/public/renderer/render_frame.h"
#include "native_mate/dictionary.h"
#include "third_party/WebKit/public/web/WebLocalFrame.h"
#include "third_party/blink/public/web/web_local_frame.h"
using blink::WebLocalFrame;
using content::RenderFrame;

View file

@ -13,8 +13,8 @@
#include "chrome/renderer/spellchecker/spellcheck_worditerator.h"
#include "native_mate/converter.h"
#include "native_mate/dictionary.h"
#include "third_party/WebKit/public/web/WebTextCheckingCompletion.h"
#include "third_party/WebKit/public/web/WebTextCheckingResult.h"
#include "third_party/blink/public/web/web_text_checking_completion.h"
#include "third_party/blink/public/web/web_text_checking_result.h"
#include "third_party/icu/source/common/unicode/uscript.h"
namespace atom {

View file

@ -12,9 +12,9 @@
#include "base/memory/weak_ptr.h"
#include "chrome/renderer/spellchecker/spellcheck_worditerator.h"
#include "native_mate/scoped_persistent.h"
#include "third_party/WebKit/public/platform/WebSpellCheckPanelHostClient.h"
#include "third_party/WebKit/public/platform/WebVector.h"
#include "third_party/WebKit/public/web/WebTextCheckClient.h"
#include "third_party/blink/public/platform/web_spell_check_panel_host_client.h"
#include "third_party/blink/public/platform/web_vector.h"
#include "third_party/blink/public/web/web_text_check_client.h"
namespace blink {
struct WebTextCheckingResult;

View file

@ -18,17 +18,17 @@
#include "content/public/renderer/render_view.h"
#include "native_mate/dictionary.h"
#include "native_mate/object_template_builder.h"
#include "third_party/WebKit/Source/platform/weborigin/SchemeRegistry.h"
#include "third_party/WebKit/public/platform/WebCache.h"
#include "third_party/WebKit/public/web/WebDocument.h"
#include "third_party/WebKit/public/web/WebElement.h"
#include "third_party/WebKit/public/web/WebFrameWidget.h"
#include "third_party/WebKit/public/web/WebImeTextSpan.h"
#include "third_party/WebKit/public/web/WebInputMethodController.h"
#include "third_party/WebKit/public/web/WebLocalFrame.h"
#include "third_party/WebKit/public/web/WebScriptExecutionCallback.h"
#include "third_party/WebKit/public/web/WebScriptSource.h"
#include "third_party/WebKit/public/web/WebView.h"
#include "third_party/blink/public/platform/web_cache.h"
#include "third_party/blink/public/web/web_document.h"
#include "third_party/blink/public/web/web_element.h"
#include "third_party/blink/public/web/web_frame_widget.h"
#include "third_party/blink/public/web/web_ime_text_span.h"
#include "third_party/blink/public/web/web_input_method_controller.h"
#include "third_party/blink/public/web/web_local_frame.h"
#include "third_party/blink/public/web/web_script_execution_callback.h"
#include "third_party/blink/public/web/web_script_source.h"
#include "third_party/blink/public/web/web_view.h"
#include "third_party/blink/renderer/platform/weborigin/scheme_registry.h"
#include "atom/common/node_includes.h"

View file

@ -11,7 +11,7 @@
#include "native_mate/handle.h"
#include "native_mate/wrappable.h"
#include "third_party/WebKit/public/platform/WebCache.h"
#include "third_party/blink/public/platform/web_cache.h"
namespace blink {
class WebLocalFrame;

View file

@ -9,12 +9,12 @@
#include "atom/common/api/api_messages.h"
#include "content/public/renderer/render_frame.h"
#include "content/public/renderer/render_view.h"
#include "third_party/WebKit/public/platform/WebKeyboardEvent.h"
#include "third_party/WebKit/public/platform/WebString.h"
#include "third_party/WebKit/public/web/WebDocument.h"
#include "third_party/WebKit/public/web/WebLocalFrame.h"
#include "third_party/WebKit/public/web/WebOptionElement.h"
#include "third_party/WebKit/public/web/WebUserGestureIndicator.h"
#include "third_party/blink/public/platform/web_keyboard_event.h"
#include "third_party/blink/public/platform/web_string.h"
#include "third_party/blink/public/web/web_document.h"
#include "third_party/blink/public/web/web_local_frame.h"
#include "third_party/blink/public/web/web_option_element.h"
#include "third_party/blink/public/web/web_user_gesture_indicator.h"
#include "ui/events/keycodes/keyboard_codes.h"
#include "ui/gfx/geometry/rect_f.h"

View file

@ -10,10 +10,10 @@
#include "base/memory/weak_ptr.h"
#include "content/public/renderer/render_frame_observer.h"
#include "content/public/renderer/render_view_observer.h"
#include "third_party/WebKit/public/web/WebAutofillClient.h"
#include "third_party/WebKit/public/web/WebFormControlElement.h"
#include "third_party/WebKit/public/web/WebInputElement.h"
#include "third_party/WebKit/public/web/WebNode.h"
#include "third_party/blink/public/web/web_autofill_client.h"
#include "third_party/blink/public/web/web_form_control_element.h"
#include "third_party/blink/public/web/web_input_element.h"
#include "third_party/blink/public/web/web_node.h"
namespace atom {

View file

@ -19,12 +19,12 @@
#include "native_mate/dictionary.h"
#include "net/base/net_module.h"
#include "net/grit/net_resources.h"
#include "third_party/WebKit/public/web/WebDocument.h"
#include "third_party/WebKit/public/web/WebDraggableRegion.h"
#include "third_party/WebKit/public/web/WebElement.h"
#include "third_party/WebKit/public/web/WebKit.h"
#include "third_party/WebKit/public/web/WebLocalFrame.h"
#include "third_party/WebKit/public/web/WebScriptSource.h"
#include "third_party/blink/public/web/web_document.h"
#include "third_party/blink/public/web/web_draggable_region.h"
#include "third_party/blink/public/web/web_element.h"
#include "third_party/blink/public/web/blink.h"
#include "third_party/blink/public/web/web_local_frame.h"
#include "third_party/blink/public/web/web_script_source.h"
#include "ui/base/resource/resource_bundle.h"
namespace atom {

View file

@ -10,7 +10,7 @@
#include "atom/renderer/renderer_client_base.h"
#include "base/strings/string16.h"
#include "content/public/renderer/render_frame_observer.h"
#include "third_party/WebKit/public/web/WebLocalFrame.h"
#include "third_party/blink/public/web/web_local_frame.h"
namespace base {
class ListValue;

View file

@ -7,7 +7,7 @@
#include "atom/common/api/api_messages.h"
#include "content/public/renderer/render_view.h"
#include "ipc/ipc_message_macros.h"
#include "third_party/WebKit/public/web/WebView.h"
#include "third_party/blink/public/web/web_view.h"
namespace atom {

View file

@ -18,8 +18,8 @@
#include "base/command_line.h"
#include "content/public/renderer/render_frame.h"
#include "native_mate/dictionary.h"
#include "third_party/WebKit/public/web/WebDocument.h"
#include "third_party/WebKit/public/web/WebLocalFrame.h"
#include "third_party/blink/public/web/web_document.h"
#include "third_party/blink/public/web/web_local_frame.h"
#include "atom/common/node_includes.h"
#include "atom_natives.h" // NOLINT: This file is generated with js2c

View file

@ -20,8 +20,8 @@
#include "chrome/renderer/printing/print_web_view_helper.h"
#include "content/public/renderer/render_frame.h"
#include "native_mate/dictionary.h"
#include "third_party/WebKit/public/web/WebDocument.h"
#include "third_party/WebKit/public/web/WebKit.h"
#include "third_party/blink/public/web/web_document.h"
#include "third_party/blink/public/web/blink.h"
#include "atom/common/node_includes.h"
#include "atom_natives.h" // NOLINT: This file is generated with js2c
@ -153,7 +153,6 @@ void AtomSandboxedRendererClient::InitializeBindings(
b.SetMethod("getPid", &base::GetCurrentProcId);
b.SetMethod("getResourcesPath", &NodeBindings::GetHelperResourcesPath);
b.SetMethod("getHeapStatistics", &AtomBindings::GetHeapStatistics);
b.SetMethod("getProcessMemoryInfo", &AtomBindings::GetProcessMemoryInfo);
b.SetMethod("getSystemMemoryInfo", &AtomBindings::GetSystemMemoryInfo);
b.SetMethod("getCPUUsage", base::Bind(&AtomBindings::GetCPUUsage,
base::Unretained(metrics_.get())));

View file

@ -5,9 +5,9 @@
#include "atom/renderer/content_settings_observer.h"
#include "content/public/renderer/render_frame.h"
#include "third_party/WebKit/public/platform/URLConversion.h"
#include "third_party/WebKit/public/platform/WebSecurityOrigin.h"
#include "third_party/WebKit/public/web/WebLocalFrame.h"
#include "third_party/blink/public/platform/url_conversion.h"
#include "third_party/blink/public/platform/web_security_origin.h"
#include "third_party/blink/public/web/web_local_frame.h"
namespace atom {

View file

@ -7,7 +7,7 @@
#include "base/compiler_specific.h"
#include "content/public/renderer/render_frame_observer.h"
#include "third_party/WebKit/public/platform/WebContentSettingsClient.h"
#include "third_party/blink/public/platform/web_content_settings_client.h"
namespace atom {

View file

@ -18,7 +18,6 @@
#include "base/command_line.h"
#include "base/strings/string_split.h"
#include "base/strings/stringprintf.h"
#include "chrome/renderer/media/chrome_key_systems.h"
#include "chrome/renderer/printing/print_web_view_helper.h"
#include "chrome/renderer/tts_dispatcher.h"
#include "content/public/common/content_constants.h"
@ -26,13 +25,13 @@
#include "content/public/renderer/render_frame.h"
#include "content/public/renderer/render_view.h"
#include "native_mate/dictionary.h"
#include "third_party/WebKit/Source/platform/weborigin/SchemeRegistry.h"
#include "third_party/WebKit/public/web/WebCustomElement.h" // NOLINT(build/include_alpha)
#include "third_party/WebKit/public/web/WebFrameWidget.h"
#include "third_party/WebKit/public/web/WebKit.h"
#include "third_party/WebKit/public/web/WebPluginParams.h"
#include "third_party/WebKit/public/web/WebScriptSource.h"
#include "third_party/WebKit/public/web/WebSecurityPolicy.h"
#include "third_party/blink/renderer/platform/weborigin/scheme_registry.h"
#include "third_party/blink/public/web/blink.h"
#include "third_party/blink/public/web/web_custom_element.h" // NOLINT(build/include_alpha)
#include "third_party/blink/public/web/web_frame_widget.h"
#include "third_party/blink/public/web/web_plugin_params.h"
#include "third_party/blink/public/web/web_script_source.h"
#include "third_party/blink/public/web/web_security_policy.h"
#if defined(OS_MACOSX)
#include "base/strings/sys_string_conversions.h"
@ -78,7 +77,7 @@ RendererClientBase::RendererClientBase() {
std::vector<std::string> standard_schemes_list =
ParseSchemesCLISwitch(command_line, switches::kStandardSchemes);
for (const std::string& scheme : standard_schemes_list)
url::AddStandardScheme(scheme.c_str(), url::SCHEME_WITHOUT_PORT);
url::AddStandardScheme(scheme.c_str(), url::SCHEME_WITH_HOST);
isolated_world_ = base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kContextIsolation);
// We rely on the unique process host id which is notified to the
@ -171,9 +170,6 @@ void RendererClientBase::RenderFrameCreated(
new ContentSettingsObserver(render_frame);
new printing::PrintWebViewHelper(render_frame);
// This is required for widevine plugin detection provided during runtime.
blink::ResetPluginCache();
#if defined(ENABLE_PDF_VIEWER)
// Allow access to file scheme from pdf viewer.
blink::WebSecurityPolicy::AddOriginAccessWhitelistEntry(
@ -227,11 +223,17 @@ bool RendererClientBase::OverrideCreatePlugin(
void RendererClientBase::AddSupportedKeySystems(
std::vector<std::unique_ptr<::media::KeySystemProperties>>* key_systems) {
#if defined(WIDEVINE_CDM_AVAILABLE)
key_systems_provider_.AddSupportedKeySystems(key_systems);
#endif
}
bool RendererClientBase::IsKeySystemsUpdateNeeded() {
#if defined(WIDEVINE_CDM_AVAILABLE)
return key_systems_provider_.IsKeySystemsUpdateNeeded();
#else
return false;
#endif
}
v8::Local<v8::Context> RendererClientBase::GetContext(

View file

@ -8,9 +8,14 @@
#include <string>
#include <vector>
#include "chrome/renderer/media/chrome_key_systems_provider.h"
#include "content/public/renderer/content_renderer_client.h"
#include "third_party/WebKit/public/web/WebLocalFrame.h"
#include "third_party/blink/public/web/web_local_frame.h"
// In SHARED_INTERMEDIATE_DIR.
#include "widevine_cdm_version.h" // NOLINT(build/include)
#if defined(WIDEVINE_CDM_AVAILABLE)
#include "chrome/renderer/media/chrome_key_systems_provider.h"
#endif
namespace atom {
@ -54,7 +59,9 @@ class RendererClientBase : public content::ContentRendererClient {
private:
std::unique_ptr<PreferencesManager> preferences_manager_;
#if defined(WIDEVINE_CDM_AVAILABLE)
ChromeKeySystemsProvider key_systems_provider_;
#endif
bool isolated_world_;
std::string renderer_client_id_;
// An increasing ID used for indentifying an V8 context in this process.

View file

@ -39,7 +39,8 @@ void SetApplicationLocaleOnIOThread(const std::string& locale) {
void BrowserClient::SetApplicationLocale(const std::string& locale) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (!BrowserThread::PostTask(
if (!BrowserThread::IsThreadInitialized(BrowserThread::IO) ||
!BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
base::BindOnce(&SetApplicationLocaleOnIOThread, locale))) {
g_io_thread_application_locale.Get() = locale;

View file

@ -29,6 +29,7 @@
#include "brightray/common/application_info.h"
#include "brightray/common/main_delegate.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/common/content_features.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/result_codes.h"
#include "media/base/localized_strings.h"
@ -181,8 +182,14 @@ void OverrideAppLogsPath() {
void BrowserMainParts::InitializeFeatureList() {
auto* cmd_line = base::CommandLine::ForCurrentProcess();
const auto enable_features =
auto enable_features =
cmd_line->GetSwitchValueASCII(switches::kEnableFeatures);
// Node depends on SharedArrayBuffer support, which was temporarily disabled
// by https://chromium-review.googlesource.com/c/chromium/src/+/849429 (in
// M64) and reenabled by
// https://chromium-review.googlesource.com/c/chromium/src/+/1159358 (in
// M70). Once Electron upgrades to M70, we can remove this.
enable_features += std::string(",") + features::kSharedArrayBuffer.name;
auto disable_features =
cmd_line->GetSwitchValueASCII(switches::kDisableFeatures);
auto feature_list = std::make_unique<base::FeatureList>();

View file

@ -5,7 +5,7 @@
#include "brightray/browser/io_thread.h"
#include "content/public/browser/browser_thread.h"
#include "net/proxy_resolution/proxy_service.h"
#include "net/proxy_resolution/proxy_resolution_service.h"
#include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_context_builder.h"
#include "net/url_request/url_request_context_getter.h"
@ -36,14 +36,12 @@ void IOThread::Init() {
url_request_context_getter_->AddRef();
#if defined(USE_NSS_CERTS)
net::SetMessageLoopForNSSHttpIO();
net::SetURLRequestContextForNSSHttpIO(url_request_context_.get());
#endif
}
void IOThread::CleanUp() {
#if defined(USE_NSS_CERTS)
net::ShutdownNSSHttpIO();
net::SetURLRequestContextForNSSHttpIO(nullptr);
#endif
// Explicitly release before the IO thread gets destroyed.

View file

@ -23,7 +23,9 @@ void RequireCTDelegate::ClearCTExcludedHostsList() {
}
RequireCTDelegate::CTRequirementLevel RequireCTDelegate::IsCTRequiredForHost(
const std::string& host) {
const std::string& host,
const net::X509Certificate* chain,
const net::HashValueVector& hashes) {
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
if (!ct_excluded_hosts_.empty() &&
(ct_excluded_hosts_.find(host) != ct_excluded_hosts_.end()))

View file

@ -22,7 +22,10 @@ class RequireCTDelegate
void ClearCTExcludedHostsList();
// net::TransportSecurityState::RequireCTDelegate:
CTRequirementLevel IsCTRequiredForHost(const std::string& host) override;
CTRequirementLevel IsCTRequiredForHost(
const std::string& host,
const net::X509Certificate* chain,
const net::HashValueVector& hashes) override;
private:
std::set<std::string> ct_excluded_hosts_;

View file

@ -40,10 +40,12 @@
#include "net/proxy_resolution/pac_file_fetcher_impl.h"
#include "net/proxy_resolution/proxy_config.h"
#include "net/proxy_resolution/proxy_config_service.h"
#include "net/proxy_resolution/proxy_service.h"
#include "net/proxy_resolution/proxy_config_with_annotation.h"
#include "net/proxy_resolution/proxy_resolution_service.h"
#include "net/ssl/channel_id_service.h"
#include "net/ssl/default_channel_id_store.h"
#include "net/ssl/ssl_config_service_defaults.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "net/url_request/data_protocol_handler.h"
#include "net/url_request/file_protocol_handler.h"
#include "net/url_request/static_http_user_agent_settings.h"
@ -286,13 +288,17 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
proxy_config.proxy_rules().bypass_rules.ParseFromString(
command_line.GetSwitchValueASCII(switches::kProxyBypassList));
storage_->set_proxy_resolution_service(
net::ProxyResolutionService::CreateFixed(proxy_config));
net::ProxyResolutionService::CreateFixed(
net::ProxyConfigWithAnnotation(proxy_config,
NO_TRAFFIC_ANNOTATION_YET)));
} else if (command_line.HasSwitch(switches::kProxyPacUrl)) {
auto proxy_config = net::ProxyConfig::CreateFromCustomPacURL(
GURL(command_line.GetSwitchValueASCII(switches::kProxyPacUrl)));
proxy_config.set_pac_mandatory(true);
storage_->set_proxy_resolution_service(
net::ProxyResolutionService::CreateFixed(proxy_config));
net::ProxyResolutionService::CreateFixed(
net::ProxyConfigWithAnnotation(proxy_config,
NO_TRAFFIC_ANNOTATION_YET)));
} else {
storage_->set_proxy_resolution_service(
net::ProxyResolutionService::CreateUsingSystemProxyResolver(

View file

@ -6,7 +6,6 @@ root_extra_deps = [ "//electron" ]
v8_promise_internal_field_count = 1
v8_typed_array_max_size_in_heap = 0
enable_widevine = true
enable_cdm_host_verification = false
proprietary_codecs = true
ffmpeg_branding = "Chrome"

View file

@ -26,8 +26,8 @@
#include "chrome/common/chrome_utility_printing_messages.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/child_process_data.h"
#include "content/public/browser/utility_process_host.h"
#include "content/public/browser/utility_process_host_client.h"
#include "content/browser/utility_process_host.h"
#include "content/browser/utility_process_host_client.h"
#include "printing/emf_win.h"
#include "printing/pdf_render_settings.h"
#include "ui/base/l10n/l10n_util.h"
@ -421,6 +421,7 @@ PdfConverterUtilityProcessHostClient::~PdfConverterUtilityProcessHostClient() {}
void PdfConverterUtilityProcessHostClient::Start(
const scoped_refptr<base::RefCountedMemory>& data,
const PdfConverter::StartCallback& start_callback) {
CHECK(false) << "Printing doesn't work yet.";
if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) {
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
@ -435,9 +436,12 @@ void PdfConverterUtilityProcessHostClient::Start(
// NOTE: This process _must_ be sandboxed, otherwise the pdf dll will load
// gdiplus.dll, change how rendering happens, and not be able to correctly
// generate when sent to a metafile DC.
/*
utility_process_host_ = content::UtilityProcessHost::Create(
this, base::ThreadTaskRunnerHandle::Get())
->AsWeakPtr();
*/
utility_process_host_ = nullptr;
utility_process_host_->SetName(GetName());
base::PostTaskAndReplyWithResult(
@ -546,7 +550,11 @@ void PdfConverterUtilityProcessHostClient::OnProcessLaunchFailed(
bool PdfConverterUtilityProcessHostClient::Send(IPC::Message* msg) {
if (utility_process_host_)
#if 1
CHECK(false) << "Printing is broken.";
#else
return utility_process_host_->Send(msg);
#endif
delete msg;
return false;
}

View file

@ -265,6 +265,7 @@ void PrintJob::StartPdfToEmfConversion(
const int kPrinterDpi = settings().dpi();
PdfRenderSettings settings(
content_area, gfx::Point(0, 0), gfx::Size(kPrinterDpi, kPrinterDpi), /*autorotate=*/true,
settings_.color() == COLOR,
print_text_with_gdi ? PdfRenderSettings::Mode::GDI_TEXT
: PdfRenderSettings::Mode::NORMAL);
pdf_conversion_state_->Start(
@ -313,6 +314,7 @@ void PrintJob::StartPdfToPostScriptConversion(
const int kPrinterDpi = settings().dpi();
PdfRenderSettings settings(
content_area, physical_offsets, gfx::Size(kPrinterDpi, kPrinterDpi), true /* autorotate? */,
settings_.color() == COLOR,
ps_level2 ? PdfRenderSettings::Mode::POSTSCRIPT_LEVEL2
: PdfRenderSettings::Mode::POSTSCRIPT_LEVEL3);
pdf_conversion_state_->Start(

View file

@ -17,7 +17,7 @@
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/child_process_host.h"
#include "printing/features/features.h"
#include "printing/buildflags/buildflags.h"
#if defined(OS_ANDROID)
#include "base/strings/string_number_conversions.h"

View file

@ -1045,7 +1045,7 @@ bool ProcessSingleton::Create() {
sock_ = sock;
if (BrowserThread::IsMessageLoopValid(BrowserThread::IO)) {
if (BrowserThread::IsThreadInitialized(BrowserThread::IO)) {
StartListeningOnSocket();
} else {
listen_on_ready_ = true;

View file

@ -11,7 +11,7 @@
#include "components/security_state/core/security_state.h"
#include "content/public/browser/web_contents_observer.h"
#include "content/public/browser/web_contents_user_data.h"
#include "third_party/WebKit/public/platform/WebSecurityStyle.h"
#include "third_party/blink/public/platform/web_security_style.h"
namespace content {
class NavigationHandle;

View file

@ -8,6 +8,7 @@
#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/mac/bundle_locations.h"
#include "base/native_library.h"
#include "base/path_service.h"
#include "base/strings/string_util.h"
#include "base/sys_info.h"
@ -15,8 +16,8 @@
#include "base/version.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_paths_internal.h"
#include "chrome/common/widevine_cdm_constants.h"
#include "media/media_features.h"
#include "media/cdm/cdm_paths.h"
#include "media/media_buildflags.h"
#include "third_party/widevine/cdm/stub/widevine_cdm_version.h"
#include "third_party/widevine/cdm/widevine_cdm_common.h"
@ -37,6 +38,45 @@
namespace {
// Taken from src/media/cdm/cdm_paths.cc
const char kPlatformSpecific[] = "_platform_specific";
// Name of the component platform in the manifest.
const char kComponentPlatform[] =
#if defined(OS_MACOSX)
"mac";
#elif defined(OS_WIN)
"win";
#elif defined(OS_CHROMEOS)
"cros";
#elif defined(OS_LINUX)
"linux";
#else
"unsupported_platform";
#endif
// Name of the component architecture in the manifest.
const char kComponentArch[] =
#if defined(ARCH_CPU_X86)
"x86";
#elif defined(ARCH_CPU_X86_64)
"x64";
#elif defined(ARCH_CPU_ARMEL)
"arm";
#else
"unsupported_arch";
#endif
// End src/media/cdm/cdm_paths.cc
base::FilePath GetWidevinePath() {
base::FilePath path;
const std::string kPlatformArch =
std::string(kComponentPlatform) + "_" + kComponentArch;
return path.AppendASCII(kWidevineCdmBaseDirectory)
.AppendASCII(kPlatformSpecific)
.AppendASCII(kPlatformArch);
}
// The Pepper Flash plugins are in a directory with this name.
const base::FilePath::CharType kPepperFlashBaseDirectory[] =
FILE_PATH_LITERAL("PepperFlash");
@ -369,13 +409,14 @@ bool PathProvider(int key, base::FilePath* result) {
cur = cur.AppendASCII(kWidevineCdmBaseDirectory);
break;
#endif // defined(WIDEVINE_CDM_IS_COMPONENT)
// TODO(xhwang): FILE_WIDEVINE_CDM_ADAPTER has different meanings.
// In the component case, this is the source adapter. Otherwise, it is the
// actual Pepper module that gets loaded.
case chrome::FILE_WIDEVINE_CDM_ADAPTER:
// TODO(crbug.com/663554): Remove this after component updated CDM is
// supported on Linux and ChromeOS.
case chrome::FILE_WIDEVINE_CDM:
if (!GetInternalPluginsDirectory(&cur))
return false;
cur = cur.AppendASCII(kWidevineCdmAdapterFileName);
cur =
cur.Append(GetWidevinePath())
.AppendASCII(base::GetNativeLibraryName(kWidevineCdmLibraryName));
break;
#endif // defined(WIDEVINE_CDM_AVAILABLE) && BUILDFLAG(ENABLE_LIBRARY_CDMS)
case chrome::FILE_RESOURCES_PACK:

View file

@ -98,7 +98,7 @@ enum {
// (subdir of DIR_PNACL_BASE).
DIR_COMPONENT_WIDEVINE_CDM, // Directory that contains component-updated
// Widevine CDM files.
FILE_WIDEVINE_CDM_ADAPTER, // Full path to the Widevine CDM adapter file.
FILE_WIDEVINE_CDM, // Full path to the Widevine CDM.
FILE_RESOURCES_PACK, // Full path to the .pak file containing
// binary data (e.g., html files and images
// used by internal pages).

View file

@ -13,7 +13,7 @@
#include "ipc/ipc_param_traits.h"
#include "ipc/ipc_platform_file.h"
#include "printing/backend/print_backend.h"
#include "printing/features/features.h"
#include "printing/buildflags/buildflags.h"
#include "printing/page_range.h"
#include "printing/pdf_render_settings.h"
#include "printing/pwg_raster_settings.h"

View file

@ -13,7 +13,7 @@
#include "ipc/ipc_message_macros.h"
#include "printing/page_size_margins.h"
#include "printing/print_job_constants.h"
#include "third_party/WebKit/public/web/WebPrintScalingOption.h"
#include "third_party/blink/public/web/web_print_scaling_option.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/native_widget_types.h"

View file

@ -25,24 +25,24 @@
#include "net/base/escape.h"
#include "printing/pdf_metafile_skia.h"
#include "printing/units.h"
#include "third_party/WebKit/public/mojom/page/page_visibility_state.mojom.h"
#include "third_party/WebKit/public/platform/WebDoubleSize.h"
#include "third_party/WebKit/public/platform/WebSize.h"
#include "third_party/WebKit/public/platform/WebURLRequest.h"
#include "third_party/WebKit/public/web/WebConsoleMessage.h"
#include "third_party/WebKit/public/web/WebDocument.h"
#include "third_party/WebKit/public/web/WebElement.h"
#include "third_party/WebKit/public/web/WebFrameClient.h"
#include "third_party/WebKit/public/web/WebFrameWidget.h"
#include "third_party/WebKit/public/web/WebLocalFrame.h"
#include "third_party/WebKit/public/web/WebPlugin.h"
#include "third_party/WebKit/public/web/WebPluginDocument.h"
#include "third_party/WebKit/public/web/WebPrintParams.h"
#include "third_party/WebKit/public/web/WebPrintScalingOption.h"
#include "third_party/WebKit/public/web/WebScriptSource.h"
#include "third_party/WebKit/public/web/WebSettings.h"
#include "third_party/WebKit/public/web/WebView.h"
#include "third_party/WebKit/public/web/WebViewClient.h"
#include "third_party/blink/public/mojom/page/page_visibility_state.mojom.h"
#include "third_party/blink/public/platform/web_double_size.h"
#include "third_party/blink/public/platform/web_size.h"
#include "third_party/blink/public/platform/web_url_request.h"
#include "third_party/blink/public/web/web_console_message.h"
#include "third_party/blink/public/web/web_document.h"
#include "third_party/blink/public/web/web_element.h"
#include "third_party/blink/public/web/web_frame_client.h"
#include "third_party/blink/public/web/web_frame_widget.h"
#include "third_party/blink/public/web/web_local_frame.h"
#include "third_party/blink/public/web/web_plugin.h"
#include "third_party/blink/public/web/web_plugin_document.h"
#include "third_party/blink/public/web/web_print_params.h"
#include "third_party/blink/public/web/web_print_scaling_option.h"
#include "third_party/blink/public/web/web_script_source.h"
#include "third_party/blink/public/web/web_settings.h"
#include "third_party/blink/public/web/web_view.h"
#include "third_party/blink/public/web/web_view_client.h"
#include "third_party/skia/include/core/SkCanvas.h"
#include "ui/base/resource/resource_bundle.h"

View file

@ -16,10 +16,10 @@
#include "content/public/renderer/render_frame_observer.h"
#include "content/public/renderer/render_frame_observer_tracker.h"
#include "printing/pdf_metafile_skia.h"
#include "third_party/WebKit/public/platform/WebCanvas.h"
#include "third_party/WebKit/public/web/WebLocalFrame.h"
#include "third_party/WebKit/public/web/WebNode.h"
#include "third_party/WebKit/public/web/WebPrintParams.h"
#include "third_party/blink/public/platform/web_canvas.h"
#include "third_party/blink/public/web/web_local_frame.h"
#include "third_party/blink/public/web/web_node.h"
#include "third_party/blink/public/web/web_print_params.h"
#include "ui/gfx/geometry/size.h"
struct PrintMsg_Print_Params;

View file

@ -12,7 +12,7 @@
#include "printing/metafile_skia_wrapper.h"
#include "printing/page_size_margins.h"
#include "printing/pdf_metafile_skia.h"
#include "third_party/WebKit/public/web/WebLocalFrame.h"
#include "third_party/blink/public/web/web_local_frame.h"
#if !defined(OS_CHROMEOS) && !defined(OS_ANDROID)
#include "base/process/process_handle.h"

View file

@ -12,8 +12,8 @@
#include "chrome/common/print_messages.h"
#include "printing/metafile_skia_wrapper.h"
#include "printing/page_size_margins.h"
#include "third_party/WebKit/public/platform/WebCanvas.h"
#include "third_party/WebKit/public/web/WebLocalFrame.h"
#include "third_party/blink/public/platform/web_canvas.h"
#include "third_party/blink/public/web/web_local_frame.h"
namespace printing {

View file

@ -14,7 +14,7 @@
#include "printing/page_size_margins.h"
#include "printing/pdf_metafile_skia.h"
#include "printing/units.h"
#include "third_party/WebKit/public/web/WebLocalFrame.h"
#include "third_party/blink/public/web/web_local_frame.h"
namespace printing {

View file

@ -8,10 +8,10 @@
#include "chrome/common/tts_messages.h"
#include "chrome/common/tts_utterance_request.h"
#include "content/public/renderer/render_thread.h"
#include "third_party/WebKit/public/platform/WebSpeechSynthesisUtterance.h"
#include "third_party/WebKit/public/platform/WebSpeechSynthesisVoice.h"
#include "third_party/WebKit/public/platform/WebString.h"
#include "third_party/WebKit/public/platform/WebVector.h"
#include "third_party/blink/public/platform/web_speech_synthesis_utterance.h"
#include "third_party/blink/public/platform/web_speech_synthesis_voice.h"
#include "third_party/blink/public/platform/web_string.h"
#include "third_party/blink/public/platform/web_vector.h"
using blink::WebSpeechSynthesisUtterance;
using blink::WebSpeechSynthesisVoice;

View file

@ -9,8 +9,8 @@
#include "base/containers/hash_tables.h"
#include "content/public/renderer/render_thread_observer.h"
#include "third_party/WebKit/public/platform/WebSpeechSynthesizer.h"
#include "third_party/WebKit/public/platform/WebSpeechSynthesizerClient.h"
#include "third_party/blink/public/platform/web_speech_synthesizer.h"
#include "third_party/blink/public/platform/web_speech_synthesizer_client.h"
namespace IPC {
class Message;

View file

@ -161,6 +161,7 @@ bool PrintingHandlerWin::RenderPdfPageToMetafile(int page_number,
pdf_rendering_settings_.area.y() - offset_y,
pdf_rendering_settings_.area.width(),
pdf_rendering_settings_.area.height(), true, false, true, true,
pdf_rendering_settings_.use_color,
pdf_rendering_settings_.autorotate)) {
return false;
}

View file

@ -38,7 +38,7 @@ component("pepper_flash") {
deps = [
"//content/public/browser",
"//content/public/renderer",
"//media:media_features",
"//media:media_buildflags",
"//ppapi/host",
"//ppapi/proxy",
"//ppapi/proxy:ipc",

View file

@ -93,8 +93,8 @@ These individual tutorials expand on topics discussed in the guide above.
* [Using asar Archives](tutorial/application-packaging.md#using-asar-archives)
* [Limitations](tutorial/application-packaging.md#limitations-of-the-node-api)
* [Adding Unpacked Files to asar Archives](tutorial/application-packaging.md#adding-unpacked-files-to-asar-archives)
* [In Detail: Testing Widevine CDM](tutorial/testing-widevine-cdm.md)
* [In Detail: Using Pepper Flash Plugin](tutorial/using-pepper-flash-plugin.md)
* [In Detail: Using Widevine CDM Plugin](tutorial/using-widevine-cdm-plugin.md)
* [Offscreen Rendering](tutorial/offscreen-rendering.md)
---

View file

@ -49,9 +49,7 @@ app.getAppMetrics()
// Deprecated
const metrics = app.getAppMetrics()
const {memory} = metrics[0]
memory.privateBytes // Deprecated property
memory.sharedBytes // Deprecated property
const {memory} = metrics[0] // Deprecated property
```
## `BrowserWindow`
@ -135,8 +133,6 @@ nativeImage.createFromBuffer(buffer, {
```js
// Deprecated
const info = process.getProcessMemoryInfo()
const privateBytes = info.privateBytes // deprecated property
const sharedBytes = info.sharedBytes // deprecated property
```
## `screen`

View file

@ -14,7 +14,6 @@ In sandboxed renderers the `process` object contains only a subset of the APIs:
- `crash()`
- `hang()`
- `getHeapStatistics()`
- `getProcessMemoryInfo()`
- `getSystemMemoryInfo()`
- `getCPUUsage()`
- `getIOCounters()`
@ -156,22 +155,6 @@ Returns `Object`:
Returns an object with V8 heap statistics. Note that all statistics are reported in Kilobytes.
### `process.getProcessMemoryInfo()`
Returns `Object`:
* `workingSetSize` Integer - The amount of memory currently pinned to actual physical
RAM.
* `peakWorkingSetSize` Integer - The maximum amount of memory that has ever been pinned
to actual physical RAM.
* `privateBytes` Integer - The amount of memory not shared by other processes, such as
JS heap or HTML content.
* `sharedBytes` Integer - The amount of memory shared between processes, typically
memory consumed by the Electron code itself.
Returns an object giving memory usage statistics about the current process. Note
that all statistics are reported in Kilobytes.
### `process.getSystemMemoryInfo()`
Returns `Object`:

View file

@ -2,5 +2,4 @@
* `pid` Integer - Process id of the process.
* `type` String - Process type (Browser or Tab or GPU etc).
* `memory` [MemoryInfo](memory-info.md) - Memory information for the process.
* `cpu` [CPUUsage](cpu-usage.md) - CPU usage of the process.

View file

@ -0,0 +1,60 @@
# Testing Widevine CDM
In Electron you can use the Widevine CDM library shipped with Chrome browser.
## Getting the library
Open `chrome://components/` in Chrome browser, find `Widevine Content Decryption Module`
and make sure it is up to date, then you can find the library files from the
application directory.
### On Windows
The library file `widevinecdm.dll` will be under
`Program Files(x86)/Google/Chrome/Application/CHROME_VERSION/WidevineCdm/_platform_specific/win_(x86|x64)/`
directory.
### On MacOS
The library file `libwidevinecdm.dylib` will be under
`/Applications/Google Chrome.app/Contents/Versions/CHROME_VERSION/Google Chrome Framework.framework/Versions/A/Libraries/WidevineCdm/_platform_specific/mac_(x86|x64)/`
directory.
**Note:** Make sure that chrome version used by Electron is greater than or
equal to the `min_chrome_version` value of Chrome's widevine cdm component.
The value can be found in `manifest.json` under `WidevineCdm` directory.
## Using the library
After getting the library files, you should pass the path to the file
with `--widevine-cdm-path` command line switch, and the library's version
with `--widevine-cdm-version` switch. The command line switches have to be
passed before the `ready` event of `app` module gets emitted.
Example code:
```javascript
const {app, BrowserWindow} = require('electron')
// You have to pass the directory that contains widevine library here, it is
// * `libwidevinecdm.dylib` on macOS,
// * `widevinecdm.dll` on Windows.
app.commandLine.appendSwitch('widevine-cdm-path', '/path/to/widevine_library')
// The version of plugin can be got from `chrome://plugins` page in Chrome.
app.commandLine.appendSwitch('widevine-cdm-version', '1.4.8.866')
let win = null
app.on('ready', () => {
win = new BrowserWindow()
win.show()
})
```
## Verifying Widevine CDM support
To verify whether widevine works, you can use following ways:
* Open https://shaka-player-demo.appspot.com/ and load a manifest that uses
`Widevine`.
* Open http://www.dash-player.com/demo/drm-test-area/, check whether the page
says `bitdash uses Widevine in your browser`, then play the video.

View file

@ -1,85 +0,0 @@
# Using Widevine CDM Plugin
In Electron you can use the Widevine CDM plugin shipped with Chrome browser.
## Getting the plugin
Electron doesn't ship with the Widevine CDM plugin for license reasons, to get
it, you need to install the official Chrome browser first, which should match
the architecture and Chrome version of the Electron build you use.
**Note:** The major version of Chrome browser has to be the same with the Chrome
version used by Electron, otherwise the plugin will not work even though
`navigator.plugins` would show it has been loaded.
### Windows & macOS
Open `chrome://components/` in Chrome browser, find `WidevineCdm` and make
sure it is up to date, then you can find all the plugin binaries from the
`Program Files(x86)/Google/Chrome/Application/VERSION/WidevineCDM/_platform_specific/PLATFORM_ARCH/`
directory.
`APP_DATA` is system's location for storing app data, on Windows it is
`%LOCALAPPDATA%`, on macOS it is `~/Library/Application Support`. `VERSION` is
Widevine CDM plugin's version string, like `1.4.8.866`. `PLATFORM` is `mac` or
`win`. `ARCH` is `x86` or `x64`.
On Windows the required binaries are `widevinecdm.dll` and
`widevinecdmadapter.dll`, on macOS they are `libwidevinecdm.dylib` and
`widevinecdmadapter.plugin`. You can copy them to anywhere you like, but they
have to be put together.
### Linux
On Linux the plugin binaries are shipped together with Chrome browser, you can
find them under `/opt/google/chrome`, the filenames are `libwidevinecdm.so` and
`libwidevinecdmadapter.so`.
## Using the plugin
After getting the plugin files, you should pass the `widevinecdmadapter`'s path
to Electron with `--widevine-cdm-path` command line switch, and the plugin's
version with `--widevine-cdm-version` switch.
**Note:** Though only the `widevinecdmadapter` binary is passed to Electron, the
`widevinecdm` binary has to be put aside it.
The command line switches have to be passed before the `ready` event of `app`
module gets emitted, and the page that uses this plugin must have plugin
enabled.
Example code:
```javascript
const {app, BrowserWindow} = require('electron')
// You have to pass the filename of `widevinecdmadapter` here, it is
// * `widevinecdmadapter.plugin` on macOS,
// * `libwidevinecdmadapter.so` on Linux,
// * `widevinecdmadapter.dll` on Windows.
app.commandLine.appendSwitch('widevine-cdm-path', '/path/to/widevinecdmadapter.plugin')
// The version of plugin can be got from `chrome://plugins` page in Chrome.
app.commandLine.appendSwitch('widevine-cdm-version', '1.4.8.866')
let win = null
app.on('ready', () => {
win = new BrowserWindow({
webPreferences: {
// The `plugins` have to be enabled.
plugins: true
}
})
win.show()
})
```
## Verifying the plugin
To verify whether the plugin works, you can use following ways:
* Open devtools and check whether `navigator.plugins` includes the Widevine
CDM plugin.
* Open https://shaka-player-demo.appspot.com/ and load a manifest that uses
`Widevine`.
* Open http://www.dash-player.com/demo/drm-test-area/, check whether the page
says `bitdash uses Widevine in your browser`, then play the video.

View file

@ -1,5 +1,5 @@
import("//build/config/locales.gni")
import("//printing/features/features.gni")
import("//printing/buildflags/buildflags.gni")
import("//tools/grit/repack.gni")
import("//ui/base/ui_features.gni")
@ -17,7 +17,7 @@ template("electron_repack_percent") {
# All sources should also have deps for completeness.
sources = [
"$root_gen_dir/blink/public/resources/blink_scaled_resources_${percent}_percent.pak",
"$root_gen_dir/third_party/blink/public/resources/blink_scaled_resources_${percent}_percent.pak",
"$root_gen_dir/components/components_resources_${percent}_percent.pak",
"$root_gen_dir/content/app/resources/content_resources_${percent}_percent.pak",
"$root_gen_dir/ui/resources/ui_resources_${percent}_percent.pak",
@ -26,7 +26,7 @@ template("electron_repack_percent") {
deps = [
"//components/resources",
"//content/app/resources",
"//third_party/WebKit/public:scaled_resources_${percent}_percent",
"//third_party/blink/public:scaled_resources_${percent}_percent",
"//ui/resources",
]
@ -53,7 +53,7 @@ template("electron_extra_paks") {
])
output = "${invoker.output_dir}/resources.pak"
sources = [
"$root_gen_dir/blink/public/resources/blink_resources.pak",
"$root_gen_dir/third_party/blink/public/resources/blink_resources.pak",
"$root_gen_dir/components/components_resources.pak",
"$root_gen_dir/content/browser/tracing/tracing_resources.pak",
"$root_gen_dir/content/content_resources.pak",
@ -66,7 +66,7 @@ template("electron_extra_paks") {
"//content/browser/tracing:resources",
"//mojo/public/js:resources",
"//net:net_resources",
"//third_party/WebKit/public:resources",
"//third_party/blink/public:resources",
]
if (defined(invoker.deps)) {
deps += invoker.deps

View file

@ -43,9 +43,8 @@ Object.assign(app, {
const nativeFn = app.getAppMetrics
app.getAppMetrics = () => {
let metrics = nativeFn.call(app)
for (const {memory} of metrics) {
deprecate.removeProperty(memory, 'privateBytes')
deprecate.removeProperty(memory, 'sharedBytes')
for (const metric of metrics) {
deprecate.removeProperty(metric, 'memory')
}
return metrics

View file

@ -49,7 +49,6 @@ const preloadProcess = new events.EventEmitter()
preloadProcess.crash = () => binding.crash()
preloadProcess.hang = () => binding.hang()
preloadProcess.getHeapStatistics = () => binding.getHeapStatistics()
preloadProcess.getProcessMemoryInfo = () => binding.getProcessMemoryInfo()
preloadProcess.getSystemMemoryInfo = () => binding.getSystemMemoryInfo()
preloadProcess.getCPUUsage = () => binding.getCPUUsage()
preloadProcess.getIOCounters = () => binding.getIOCounters()

View file

@ -786,15 +786,7 @@ describe('app module', () => {
expect(appMetrics).to.be.an('array').and.have.lengthOf.at.least(1, 'App memory info object is not > 0')
const types = []
for (const {memory, pid, type, cpu} of appMetrics) {
expect(memory.workingSetSize).to.be.above(0, 'working set size is not > 0')
// windows causes failures here due to CI server configuration
if (process.platform !== 'win32') {
expect(memory.privateBytes).to.be.above(0, 'private bytes is not > 0')
expect(memory.sharedBytes).to.be.above(0, 'shared bytes is not > 0')
}
for (const {pid, type, cpu} of appMetrics) {
expect(pid).to.be.above(0, 'pid is not > 0')
expect(type).to.be.a('string').that.is.not.empty()

View file

@ -1627,7 +1627,8 @@ describe('BrowserWindow module', () => {
w.loadFile(path.join(fixtures, 'pages', 'window-open.html'))
})
it('releases memory after popup is closed', (done) => {
// TODO(alexeykuzmin): `GetProcessMemoryInfo()` is not available starting Ch67.
xit('releases memory after popup is closed', (done) => {
w.destroy()
w = new BrowserWindow({
show: false,

View file

@ -34,15 +34,16 @@ describe('process module', () => {
})
})
describe('process.getProcessMemoryInfo()', () => {
it('returns process memory info object', () => {
const processMemoryInfo = process.getProcessMemoryInfo()
expect(processMemoryInfo.peakWorkingSetSize).to.be.a('number')
expect(processMemoryInfo.privateBytes).to.be.a('number')
expect(processMemoryInfo.sharedBytes).to.be.a('number')
expect(processMemoryInfo.workingSetSize).to.be.a('number')
})
})
// FIXME: Chromium 67 - getProcessMemoryInfo has been removed
// describe('process.getProcessMemoryInfo()', () => {
// it('returns process memory info object', () => {
// const processMemoryInfo = process.getProcessMemoryInfo()
// expect(processMemoryInfo.peakWorkingSetSize).to.be.a('number')
// expect(processMemoryInfo.privateBytes).to.be.a('number')
// expect(processMemoryInfo.sharedBytes).to.be.a('number')
// expect(processMemoryInfo.workingSetSize).to.be.a('number')
// })
// })
describe('process.getSystemMemoryInfo()', () => {
it('returns system memory info object', () => {

View file

@ -399,7 +399,9 @@ describe('remote module', () => {
})
})
it('emits unhandled rejection events in the renderer process', (done) => {
// FIXME(alexeykuzmin): [Ch67] Enable the test back.
// It looks like the "unhandledrejection" handler is no longer called.
xit('emits unhandled rejection events in the renderer process', (done) => {
window.addEventListener('unhandledrejection', function (event) {
event.preventDefault()
assert.equal(event.reason.message, 'rejected')

View file

@ -895,6 +895,12 @@ describe('asar package', function () {
const {hasOwnProperty} = Object.prototype
for (const [propertyName, originalValue] of Object.entries(originalFs)) {
// Some properties exist but have a value of `undefined` on some platforms.
// E.g. `fs.lchmod`, which in only available on MacOS, see
// https://nodejs.org/docs/latest-v10.x/api/fs.html#fs_fs_lchmod_path_mode_callback
// Also check for `null`s, `hasOwnProperty()` can't handle them.
if (typeof originalValue === 'undefined' || originalValue === null) continue
if (hasOwnProperty.call(originalValue, util.promisify.custom)) {
expect(fs).to.have.own.property(propertyName)
.that.has.own.property(util.promisify.custom)

View file

@ -35,20 +35,21 @@
await invokeGc()
ipcRenderer.send('answer', new Hello().say())
},
'allocate-memory': async () => {
await invokeGc()
const {privateBytes: bytesBeforeOpen} = process.getProcessMemoryInfo()
let w = open('./allocate-memory.html')
await invokeGc()
const {privateBytes: bytesAfterOpen} = process.getProcessMemoryInfo()
w.close()
w = null
await invokeGc()
const {privateBytes: bytesAfterClose} = process.getProcessMemoryInfo()
ipcRenderer.send('answer', {
bytesBeforeOpen, bytesAfterOpen, bytesAfterClose
})
},
// FIXME: Chromium 67 - getProcessMemoryInfo has been removed
// 'allocate-memory': async () => {
// await invokeGc()
// const {privateBytes: bytesBeforeOpen} = process.getProcessMemoryInfo()
// let w = open('./allocate-memory.html')
// await invokeGc()
// const {privateBytes: bytesAfterOpen} = process.getProcessMemoryInfo()
// w.close()
// w = null
// await invokeGc()
// const {privateBytes: bytesAfterClose} = process.getProcessMemoryInfo()
// ipcRenderer.send('answer', {
// bytesBeforeOpen, bytesAfterOpen, bytesAfterClose
// })
// },
'window-events': () => {
document.title = 'changed'
},