Compare commits

...

18 Commits
5938 ... 4389

Author SHA1 Message Date
Marshall Greenblatt
b36241da76 Fix fatal error: ntp_background.pb.h file not found
Fixes the following Official build compile error on MacOS:

FAILED: obj/chrome/browser/safe_browsing/safe_browsing/settings_reset_prompt_model.o
In file included from ../../chrome/browser/safe_browsing/settings_reset_prompt/settings_reset_prompt_model.cc:5:
In file included from ../../chrome/browser/safe_browsing/settings_reset_prompt/settings_reset_prompt_model.h:19:
In file included from ../../chrome/browser/profile_resetter/profile_resetter.h:22:
In file included from ../../chrome/browser/search/instant_service.h:21:
In file included from ../../chrome/browser/search/background/ntp_background_service.h:15:
../../chrome/browser/search/background/ntp_background_data.h:10:10: fatal error: 'chrome/browser/search/background/ntp_background.pb.h' file not found
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
2021-04-05 11:49:38 -04:00
Marshall Greenblatt
e7bbb1de04 Update to Chromium version 89.0.4389.114 2021-04-01 14:08:41 -04:00
Marshall Greenblatt
5b6b068835 Customize the 'platform' crash key value for ARM builds (see issue #2981, see issue #2773) 2021-03-31 11:12:30 -04:00
Marshall Greenblatt
def70e4c3d Fix crash in MediaRouterEnabled due to missing pref registration (see issue #2900) 2021-03-24 15:13:20 -04:00
Marshall Greenblatt
b1b52fe78d Fix potential use-after-free of V8TrackArrayBuffer (fixes issue #3074) 2021-03-23 16:20:05 -04:00
Corentin Dumont
c761b1e8c6 Windows: Fix out-of-sync timestamps in OSR mode (fixes issue #3102) 2021-03-23 16:14:57 -04:00
Marshall Greenblatt
2b76680114 Update to Chromium version 89.0.4389.90 2021-03-18 19:16:37 -04:00
Marshall Greenblatt
317059b72a Fix underflow in EventRouterForwarder::HandleEvent (fixes issue #3066) 2021-03-18 19:16:22 -04:00
Yannick
c02bfc66c2 Remove maximum frame rate limit with OSR (fixes issue #3077) 2021-03-18 13:47:41 -04:00
Marshall Greenblatt
594394cc6f Fix renderer crash when printing a PDF file (fixes issue #3100) 2021-03-18 12:59:17 -04:00
Marshall Greenblatt
b15d6d238d Fix print to PDF (fixes issue #3099) 2021-03-18 12:39:59 -04:00
Marshall Greenblatt
b5952bd58c Update ArrayBuffer to use new BackingStore API (fixes issue #3074) 2021-03-12 12:28:13 -05:00
Marshall Greenblatt
6f304546d3 Update to Chromium version 89.0.4389.72 2021-03-04 22:04:34 -05:00
Marshall Greenblatt
c1f90d8c93 Linux: cefclient: Fix GTK expectations with OSR multi-threaded-message-loop (fixes issue #3087) 2021-02-15 12:56:57 -05:00
Marshall Greenblatt
0ee2122512 Linux: cefclient: Fix GTK behavior with multi-threaded-message-loop (fixes issue #3087)
Switch to using g_main_context_default() in MainMessageLoopMultithreadedGtk. As of M86
(https://crrev.com/b960daf4e6) Chromium now creates its own context in MessagePumpGlib so
we can use the default context in cefclient. This is also more "correct" from a GTK usage
perspective. As part of this change all GTK dialogs and callbacks are now executed on the
main thread instead of the UI thread (note that these are the same thread when not using
multi-threaded-message-loop).
2021-02-12 15:03:44 -05:00
Marshall Greenblatt
0aefa4e196 Mac: Fix incorrect creation of NSAutoreleasePool (fixes issue #2160) 2021-02-11 17:31:37 -05:00
Cristian Amarie
6c06fdee78 Fix loading of URL without scheme (fixes issue #3079) 2021-02-10 13:33:09 -05:00
Marshall Greenblatt
e528bdb0b7 Update to Chromium version 89.0.4389.40 2021-02-08 19:05:42 -05:00
42 changed files with 334 additions and 243 deletions

View File

@@ -7,5 +7,6 @@
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
{
'chromium_checkout': 'refs/tags/89.0.4389.0'
'chromium_checkout': 'refs/tags/89.0.4389.114',
'depot_tools_checkout': '1f976d6f30'
}

View File

@@ -350,6 +350,13 @@ void CefFrameHostImpl::LoadURLWithExtras(const std::string& url,
// Any necessary fixup of the URL will occur in
// [CefBrowserHostBase|CefFrameHostImpl]::Navigate().
GURL gurl(url);
if (!url.empty() && !gurl.is_valid() && !gurl.has_scheme()) {
std::string fixed_scheme(url::kHttpScheme);
fixed_scheme.append(url::kStandardSchemeSeparator);
std::string new_url = url;
new_url.insert(0, fixed_scheme);
gurl = GURL(new_url);
}
if (frame_id == CefFrameHostImpl::kMainFrameId) {
// Load via the browser using NavigationController.

View File

@@ -487,8 +487,7 @@ gfx::Vector2d CefBrowserPlatformDelegateNativeWin::GetUiWheelEventOffset(
}
base::TimeTicks CefBrowserPlatformDelegateNativeWin::GetEventTimeStamp() const {
return base::TimeTicks() +
base::TimeDelta::FromMilliseconds(GetMessageTime());
return base::TimeTicks::Now();
}
// static

View File

@@ -10,15 +10,13 @@ namespace {
// The rate at which new calls to OnPaint will be generated.
const int kDefaultFrameRate = 30;
const int kMaximumFrameRate = 60;
} // namespace
int ClampFrameRate(int frame_rate) {
if (frame_rate < 1)
return kDefaultFrameRate;
else if (frame_rate > kMaximumFrameRate)
return kMaximumFrameRate;
return frame_rate;
}

View File

@@ -253,6 +253,7 @@ std::unique_ptr<PrefService> CreatePrefService(Profile* profile,
registry->RegisterStringPref(
prefs::kPrintPreviewDefaultDestinationSelectionRules, std::string());
registry->RegisterBooleanPref(prefs::kCloudPrintSubmitEnabled, false);
registry->RegisterBooleanPref(prefs::kEnableMediaRouter, true);
printing::PolicySettings::RegisterProfilePrefs(registry.get());
printing::PrintPreviewStickySettings::RegisterProfilePrefs(registry.get());
DownloadPrefs::RegisterProfilePrefs(registry.get());

View File

@@ -209,7 +209,13 @@ bool CefPrintViewManager::PrintToPDF(content::RenderFrameHost* rfh,
FillInDictionaryFromPdfPrintSettings(settings, ++next_pdf_request_id_,
pdf_print_state_->settings_);
GetPrintRenderFrame(rfh)->InitiatePrintPreview({}, !!settings.selection_only);
auto& print_render_frame = GetPrintRenderFrame(rfh);
if (!pdf_print_receiver_.is_bound()) {
print_render_frame->SetPrintPreviewUI(
pdf_print_receiver_.BindNewEndpointAndPassRemote());
}
print_render_frame->InitiatePrintPreview({}, !!settings.selection_only);
return true;
}
@@ -243,6 +249,28 @@ void CefPrintViewManager::RequestPrintPreview(
->PrintPreview(pdf_print_state_->settings_.Clone());
}
void CefPrintViewManager::CheckForCancel(int32_t preview_ui_id,
int32_t request_id,
CheckForCancelCallback callback) {
if (!pdf_print_state_) {
return PrintViewManager::CheckForCancel(preview_ui_id, request_id,
std::move(callback));
}
std::move(callback).Run(/*cancel=*/false);
}
void CefPrintViewManager::PrintPreviewFailed(int32_t document_cookie,
int32_t request_id) {
TerminatePdfPrintJob();
}
void CefPrintViewManager::PrintPreviewCancelled(int32_t document_cookie,
int32_t request_id) {
// Should never be canceled by CheckForCancel().
NOTREACHED();
}
void CefPrintViewManager::RenderFrameDeleted(
content::RenderFrameHost* render_frame_host) {
if (pdf_print_state_ &&
@@ -336,6 +364,7 @@ void CefPrintViewManager::OnMetafileReadyForPrinting_PrintToPdf(
// Reset state information.
pdf_print_state_.reset();
pdf_print_receiver_.reset();
// Save the PDF file to disk and then execute the callback.
CEF_POST_USER_VISIBLE_TASK(
@@ -355,6 +384,7 @@ void CefPrintViewManager::TerminatePdfPrintJob() {
// Reset state information.
pdf_print_state_.reset();
pdf_print_receiver_.reset();
}
} // namespace printing

View File

@@ -26,7 +26,8 @@ struct PrintHostMsg_RequestPrintPreview_Params;
namespace printing {
// CEF handler for print commands.
class CefPrintViewManager : public PrintViewManager {
class CefPrintViewManager : public PrintViewManager,
public mojom::PrintPreviewUI {
public:
~CefPrintViewManager() override;
@@ -44,6 +45,18 @@ class CefPrintViewManager : public PrintViewManager {
GetDefaultPrintSettingsCallback callback) override;
void DidShowPrintDialog() override;
void RequestPrintPreview(mojom::RequestPrintPreviewParamsPtr params) override;
void CheckForCancel(int32_t preview_ui_id,
int32_t request_id,
CheckForCancelCallback callback) override;
// printing::mojo::PrintPreviewUI methods:
void SetOptionsFromDocument(const mojom::OptionsFromDocumentParamsPtr params,
int32_t request_id) override {}
void PrintPreviewFailed(int32_t document_cookie, int32_t request_id) override;
void PrintPreviewCancelled(int32_t document_cookie,
int32_t request_id) override;
void PrinterSettingsInvalid(int32_t document_cookie,
int32_t request_id) override {}
// content::WebContentsObserver methods:
void RenderFrameDeleted(content::RenderFrameHost* render_frame_host) override;
@@ -74,6 +87,7 @@ class CefPrintViewManager : public PrintViewManager {
int next_pdf_request_id_ = content::RenderFrameHost::kNoFrameTreeNodeId;
struct PdfPrintState;
std::unique_ptr<PdfPrintState> pdf_print_state_;
mojo::AssociatedReceiver<mojom::PrintPreviewUI> pdf_print_receiver_{this};
DISALLOW_COPY_AND_ASSIGN(CefPrintViewManager);
};

View File

@@ -39,10 +39,14 @@ blink::WebElement CefPrintRenderFrameHelperDelegate::GetPdfElement(
url.host_piece() == extension_misc::kPdfExtensionId;
if (inside_print_preview || inside_pdf_extension) {
// <object> with id="plugin" is created in
// chrome/browser/resources/pdf/pdf.js.
auto plugin_element = frame->GetDocument().GetElementById("plugin");
if (!plugin_element.IsNull()) {
return plugin_element;
// chrome/browser/resources/pdf/pdf_viewer_base.js.
auto viewer_element = frame->GetDocument().GetElementById("viewer");
if (!viewer_element.IsNull() && !viewer_element.ShadowRoot().IsNull()) {
auto plugin_element =
viewer_element.ShadowRoot().QuerySelector("#plugin");
if (!plugin_element.IsNull()) {
return plugin_element;
}
}
NOTREACHED();
}

View File

@@ -318,20 +318,14 @@ class V8TrackArrayBuffer : public CefTrackNode {
public:
explicit V8TrackArrayBuffer(
v8::Isolate* isolate,
void* buffer,
CefRefPtr<CefV8ArrayBufferReleaseCallback> release_callback)
: isolate_(isolate),
buffer_(buffer),
release_callback_(release_callback) {
: isolate_(isolate), release_callback_(release_callback) {
DCHECK(isolate_);
isolate_->AdjustAmountOfExternalAllocatedMemory(
static_cast<int>(sizeof(V8TrackArrayBuffer)));
}
~V8TrackArrayBuffer() {
if (buffer_ != nullptr) {
release_callback_->ReleaseBuffer(buffer_);
}
isolate_->AdjustAmountOfExternalAllocatedMemory(
-static_cast<int>(sizeof(V8TrackArrayBuffer)));
}
@@ -340,8 +334,6 @@ class V8TrackArrayBuffer : public CefTrackNode {
return release_callback_;
}
void Detach() { buffer_ = nullptr; }
// Attach this track object to the specified V8 object.
void AttachTo(v8::Local<v8::Context> context,
v8::Local<v8::ArrayBuffer> arrayBuffer) {
@@ -362,7 +354,6 @@ class V8TrackArrayBuffer : public CefTrackNode {
private:
v8::Isolate* isolate_;
void* buffer_;
CefRefPtr<CefV8ArrayBufferReleaseCallback> release_callback_;
};
@@ -1409,8 +1400,24 @@ CefRefPtr<CefV8Value> CefV8Value::CreateArrayBuffer(
// Create a tracker object that will cause the user data reference to be
// released when the V8 object is destroyed.
V8TrackArrayBuffer* tracker =
new V8TrackArrayBuffer(isolate, buffer, release_callback);
v8::Local<v8::ArrayBuffer> ab = v8::ArrayBuffer::New(isolate, buffer, length);
new V8TrackArrayBuffer(isolate, release_callback);
if (release_callback)
release_callback->AddRef();
auto deleter = [](void* data, size_t length, void* deleter_data) {
auto* release_callback =
reinterpret_cast<CefV8ArrayBufferReleaseCallback*>(deleter_data);
if (release_callback) {
release_callback->ReleaseBuffer(data);
release_callback->Release();
}
};
std::unique_ptr<v8::BackingStore> backing = v8::ArrayBuffer::NewBackingStore(
buffer, length, deleter, release_callback.get());
v8::Local<v8::ArrayBuffer> ab =
v8::ArrayBuffer::New(isolate, std::move(backing));
// Attach the tracker object.
tracker->AttachTo(context, ab);
@@ -2286,8 +2293,6 @@ bool CefV8ValueImpl::NeuterArrayBuffer() {
return false;
}
arr->Detach();
V8TrackArrayBuffer* tracker = V8TrackArrayBuffer::Unwrap(context, obj);
tracker->Detach();
return true;
}

View File

@@ -251,6 +251,11 @@ patches = [
},
{
# Fix Jumbo/component build dependency issue.
#
# Fix fatal error: 'chrome/browser/search/background/ntp_background.pb.h'
# file not found from chrome/browser/safe_browsing/safe_browsing/
# settings_reset_prompt_model.cc via
# chrome/browser/search/background/ntp_background_service.h
'name': 'chrome_browser_safe_browsing',
},
{
@@ -519,5 +524,10 @@ patches = [
# Linux: Fix ATK assertion error when generating ARM build config.
# https://bugs.chromium.org/p/chromium/issues/detail?id=1123214
'name': 'linux_atk_1123214',
},
{
# Fix underflow in EventRouterForwarder::HandleEvent.
# https://bugs.chromium.org/p/chromium/issues/detail?id=1167149#c7
'name': 'chrome_extensions_event_router_3066',
}
]

View File

@@ -1,5 +1,5 @@
diff --git base/BUILD.gn base/BUILD.gn
index 4516b3575892..db53b698a7d4 100644
index 21e4ee1d3efb..ef289b9d5c91 100644
--- base/BUILD.gn
+++ base/BUILD.gn
@@ -34,6 +34,7 @@ import("//build/config/ui.gni")
@@ -23,7 +23,7 @@ index 4516b3575892..db53b698a7d4 100644
sources += [
"hash/md5_nacl.cc",
"hash/md5_nacl.h",
@@ -1867,6 +1872,12 @@ component("base") {
@@ -1869,6 +1874,12 @@ component("base") {
defines += [ "COM_INIT_CHECK_HOOK_DISABLED" ]
}

View File

@@ -1,8 +1,8 @@
diff --git content/browser/child_process_security_policy_impl.cc content/browser/child_process_security_policy_impl.cc
index d403f389af0d..c8ff688fd11f 100644
index 462373a8a8aa..7d54bca43243 100644
--- content/browser/child_process_security_policy_impl.cc
+++ content/browser/child_process_security_policy_impl.cc
@@ -1685,6 +1685,16 @@ bool ChildProcessSecurityPolicyImpl::CanAccessDataForOrigin(
@@ -1690,6 +1690,16 @@ bool ChildProcessSecurityPolicyImpl::CanAccessDataForOrigin(
// DeclarativeApiTest.PersistRules.
if (actual_process_lock.matches_scheme(url::kDataScheme))
return true;

View File

@@ -1,5 +1,5 @@
diff --git chrome/browser/BUILD.gn chrome/browser/BUILD.gn
index 40c07e2d724a..1cfe14f8cd6f 100644
index 2ace902f57a7..b0701df94ae2 100644
--- chrome/browser/BUILD.gn
+++ chrome/browser/BUILD.gn
@@ -12,6 +12,7 @@ import("//build/config/crypto.gni")
@@ -10,7 +10,7 @@ index 40c07e2d724a..1cfe14f8cd6f 100644
import("//chrome/browser/buildflags.gni")
import("//chrome/browser/downgrade/buildflags.gni")
import("//chrome/common/features.gni")
@@ -1966,6 +1967,7 @@ static_library("browser") {
@@ -1968,6 +1969,7 @@ static_library("browser") {
"//build:chromeos_buildflags",
"//build/config/compiler:compiler_buildflags",
"//cc",
@@ -18,7 +18,7 @@ index 40c07e2d724a..1cfe14f8cd6f 100644
"//chrome:extra_resources",
"//chrome:resources",
"//chrome:strings",
@@ -2489,6 +2491,10 @@ static_library("browser") {
@@ -2491,6 +2493,10 @@ static_library("browser") {
]
}
@@ -29,7 +29,7 @@ index 40c07e2d724a..1cfe14f8cd6f 100644
if (is_android) {
sources += [
"after_startup_task_utils_android.cc",
@@ -5104,7 +5110,7 @@ static_library("browser") {
@@ -5106,7 +5112,7 @@ static_library("browser") {
]
}

View File

@@ -1,8 +1,8 @@
diff --git chrome/browser/app_controller_mac.mm chrome/browser/app_controller_mac.mm
index e2eb5c2c73d0..601b582c6675 100644
index 3422b6409e40..f96e205a31a0 100644
--- chrome/browser/app_controller_mac.mm
+++ chrome/browser/app_controller_mac.mm
@@ -1194,6 +1194,7 @@ static base::mac::ScopedObjCClassSwizzler* g_swizzle_imk_input_session;
@@ -1220,6 +1220,7 @@ static base::mac::ScopedObjCClassSwizzler* g_swizzle_imk_input_session;
// Run a (background) application in a new tab.
- (void)executeApplication:(id)sender {
@@ -10,7 +10,7 @@ index e2eb5c2c73d0..601b582c6675 100644
NSInteger tag = [sender tag];
Profile* profile = [self lastProfile];
DCHECK(profile);
@@ -1202,6 +1203,7 @@ static base::mac::ScopedObjCClassSwizzler* g_swizzle_imk_input_session;
@@ -1228,6 +1229,7 @@ static base::mac::ScopedObjCClassSwizzler* g_swizzle_imk_input_session;
tag < static_cast<int>(applications.size()));
const extensions::Extension* extension = applications.GetExtension(tag);
BackgroundModeManager::LaunchBackgroundApplication(profile, extension);
@@ -18,7 +18,7 @@ index e2eb5c2c73d0..601b582c6675 100644
}
// Same as |-commandDispatch:|, but executes commands using a disposition
@@ -1599,6 +1601,7 @@ static base::mac::ScopedObjCClassSwizzler* g_swizzle_imk_input_session;
@@ -1617,6 +1619,7 @@ static base::mac::ScopedObjCClassSwizzler* g_swizzle_imk_input_session;
// TODO(rickcam): Mock out BackgroundApplicationListModel, then add unit
// tests which use the mock in place of the profile-initialized model.
@@ -26,7 +26,7 @@ index e2eb5c2c73d0..601b582c6675 100644
// Avoid breaking unit tests which have no profile.
if (profile) {
BackgroundApplicationListModel applications(profile);
@@ -1625,6 +1628,7 @@ static base::mac::ScopedObjCClassSwizzler* g_swizzle_imk_input_session;
@@ -1643,6 +1646,7 @@ static base::mac::ScopedObjCClassSwizzler* g_swizzle_imk_input_session;
}
}
}
@@ -118,10 +118,10 @@ index e0cafee5eedd..06ded156be3c 100644
// Make a copy of the BrowserList to simplify the case where we need to
// destroy a Browser during the loop.
diff --git chrome/browser/sessions/session_service.cc chrome/browser/sessions/session_service.cc
index cbddcc52a8f6..02ab085c481c 100644
index 6857a3cc5cae..c4d9db6ad7d5 100644
--- chrome/browser/sessions/session_service.cc
+++ chrome/browser/sessions/session_service.cc
@@ -968,12 +968,19 @@ void SessionService::MaybeDeleteSessionOnlyData() {
@@ -985,12 +985,19 @@ void SessionService::MaybeDeleteSessionOnlyData() {
if (!profile() || profile()->AsTestingProfile())
return;

View File

@@ -13,7 +13,7 @@ index ba0c5c3fc044..b4df9af95ecd 100644
return false;
}
diff --git chrome/browser/ui/browser.cc chrome/browser/ui/browser.cc
index 1dc23535c42a..4aae0399346f 100644
index 409f908148b3..19e57752bb78 100644
--- chrome/browser/ui/browser.cc
+++ chrome/browser/ui/browser.cc
@@ -257,6 +257,20 @@
@@ -37,7 +37,7 @@ index 1dc23535c42a..4aae0399346f 100644
#if BUILDFLAG(ENABLE_EXTENSIONS)
#include "chrome/browser/extensions/extension_browser_window_helper.h"
#endif
@@ -480,6 +494,13 @@ Browser::Browser(const CreateParams& params)
@@ -482,6 +496,13 @@ Browser::Browser(const CreateParams& params)
tab_strip_model_->AddObserver(this);
@@ -51,7 +51,7 @@ index 1dc23535c42a..4aae0399346f 100644
location_bar_model_ = std::make_unique<LocationBarModelImpl>(
location_bar_model_delegate_.get(), content::kMaxURLDisplayChars);
@@ -1343,6 +1364,14 @@ content::KeyboardEventProcessingResult Browser::PreHandleKeyboardEvent(
@@ -1345,6 +1366,14 @@ content::KeyboardEventProcessingResult Browser::PreHandleKeyboardEvent(
if (exclusive_access_manager_->HandleUserKeyEvent(event))
return content::KeyboardEventProcessingResult::HANDLED;
@@ -66,7 +66,7 @@ index 1dc23535c42a..4aae0399346f 100644
return window()->PreHandleKeyboardEvent(event);
}
@@ -1350,8 +1379,18 @@ bool Browser::HandleKeyboardEvent(content::WebContents* source,
@@ -1352,8 +1381,18 @@ bool Browser::HandleKeyboardEvent(content::WebContents* source,
const NativeWebKeyboardEvent& event) {
DevToolsWindow* devtools_window =
DevToolsWindow::GetInstanceForInspectedWebContents(source);
@@ -87,7 +87,7 @@ index 1dc23535c42a..4aae0399346f 100644
}
bool Browser::TabsNeedBeforeUnloadFired() {
@@ -1579,6 +1618,14 @@ WebContents* Browser::OpenURLFromTab(WebContents* source,
@@ -1581,6 +1620,14 @@ WebContents* Browser::OpenURLFromTab(WebContents* source,
return window->OpenURLFromTab(source, params);
}
@@ -102,7 +102,7 @@ index 1dc23535c42a..4aae0399346f 100644
NavigateParams nav_params(this, params.url, params.transition);
nav_params.FillNavigateParamsFromOpenURLParams(params);
nav_params.source_contents = source;
@@ -1692,6 +1739,8 @@ void Browser::LoadingStateChanged(WebContents* source,
@@ -1694,6 +1741,8 @@ void Browser::LoadingStateChanged(WebContents* source,
bool to_different_document) {
ScheduleUIUpdate(source, content::INVALIDATE_TYPE_LOAD);
UpdateWindowForLoadingStateChanged(source, to_different_document);
@@ -111,7 +111,7 @@ index 1dc23535c42a..4aae0399346f 100644
}
void Browser::CloseContents(WebContents* source) {
@@ -1719,6 +1768,8 @@ void Browser::SetContentsBounds(WebContents* source, const gfx::Rect& bounds) {
@@ -1721,6 +1770,8 @@ void Browser::SetContentsBounds(WebContents* source, const gfx::Rect& bounds) {
}
void Browser::UpdateTargetURL(WebContents* source, const GURL& url) {
@@ -120,7 +120,7 @@ index 1dc23535c42a..4aae0399346f 100644
if (!GetStatusBubble())
return;
@@ -1726,6 +1777,17 @@ void Browser::UpdateTargetURL(WebContents* source, const GURL& url) {
@@ -1728,6 +1779,17 @@ void Browser::UpdateTargetURL(WebContents* source, const GURL& url) {
GetStatusBubble()->SetURL(url);
}
@@ -138,7 +138,7 @@ index 1dc23535c42a..4aae0399346f 100644
void Browser::ContentsMouseEvent(WebContents* source,
bool motion,
bool exited) {
@@ -1842,6 +1904,10 @@ void Browser::WebContentsCreated(WebContents* source_contents,
@@ -1844,6 +1906,10 @@ void Browser::WebContentsCreated(WebContents* source_contents,
// Make the tab show up in the task manager.
task_manager::WebContentsTags::CreateForTabContents(new_contents);
@@ -149,7 +149,7 @@ index 1dc23535c42a..4aae0399346f 100644
}
void Browser::PortalWebContentsCreated(WebContents* portal_web_contents) {
@@ -1878,6 +1944,8 @@ void Browser::RendererResponsive(
@@ -1880,6 +1946,8 @@ void Browser::RendererResponsive(
void Browser::DidNavigateMainFramePostCommit(WebContents* web_contents) {
if (web_contents == tab_strip_model_->GetActiveWebContents())
UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_TAB_STATE);
@@ -158,7 +158,7 @@ index 1dc23535c42a..4aae0399346f 100644
}
content::JavaScriptDialogManager* Browser::GetJavaScriptDialogManager(
@@ -1924,11 +1992,15 @@ void Browser::EnterFullscreenModeForTab(
@@ -1926,11 +1994,15 @@ void Browser::EnterFullscreenModeForTab(
const blink::mojom::FullscreenOptions& options) {
exclusive_access_manager_->fullscreen_controller()->EnterFullscreenModeForTab(
requesting_frame, options.display_id);
@@ -174,7 +174,7 @@ index 1dc23535c42a..4aae0399346f 100644
}
bool Browser::IsFullscreenForTabOrPending(const WebContents* web_contents) {
@@ -2826,6 +2898,8 @@ void Browser::SetAsDelegate(WebContents* web_contents, bool set_delegate) {
@@ -2828,6 +2900,8 @@ void Browser::SetAsDelegate(WebContents* web_contents, bool set_delegate) {
content_translate_driver->RemoveTranslationObserver(this);
BookmarkTabHelper::FromWebContents(web_contents)->RemoveObserver(this);
}
@@ -184,7 +184,7 @@ index 1dc23535c42a..4aae0399346f 100644
void Browser::CloseFrame() {
diff --git chrome/browser/ui/browser.h chrome/browser/ui/browser.h
index 7287ec00c3f5..93df2551fab7 100644
index 1ccab44183bf..5a982980d79f 100644
--- chrome/browser/ui/browser.h
+++ chrome/browser/ui/browser.h
@@ -22,6 +22,7 @@
@@ -206,7 +206,7 @@ index 7287ec00c3f5..93df2551fab7 100644
#if defined(OS_ANDROID)
#error This file should only be included on desktop.
#endif
@@ -269,6 +274,11 @@ class Browser : public TabStripModelObserver,
@@ -273,6 +278,11 @@ class Browser : public TabStripModelObserver,
// User-set title of this browser window, if there is one.
std::string user_title;
@@ -218,7 +218,7 @@ index 7287ec00c3f5..93df2551fab7 100644
private:
friend class Browser;
friend class WindowSizerChromeOSTest;
@@ -386,6 +396,12 @@ class Browser : public TabStripModelObserver,
@@ -393,6 +403,12 @@ class Browser : public TabStripModelObserver,
return &signin_view_controller_;
}
@@ -231,7 +231,7 @@ index 7287ec00c3f5..93df2551fab7 100644
// Get the FindBarController for this browser, creating it if it does not
// yet exist.
FindBarController* GetFindBarController();
@@ -770,6 +786,11 @@ class Browser : public TabStripModelObserver,
@@ -777,6 +793,11 @@ class Browser : public TabStripModelObserver,
void SetContentsBounds(content::WebContents* source,
const gfx::Rect& bounds) override;
void UpdateTargetURL(content::WebContents* source, const GURL& url) override;
@@ -243,7 +243,7 @@ index 7287ec00c3f5..93df2551fab7 100644
void ContentsMouseEvent(content::WebContents* source,
bool motion,
bool exited) override;
@@ -1240,6 +1261,10 @@ class Browser : public TabStripModelObserver,
@@ -1248,6 +1269,10 @@ class Browser : public TabStripModelObserver,
extension_browser_window_helper_;
#endif

View File

@@ -1,5 +1,5 @@
diff --git chrome/browser/ui/BUILD.gn chrome/browser/ui/BUILD.gn
index afee70a01862..e49e769b6366 100644
index ae28f5ea7dbb..e77a72e28821 100644
--- chrome/browser/ui/BUILD.gn
+++ chrome/browser/ui/BUILD.gn
@@ -12,6 +12,7 @@ import("//build/config/features.gni")
@@ -21,7 +21,7 @@ index afee70a01862..e49e769b6366 100644
# Since browser and browser_ui actually depend on each other,
# we must omit the dependency from browser_ui to browser.
# However, this means browser_ui and browser should more or less
@@ -349,6 +354,7 @@ static_library("ui") {
@@ -350,6 +355,7 @@ static_library("ui") {
"//build:branding_buildflags",
"//build:chromeos_buildflags",
"//cc/paint",
@@ -29,7 +29,7 @@ index afee70a01862..e49e769b6366 100644
"//chrome:extra_resources",
"//chrome:resources",
"//chrome:strings",
@@ -1553,6 +1559,7 @@ static_library("ui") {
@@ -1554,6 +1560,7 @@ static_library("ui") {
"//components/page_load_metrics/browser",
"//components/performance_manager:site_data_proto",
"//components/printing/browser",
@@ -37,7 +37,7 @@ index afee70a01862..e49e769b6366 100644
"//components/profile_metrics",
"//components/reading_list/features:flags",
"//components/safe_browsing/core/common:safe_browsing_policy_handler",
@@ -3370,7 +3377,9 @@ static_library("ui") {
@@ -3371,7 +3378,9 @@ static_library("ui") {
"views/frame/browser_desktop_window_tree_host_platform.h",
]
}

View File

@@ -1,8 +1,8 @@
diff --git chrome/browser/chrome_content_browser_client.cc chrome/browser/chrome_content_browser_client.cc
index 19c5989c8b67..e85ce53a22a1 100644
index af5a31d3411a..7a444288d34a 100644
--- chrome/browser/chrome_content_browser_client.cc
+++ chrome/browser/chrome_content_browser_client.cc
@@ -1067,10 +1067,6 @@ void LaunchURL(const GURL& url,
@@ -1068,10 +1068,6 @@ void LaunchURL(const GURL& url,
}
}
@@ -13,7 +13,7 @@ index 19c5989c8b67..e85ce53a22a1 100644
void MaybeAppendSecureOriginsAllowlistSwitch(base::CommandLine* cmdline) {
// |allowlist| combines pref/policy + cmdline switch in the browser process.
// For renderer and utility (e.g. NetworkService) processes the switch is the
@@ -1258,6 +1254,14 @@ const blink::UserAgentBrandList& GetBrandVersionList() {
@@ -1259,6 +1255,14 @@ const blink::UserAgentBrandList& GetBrandVersionList() {
return *greased_brand_version_list;
}
@@ -29,7 +29,7 @@ index 19c5989c8b67..e85ce53a22a1 100644
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
if (command_line->HasSwitch(switches::kUserAgent)) {
diff --git chrome/browser/chrome_content_browser_client.h chrome/browser/chrome_content_browser_client.h
index 3ef2329ac8a6..3e3ede99e042 100644
index d6e0a910ef96..7daf665e7bbd 100644
--- chrome/browser/chrome_content_browser_client.h
+++ chrome/browser/chrome_content_browser_client.h
@@ -108,7 +108,8 @@ class ChromeXrIntegrationClient;

View File

@@ -1,5 +1,5 @@
diff --git chrome/browser/profiles/profile_manager.cc chrome/browser/profiles/profile_manager.cc
index 102a4c5ce183..a6ce775156b4 100644
index 20f57ee35862..1046710291b9 100644
--- chrome/browser/profiles/profile_manager.cc
+++ chrome/browser/profiles/profile_manager.cc
@@ -390,7 +390,7 @@ ProfileManager::ProfileManager(const base::FilePath& user_data_dir)
@@ -12,10 +12,10 @@ index 102a4c5ce183..a6ce775156b4 100644
}
diff --git chrome/browser/profiles/profile_manager.h chrome/browser/profiles/profile_manager.h
index 1be24b4ee39c..4288383cb2a8 100644
index 69840a8d8e2f..4ec980d7b914 100644
--- chrome/browser/profiles/profile_manager.h
+++ chrome/browser/profiles/profile_manager.h
@@ -106,7 +106,7 @@ class ProfileManager : public content::NotificationObserver,
@@ -113,7 +113,7 @@ class ProfileManager : public content::NotificationObserver,
// acceptable. Returns null if creation of the new profile fails.
// TODO(bauerb): Migrate calls from other code to GetProfileByPath(), then
// make this method private.
@@ -24,7 +24,7 @@ index 1be24b4ee39c..4288383cb2a8 100644
// Returns regular or off-the-record profile given its profile key.
static Profile* GetProfileFromProfileKey(ProfileKey* profile_key);
@@ -139,7 +139,7 @@ class ProfileManager : public content::NotificationObserver,
@@ -146,7 +146,7 @@ class ProfileManager : public content::NotificationObserver,
// Returns true if the profile pointer is known to point to an existing
// profile.
@@ -33,7 +33,7 @@ index 1be24b4ee39c..4288383cb2a8 100644
// Returns the directory where the first created profile is stored,
// relative to the user data directory currently in use.
@@ -148,7 +148,7 @@ class ProfileManager : public content::NotificationObserver,
@@ -155,7 +155,7 @@ class ProfileManager : public content::NotificationObserver,
// Get the Profile last used (the Profile to which owns the most recently
// focused window) with this Chrome build. If no signed profile has been
// stored in Local State, hand back the Default profile.

View File

@@ -1,5 +1,5 @@
diff --git chrome/browser/safe_browsing/BUILD.gn chrome/browser/safe_browsing/BUILD.gn
index ae8aef3a076c..f7e6a91047ef 100644
index ae8aef3a076c..d344ddcf3953 100644
--- chrome/browser/safe_browsing/BUILD.gn
+++ chrome/browser/safe_browsing/BUILD.gn
@@ -23,6 +23,7 @@ static_library("safe_browsing") {
@@ -10,3 +10,15 @@ index ae8aef3a076c..f7e6a91047ef 100644
"//components/keyed_service/content",
"//components/language/core/browser",
"//components/page_info",
@@ -66,7 +67,10 @@ static_library("safe_browsing") {
"settings_reset_prompt/settings_reset_prompt_util_win.h",
]
}
- deps += [ "//extensions/browser" ]
+ deps += [
+ "//chrome/browser:ntp_background_proto",
+ "//extensions/browser",
+ ]
}
if (safe_browsing_mode != 0) {

View File

@@ -0,0 +1,27 @@
diff --git chrome/browser/extensions/event_router_forwarder.cc chrome/browser/extensions/event_router_forwarder.cc
index ba788f3a937f..627ea39e4648 100644
--- chrome/browser/extensions/event_router_forwarder.cc
+++ chrome/browser/extensions/event_router_forwarder.cc
@@ -100,14 +100,18 @@ void EventRouterForwarder::HandleEvent(
}
}
- DCHECK_GT(profiles_to_dispatch_to.size(), 0u)
- << "There should always be at least one profile!";
+ // There should always be at least one profile when running as Chromium.
+ // However, some Chromium embedders are known to run without profiles, in
+ // which case there's nothing to dispatch to.
+ if (profiles_to_dispatch_to.size() == 0u)
+ return;
+ // Use the same event_args for each profile (making copies as needed).
std::vector<std::unique_ptr<base::ListValue>> per_profile_args;
per_profile_args.reserve(profiles_to_dispatch_to.size());
- for (size_t i = 0; i < profiles_to_dispatch_to.size() - 1; ++i)
- per_profile_args.emplace_back(event_args->DeepCopy());
per_profile_args.emplace_back(std::move(event_args));
+ for (size_t i = 1; i < profiles_to_dispatch_to.size(); ++i)
+ per_profile_args.emplace_back(per_profile_args.front()->DeepCopy());
DCHECK_EQ(per_profile_args.size(), profiles_to_dispatch_to.size());
size_t profile_args_index = 0;

View File

@@ -198,10 +198,10 @@ index ce40f0039fe0..c8cbecb61455 100644
// that the X-Frame-Options protection mechanism is set to either DENY or
// SAMEORIGIN.
diff --git chrome/renderer/chrome_content_renderer_client.cc chrome/renderer/chrome_content_renderer_client.cc
index a1c26dfbd5cc..aaf96b069c32 100644
index 0e417d912d48..0a57bdaa60bd 100644
--- chrome/renderer/chrome_content_renderer_client.cc
+++ chrome/renderer/chrome_content_renderer_client.cc
@@ -848,6 +848,7 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin(
@@ -855,6 +855,7 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin(
if ((status == chrome::mojom::PluginStatus::kUnauthorized ||
status == chrome::mojom::PluginStatus::kBlocked) &&
@@ -209,7 +209,7 @@ index a1c26dfbd5cc..aaf96b069c32 100644
content_settings_agent_delegate->IsPluginTemporarilyAllowed(
identifier)) {
status = chrome::mojom::PluginStatus::kAllowed;
@@ -1046,7 +1047,8 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin(
@@ -1053,7 +1054,8 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin(
render_frame->GetRemoteAssociatedInterfaces()->GetInterface(
plugin_auth_host.BindNewEndpointAndPassReceiver());
plugin_auth_host->BlockedUnauthorizedPlugin(group_name, identifier);
@@ -219,7 +219,7 @@ index a1c26dfbd5cc..aaf96b069c32 100644
break;
}
case chrome::mojom::PluginStatus::kBlocked: {
@@ -1055,7 +1057,8 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin(
@@ -1062,7 +1064,8 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin(
l10n_util::GetStringFUTF16(IDS_PLUGIN_BLOCKED, group_name));
placeholder->AllowLoading();
RenderThread::Get()->RecordAction(UserMetricsAction("Plugin_Blocked"));
@@ -229,7 +229,7 @@ index a1c26dfbd5cc..aaf96b069c32 100644
break;
}
case chrome::mojom::PluginStatus::kBlockedByPolicy: {
@@ -1065,7 +1068,8 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin(
@@ -1072,7 +1075,8 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin(
group_name));
RenderThread::Get()->RecordAction(
UserMetricsAction("Plugin_BlockedByPolicy"));
@@ -239,7 +239,7 @@ index a1c26dfbd5cc..aaf96b069c32 100644
break;
}
case chrome::mojom::PluginStatus::kBlockedNoLoading: {
@@ -1073,7 +1077,8 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin(
@@ -1080,7 +1084,8 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin(
IDR_BLOCKED_PLUGIN_HTML,
l10n_util::GetStringFUTF16(IDS_PLUGIN_BLOCKED_NO_LOADING,
group_name));

View File

@@ -1,5 +1,5 @@
diff --git chrome/renderer/BUILD.gn chrome/renderer/BUILD.gn
index 6a837ad9df98..7abef83f2a47 100644
index d90a361dba12..99e61c8b947f 100644
--- chrome/renderer/BUILD.gn
+++ chrome/renderer/BUILD.gn
@@ -5,6 +5,7 @@
@@ -10,7 +10,7 @@ index 6a837ad9df98..7abef83f2a47 100644
import("//chrome/common/features.gni")
import("//components/nacl/features.gni")
import("//components/offline_pages/buildflags/features.gni")
@@ -145,6 +146,7 @@ static_library("renderer") {
@@ -147,6 +148,7 @@ static_library("renderer") {
deps = [
"//base/allocator:buildflags",
"//build:chromeos_buildflags",
@@ -18,7 +18,7 @@ index 6a837ad9df98..7abef83f2a47 100644
"//chrome:resources",
"//chrome:strings",
"//chrome/common",
@@ -226,6 +228,10 @@ static_library("renderer") {
@@ -228,6 +230,10 @@ static_library("renderer") {
configs += [ "//build/config/compiler:wexit_time_destructors" ]

View File

@@ -78,7 +78,7 @@ index db85b6b2fcf5..bcf6867e8f4e 100644
#endif // defined(OS_LINUX) || defined(OS_CHROMEOS)
diff --git chrome/browser/chrome_browser_main.cc chrome/browser/chrome_browser_main.cc
index fee4d5f1a8ca..2e4fb506d851 100644
index cd769147ddc1..841b23f96012 100644
--- chrome/browser/chrome_browser_main.cc
+++ chrome/browser/chrome_browser_main.cc
@@ -49,6 +49,7 @@
@@ -89,7 +89,7 @@ index fee4d5f1a8ca..2e4fb506d851 100644
#include "chrome/browser/about_flags.h"
#include "chrome/browser/active_use_util.h"
#include "chrome/browser/after_startup_task_utils.h"
@@ -902,8 +903,10 @@ int ChromeBrowserMainParts::PreCreateThreadsImpl() {
@@ -903,8 +904,10 @@ int ChromeBrowserMainParts::PreCreateThreadsImpl() {
#if !defined(OS_ANDROID)
// Create the RunLoop for MainMessageLoopRun() to use, and pass a copy of
// its QuitClosure to the BrowserProcessImpl to call when it is time to exit.
@@ -101,7 +101,7 @@ index fee4d5f1a8ca..2e4fb506d851 100644
// These members must be initialized before returning from this function.
// Android doesn't use StartupBrowserCreator.
@@ -1634,11 +1637,13 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() {
@@ -1635,11 +1638,13 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() {
// This step is costly and is already measured in
// Startup.StartupBrowserCreator_Start.
// See the comment above for an explanation of |process_command_line|.

View File

@@ -240,7 +240,7 @@ index 4bb04980b544..4e1e448a8bfc 100644
std::string /* mime_type */,
bool /* found */,
diff --git content/public/browser/content_browser_client.cc content/public/browser/content_browser_client.cc
index 4438e0417b3c..cdc59afa7f54 100644
index c84ae68f2f27..f90cdd146210 100644
--- content/public/browser/content_browser_client.cc
+++ content/public/browser/content_browser_client.cc
@@ -9,7 +9,7 @@
@@ -253,7 +253,7 @@ index 4438e0417b3c..cdc59afa7f54 100644
#include <utility>
diff --git content/public/browser/content_browser_client.h content/public/browser/content_browser_client.h
index df6e463d1518..68ab6d8748eb 100644
index c4fc708ab278..2c9f4e1f4dfe 100644
--- content/public/browser/content_browser_client.h
+++ content/public/browser/content_browser_client.h
@@ -32,6 +32,7 @@
@@ -264,7 +264,7 @@ index df6e463d1518..68ab6d8748eb 100644
#include "content/public/common/page_visibility_state.h"
#include "content/public/common/window_container_type.mojom-forward.h"
#include "device/vr/buildflags/buildflags.h"
@@ -1686,6 +1687,14 @@ class CONTENT_EXPORT ContentBrowserClient {
@@ -1714,6 +1715,14 @@ class CONTENT_EXPORT ContentBrowserClient {
const base::Optional<url::Origin>& initiating_origin,
mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory);
@@ -279,7 +279,7 @@ index df6e463d1518..68ab6d8748eb 100644
// Creates an OverlayWindow to be used for Picture-in-Picture. This window
// will house the content shown when in Picture-in-Picture mode. This will
// return a new OverlayWindow.
@@ -1757,6 +1766,10 @@ class CONTENT_EXPORT ContentBrowserClient {
@@ -1785,6 +1794,10 @@ class CONTENT_EXPORT ContentBrowserClient {
// Used as part of the user agent string.
virtual std::string GetProduct();
@@ -340,7 +340,7 @@ index a4695ba832fc..3eb41cb569b1 100644
// started.
virtual void SetRuntimeFeaturesDefaultsBeforeBlinkInitialization() {}
diff --git content/renderer/render_frame_impl.cc content/renderer/render_frame_impl.cc
index fcb99889673b..9d50aa58f325 100644
index d59a55cc4ec2..3a3e5b7336df 100644
--- content/renderer/render_frame_impl.cc
+++ content/renderer/render_frame_impl.cc
@@ -3639,7 +3639,8 @@ blink::WebPlugin* RenderFrameImpl::CreatePlugin(

View File

@@ -1,5 +1,5 @@
diff --git content/app/content_main.cc content/app/content_main.cc
index 2aba28d210db..5413f08af93d 100644
index 2aba28d210db..00edc202e2c4 100644
--- content/app/content_main.cc
+++ content/app/content_main.cc
@@ -205,15 +205,10 @@ void InitializeMojo(mojo::core::Configuration* config) {
@@ -20,17 +20,20 @@ index 2aba28d210db..5413f08af93d 100644
// A flag to indicate whether Main() has been called before. On Android, we
// may re-run Main() without restarting the browser process. This flag
@@ -299,8 +294,7 @@ int RunContentProcess(const ContentMainParams& params,
// loop, but we don't want to leave them hanging around until the app quits.
// Each "main" needs to flush this pool right before it goes into its main
// event loop to get rid of the cruft.
@@ -295,12 +290,6 @@ int RunContentProcess(const ContentMainParams& params,
#endif
#if defined(OS_MAC)
- // We need this pool for all the objects created before we get to the event
- // loop, but we don't want to leave them hanging around until the app quits.
- // Each "main" needs to flush this pool right before it goes into its main
- // event loop to get rid of the cruft.
- autorelease_pool = std::make_unique<base::mac::ScopedNSAutoreleasePool>();
- content_main_params.autorelease_pool = autorelease_pool.get();
+ params.autorelease_pool = std::make_unique<base::mac::ScopedNSAutoreleasePool>();
InitializeMac();
#endif
@@ -310,7 +304,7 @@ int RunContentProcess(const ContentMainParams& params,
@@ -310,7 +299,7 @@ int RunContentProcess(const ContentMainParams& params,
ui::RegisterPathProvider();
tracker = base::debug::GlobalActivityTracker::Get();
@@ -39,7 +42,7 @@ index 2aba28d210db..5413f08af93d 100644
if (exit_code >= 0) {
if (tracker) {
@@ -369,8 +363,16 @@ int RunContentProcess(const ContentMainParams& params,
@@ -369,8 +358,16 @@ int RunContentProcess(const ContentMainParams& params,
if (IsSubprocess())
CommonSubprocessInit();
@@ -57,7 +60,7 @@ index 2aba28d210db..5413f08af93d 100644
if (tracker) {
if (exit_code == 0) {
tracker->SetProcessPhaseIfEnabled(
@@ -381,19 +383,33 @@ int RunContentProcess(const ContentMainParams& params,
@@ -381,19 +378,45 @@ int RunContentProcess(const ContentMainParams& params,
tracker->process_data().SetInt("exit-code", exit_code);
}
}
@@ -67,24 +70,38 @@ index 2aba28d210db..5413f08af93d 100644
+void ContentMainShutdown(ContentMainParams& params,
+ ContentMainRunner* content_main_runner) {
#if defined(OS_MAC)
- autorelease_pool.reset();
+ params.autorelease_pool.reset();
#endif
#if !defined(OS_ANDROID)
content_main_runner->Shutdown();
#endif
+#if !defined(OS_ANDROID)
+ content_main_runner->Shutdown();
+#endif
+}
+
+int RunContentProcess(ContentMainParams& params,
+ ContentMainRunner* content_main_runner) {
#if defined(OS_MAC)
- autorelease_pool.reset();
+ // We need this pool for all the objects created before we get to the event
+ // loop, but we don't want to leave them hanging around until the app quits.
+ // Each "main" needs to flush this pool right before it goes into its main
+ // event loop to get rid of the cruft.
+ std::unique_ptr<base::mac::ScopedNSAutoreleasePool> autorelease_pool =
+ std::make_unique<base::mac::ScopedNSAutoreleasePool>();
+ params.autorelease_pool = autorelease_pool.get();
#endif
-#if !defined(OS_ANDROID)
- content_main_runner->Shutdown();
+ int exit_code = ContentMainInitialize(params, content_main_runner);
+ if (exit_code >= 0)
+ return exit_code;
+ exit_code = ContentMainRun(params, content_main_runner);
+ ContentMainShutdown(params, content_main_runner);
+
+#if defined(OS_MAC)
+ params.autorelease_pool = nullptr;
+ autorelease_pool.reset();
#endif
+ ContentMainShutdown(params, content_main_runner);
+
return exit_code;
}
@@ -94,7 +111,7 @@ index 2aba28d210db..5413f08af93d 100644
return RunContentProcess(params, runner.get());
}
diff --git content/app/content_main_runner_impl.cc content/app/content_main_runner_impl.cc
index 811017f5d455..00e4020dea17 100644
index 1f05e6351c58..cf0ef2f0a0bb 100644
--- content/app/content_main_runner_impl.cc
+++ content/app/content_main_runner_impl.cc
@@ -48,6 +48,7 @@
@@ -105,16 +122,7 @@ index 811017f5d455..00e4020dea17 100644
#include "base/trace_event/trace_event.h"
#include "components/discardable_memory/service/discardable_shared_memory_manager.h"
#include "components/download/public/common/download_task_runner.h"
@@ -629,7 +630,7 @@ int ContentMainRunnerImpl::Initialize(const ContentMainParams& params) {
#else // !OS_WIN
#if defined(OS_MAC)
- autorelease_pool_ = params.autorelease_pool;
+ autorelease_pool_ = params.autorelease_pool.get();
#endif // defined(OS_MAC)
#if defined(OS_ANDROID)
@@ -1089,6 +1090,11 @@ void ContentMainRunnerImpl::Shutdown() {
@@ -1098,6 +1099,11 @@ void ContentMainRunnerImpl::Shutdown() {
is_shutdown_ = true;
}
@@ -162,23 +170,10 @@ index 8b829a488773..a69a08869728 100644
if (main_argv)
setproctitle_init(main_argv);
diff --git content/public/app/content_main.h content/public/app/content_main.h
index 97aac3d0c758..4e7baa790252 100644
index 97aac3d0c758..fc795ae0287f 100644
--- content/public/app/content_main.h
+++ content/public/app/content_main.h
@@ -5,6 +5,7 @@
#ifndef CONTENT_PUBLIC_APP_CONTENT_MAIN_H_
#define CONTENT_PUBLIC_APP_CONTENT_MAIN_H_
+#include <memory>
#include <stddef.h>
#include "base/callback_forward.h"
@@ -64,11 +65,20 @@ struct ContentMainParams {
#if defined(OS_MAC)
// The outermost autorelease pool to pass to main entry points.
- base::mac::ScopedNSAutoreleasePool* autorelease_pool = nullptr;
+ std::unique_ptr<base::mac::ScopedNSAutoreleasePool> autorelease_pool;
@@ -68,7 +68,16 @@ struct ContentMainParams {
#endif
};
@@ -196,7 +191,7 @@ index 97aac3d0c758..4e7baa790252 100644
ContentMainRunner* content_main_runner);
#if defined(OS_ANDROID)
@@ -91,7 +101,7 @@ ContentMainDelegate* GetContentMainDelegate();
@@ -91,7 +100,7 @@ ContentMainDelegate* GetContentMainDelegate();
// initial setup for every process. The embedder has a chance to customize
// startup using the ContentMainDelegate interface. The embedder can also pass
// in null for |delegate| if they don't want to override default startup.

View File

@@ -127,7 +127,7 @@ index bcf172e645a2..f879aa745adf 100644
// on the given |command_line|.
void SetCrashKeysFromCommandLine(const base::CommandLine& command_line);
diff --git components/crash/core/app/breakpad_linux.cc components/crash/core/app/breakpad_linux.cc
index 9e850c0380b8..e06d0a26617a 100644
index 9e850c0380b8..559d93010edf 100644
--- components/crash/core/app/breakpad_linux.cc
+++ components/crash/core/app/breakpad_linux.cc
@@ -28,6 +28,7 @@
@@ -147,29 +147,37 @@ index 9e850c0380b8..e06d0a26617a 100644
info.process_start_time = g_process_start_time;
info.oom_size = base::g_oom_size;
info.pid = g_pid;
@@ -1733,10 +1734,19 @@ void HandleCrashDump(const BreakpadInfo& info) {
@@ -1733,10 +1734,27 @@ void HandleCrashDump(const BreakpadInfo& info) {
GetCrashReporterClient()->GetProductNameAndVersion(&product_name, &version);
writer.AddBoundary();
- writer.AddPairString("prod", product_name);
+ writer.AddPairString("product", product_name);
writer.AddBoundary();
- writer.AddPairString("ver", version);
+ writer.AddBoundary();
+ writer.AddPairString("version", version);
writer.AddBoundary();
- writer.AddPairString("ver", version);
+
+#if defined(ARCH_CPU_ARM_FAMILY)
+#if defined(ARCH_CPU_32_BITS)
+ const char* platform = "linuxarm";
+#elif defined(ARCH_CPU_64_BITS)
+ const char* platform = "linuxarm64";
+#endif
+#else
+#if defined(ARCH_CPU_32_BITS)
+ const char* platform = "linux32";
+#elif defined(ARCH_CPU_64_BITS)
+ const char* platform = "linux64";
+#endif
+#endif // defined(ARCH_CPU_ARM_FAMILY)
+ writer.AddPairString("platform", platform);
+ writer.AddBoundary();
writer.AddBoundary();
+
if (info.pid > 0) {
char pid_value_buf[kUint64StringSize];
uint64_t pid_value_len = my_uint64_len(info.pid);
@@ -1853,6 +1863,9 @@ void HandleCrashDump(const BreakpadInfo& info) {
@@ -1853,6 +1871,9 @@ void HandleCrashDump(const BreakpadInfo& info) {
crash_reporter::internal::TransitionalCrashKeyStorage;
CrashKeyStorage::Iterator crash_key_iterator(*info.crash_keys);
const CrashKeyStorage::Entry* entry;
@@ -179,7 +187,7 @@ index 9e850c0380b8..e06d0a26617a 100644
while ((entry = crash_key_iterator.Next())) {
size_t key_size, value_size;
// Check for malformed messages.
@@ -1863,7 +1876,13 @@ void HandleCrashDump(const BreakpadInfo& info) {
@@ -1863,7 +1884,13 @@ void HandleCrashDump(const BreakpadInfo& info) {
? CrashKeyStorage::value_size - 1
: my_strlen(entry->value);
@@ -363,7 +371,7 @@ index 64ca38330be7..4de20a66cd99 100644
->set_system_crash_reporter_forwarding(crashpad::TriState::kDisabled);
}
diff --git components/crash/core/app/crashpad_mac.mm components/crash/core/app/crashpad_mac.mm
index eb675321436a..4e74af742ed5 100644
index eb675321436a..9f95323b9b35 100644
--- components/crash/core/app/crashpad_mac.mm
+++ components/crash/core/app/crashpad_mac.mm
@@ -16,12 +16,15 @@
@@ -412,7 +420,7 @@ index eb675321436a..4e74af742ed5 100644
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
// Empty means stable.
@@ -68,12 +81,16 @@ std::map<std::string, std::string> GetProcessSimpleAnnotations() {
@@ -68,12 +81,20 @@ std::map<std::string, std::string> GetProcessSimpleAnnotations() {
process_annotations["channel"] = base::SysNSStringToUTF8(channel);
}
@@ -430,11 +438,15 @@ index eb675321436a..4e74af742ed5 100644
+ }
- process_annotations["plat"] = std::string("OS X");
+#if defined(ARCH_CPU_ARM64)
+ process_annotations["platform"] = std::string("macosarm64");
+#else
+ process_annotations["platform"] = std::string("macos");
+#endif
} // @autoreleasepool
return process_annotations;
}();
@@ -133,10 +150,10 @@ base::FilePath PlatformCrashpadInitialization(
@@ -133,10 +154,10 @@ base::FilePath PlatformCrashpadInitialization(
if (initial_client) {
@autoreleasepool {
@@ -449,7 +461,7 @@ index eb675321436a..4e74af742ed5 100644
// Is there a way to recover if this fails?
CrashReporterClient* crash_reporter_client = GetCrashReporterClient();
@@ -165,6 +182,12 @@ base::FilePath PlatformCrashpadInitialization(
@@ -165,6 +186,12 @@ base::FilePath PlatformCrashpadInitialization(
"--reset-own-crash-exception-port-to-system-default");
}
@@ -463,7 +475,7 @@ index eb675321436a..4e74af742ed5 100644
handler_path, database_path, metrics_path, url,
GetProcessSimpleAnnotations(), arguments, true, false);
diff --git components/crash/core/app/crashpad_win.cc components/crash/core/app/crashpad_win.cc
index c199b467ffeb..1037a285b74c 100644
index c199b467ffeb..86ff89513534 100644
--- components/crash/core/app/crashpad_win.cc
+++ components/crash/core/app/crashpad_win.cc
@@ -36,8 +36,8 @@ void GetPlatformCrashpadAnnotations(
@@ -477,7 +489,7 @@ index c199b467ffeb..1037a285b74c 100644
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
// Empty means stable.
const bool allow_empty_channel = true;
@@ -49,9 +49,9 @@ void GetPlatformCrashpadAnnotations(
@@ -49,9 +49,11 @@ void GetPlatformCrashpadAnnotations(
if (!special_build.empty())
(*annotations)["special"] = base::UTF16ToUTF8(special_build);
#if defined(ARCH_CPU_X86)
@@ -486,10 +498,12 @@ index c199b467ffeb..1037a285b74c 100644
#elif defined(ARCH_CPU_X86_64)
- (*annotations)["plat"] = std::string("Win64");
+ (*annotations)["platform"] = std::string("win64");
+#elif defined(ARCH_CPU_ARM64)
+ (*annotations)["platform"] = std::string("winarm64");
#endif
}
@@ -66,7 +66,9 @@ base::FilePath PlatformCrashpadInitialization(
@@ -66,7 +68,9 @@ base::FilePath PlatformCrashpadInitialization(
base::FilePath metrics_path; // Only valid in the browser process.
const char kPipeNameVar[] = "CHROME_CRASHPAD_PIPE_NAME";
@@ -499,7 +513,7 @@ index c199b467ffeb..1037a285b74c 100644
std::unique_ptr<base::Environment> env(base::Environment::Create());
CrashReporterClient* crash_reporter_client = GetCrashReporterClient();
@@ -87,9 +89,11 @@ base::FilePath PlatformCrashpadInitialization(
@@ -87,9 +91,11 @@ base::FilePath PlatformCrashpadInitialization(
std::string url = crash_reporter_client->GetUploadUrl();
@@ -511,7 +525,7 @@ index c199b467ffeb..1037a285b74c 100644
base::FilePath exe_file(exe_path);
if (exe_file.empty()) {
@@ -100,13 +104,14 @@ base::FilePath PlatformCrashpadInitialization(
@@ -100,13 +106,14 @@ base::FilePath PlatformCrashpadInitialization(
exe_file = base::FilePath(exe_file_path);
}
@@ -531,7 +545,7 @@ index c199b467ffeb..1037a285b74c 100644
if (!user_data_dir.empty()) {
start_arguments.push_back(std::string("--user-data-dir=") +
user_data_dir);
@@ -117,9 +122,12 @@ base::FilePath PlatformCrashpadInitialization(
@@ -117,9 +124,12 @@ base::FilePath PlatformCrashpadInitialization(
start_arguments.push_back("/prefetch:7");
} else {
base::FilePath exe_dir = exe_file.DirName();

View File

@@ -58,7 +58,7 @@ index 97cae92b96fa..6acf5188e1d6 100644
// Add an entry to the map.
preview_dialog_map_[preview_dialog] = initiator;
diff --git chrome/browser/printing/print_view_manager_base.cc chrome/browser/printing/print_view_manager_base.cc
index ae1ab34986d1..b742e9fffaf3 100644
index 83849c57ba42..d53d82a72a3a 100644
--- chrome/browser/printing/print_view_manager_base.cc
+++ chrome/browser/printing/print_view_manager_base.cc
@@ -22,6 +22,7 @@
@@ -341,7 +341,7 @@ index 67aa6bc0d76e..0fecbd87423b 100644
void PrintPreviewHandler::UnregisterForGaiaCookieChanges() {
diff --git chrome/browser/ui/webui/print_preview/print_preview_ui.cc chrome/browser/ui/webui/print_preview/print_preview_ui.cc
index fb3328d0d75b..4dd94d59e195 100644
index 43259fb9d86d..c8c2f7e5a107 100644
--- chrome/browser/ui/webui/print_preview/print_preview_ui.cc
+++ chrome/browser/ui/webui/print_preview/print_preview_ui.cc
@@ -29,6 +29,7 @@

View File

@@ -1,5 +1,5 @@
diff --git content/browser/renderer_host/render_widget_host_view_aura.cc content/browser/renderer_host/render_widget_host_view_aura.cc
index dd16ddb90fa9..1d70818d0eff 100644
index 33122769e7c4..e0693d4aa14e 100644
--- content/browser/renderer_host/render_widget_host_view_aura.cc
+++ content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -657,10 +657,12 @@ gfx::Rect RenderWidgetHostViewAura::GetViewBounds() {
@@ -19,7 +19,7 @@ index dd16ddb90fa9..1d70818d0eff 100644
}
base::Optional<DisplayFeature> RenderWidgetHostViewAura::GetDisplayFeature() {
@@ -2020,6 +2022,16 @@ void RenderWidgetHostViewAura::CreateAuraWindow(aura::client::WindowType type) {
@@ -2005,6 +2007,16 @@ void RenderWidgetHostViewAura::CreateAuraWindow(aura::client::WindowType type) {
// This needs to happen only after |window_| has been initialized using
// Init(), because it needs to have the layer.
window_->SetEmbedFrameSinkId(frame_sink_id_);

View File

@@ -123,10 +123,10 @@ index f91ffe61dba5..f3482e68cd11 100644
void CookieManager::SetForceKeepSessionState() {
diff --git services/network/network_context.cc services/network/network_context.cc
index a75980730046..a0c104d88545 100644
index db667e13f2e4..56016c1c0e5d 100644
--- services/network/network_context.cc
+++ services/network/network_context.cc
@@ -2014,16 +2014,27 @@ URLRequestContextOwner NetworkContext::MakeURLRequestContext(
@@ -2015,16 +2015,27 @@ URLRequestContextOwner NetworkContext::MakeURLRequestContext(
network_service_->network_quality_estimator());
}
@@ -157,7 +157,7 @@ index a75980730046..a0c104d88545 100644
trust_token_store_ = std::make_unique<PendingTrustTokenStore>();
diff --git services/network/public/mojom/network_context.mojom services/network/public/mojom/network_context.mojom
index 294b04445bd3..f1f81e44986f 100644
index 8ac73cae1530..0574e447272e 100644
--- services/network/public/mojom/network_context.mojom
+++ services/network/public/mojom/network_context.mojom
@@ -288,6 +288,9 @@ struct NetworkContextParams {

View File

@@ -1,5 +1,5 @@
diff --git content/browser/storage_partition_impl.cc content/browser/storage_partition_impl.cc
index 46fd3da02453..879e7a0b2275 100644
index c28ce91036fb..d3e5f22a570d 100644
--- content/browser/storage_partition_impl.cc
+++ content/browser/storage_partition_impl.cc
@@ -495,10 +495,6 @@ class LoginHandlerDelegate {
@@ -26,7 +26,7 @@ index 46fd3da02453..879e7a0b2275 100644
new LoginHandlerDelegate(std::move(auth_challenge_responder),
std::move(web_contents_getter), auth_info,
is_request_for_main_frame, process_id, routing_id,
@@ -2449,8 +2439,12 @@ void StoragePartitionImpl::GetQuotaSettings(
@@ -2451,8 +2441,12 @@ void StoragePartitionImpl::GetQuotaSettings(
return;
}
@@ -40,7 +40,7 @@ index 46fd3da02453..879e7a0b2275 100644
storage::GetDefaultDeviceInfoHelper(), std::move(callback));
}
@@ -2462,6 +2456,11 @@ void StoragePartitionImpl::InitNetworkContext() {
@@ -2464,6 +2458,11 @@ void StoragePartitionImpl::InitNetworkContext() {
GetContentClient()->browser()->ConfigureNetworkContextParams(
browser_context_, is_in_memory_, relative_partition_path_,
context_params.get(), cert_verifier_creation_params.get());

View File

@@ -238,10 +238,10 @@ index 2426029d6733..d12bc4568203 100644
std::unique_ptr<SelectionController> selection_controller_;
diff --git ui/views/controls/menu/menu_controller.cc ui/views/controls/menu/menu_controller.cc
index 15d30255e990..745b483213cf 100644
index 867971462753..da96feb22859 100644
--- ui/views/controls/menu/menu_controller.cc
+++ ui/views/controls/menu/menu_controller.cc
@@ -2744,8 +2744,13 @@ MenuItemView* MenuController::FindNextSelectableMenuItem(
@@ -2736,8 +2736,13 @@ MenuItemView* MenuController::FindNextSelectableMenuItem(
void MenuController::OpenSubmenuChangeSelectionIfCan() {
MenuItemView* item = pending_state_.item;
@@ -256,7 +256,7 @@ index 15d30255e990..745b483213cf 100644
MenuItemView* to_select = nullptr;
if (!item->GetSubmenu()->GetMenuItems().empty())
to_select = FindInitialSelectableMenuItem(item, INCREMENT_SELECTION_DOWN);
@@ -2764,8 +2769,10 @@ void MenuController::OpenSubmenuChangeSelectionIfCan() {
@@ -2756,8 +2761,10 @@ void MenuController::OpenSubmenuChangeSelectionIfCan() {
void MenuController::CloseSubmenu() {
MenuItemView* item = state_.item;
DCHECK(item);

View File

@@ -359,10 +359,10 @@ index 52c1d1eb59c4..ebcbd0286a7b 100644
}
diff --git ui/views/widget/widget.h ui/views/widget/widget.h
index 819ea9ae89cc..1cae5eda3d5f 100644
index 07e66170f483..dc9d58a76dd8 100644
--- ui/views/widget/widget.h
+++ ui/views/widget/widget.h
@@ -318,6 +318,8 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate,
@@ -317,6 +317,8 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate,
// the concept with bubble anchoring a la BubbleDialogDelegateView.
gfx::NativeView parent = nullptr;

View File

@@ -80,7 +80,7 @@ index 1026b739d283..fe562ab60ce9 100644
private:
const HWND hwnd_;
diff --git components/viz/service/BUILD.gn components/viz/service/BUILD.gn
index c66d791c7c9a..5c98ae02d8b7 100644
index 0f6a5a2fa3d8..5365d4015e7e 100644
--- components/viz/service/BUILD.gn
+++ components/viz/service/BUILD.gn
@@ -180,6 +180,8 @@ viz_component("service") {

View File

@@ -1,5 +1,5 @@
diff --git content/browser/web_contents/web_contents_impl.cc content/browser/web_contents/web_contents_impl.cc
index 496c36479799..ecbf2d55fe89 100644
index f4751d821d34..4391c192fa8c 100644
--- content/browser/web_contents/web_contents_impl.cc
+++ content/browser/web_contents/web_contents_impl.cc
@@ -2724,7 +2724,13 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) {

View File

@@ -44,10 +44,10 @@ index 570678bc648c..42d979f2a496 100644
DocumentInit& DocumentInit::WithTypeFrom(const String& mime_type) {
diff --git third_party/blink/renderer/core/frame/local_frame.cc third_party/blink/renderer/core/frame/local_frame.cc
index aa8952f06c9d..1fed8c0efe80 100644
index 4ceaa30497d2..632f57d63592 100644
--- third_party/blink/renderer/core/frame/local_frame.cc
+++ third_party/blink/renderer/core/frame/local_frame.cc
@@ -1811,7 +1811,7 @@ WebContentSettingsClient* LocalFrame::GetContentSettingsClient() {
@@ -1866,7 +1866,7 @@ WebContentSettingsClient* LocalFrame::GetContentSettingsClient() {
PluginData* LocalFrame::GetPluginData() const {
if (!Loader().AllowPlugins())
return nullptr;

View File

@@ -77,7 +77,7 @@ index fb648cda4e1a..15bb56c8ae4f 100644
// Cancels and hides the current popup (datetime, select...) if any.
virtual void CancelPagePopup() = 0;
diff --git third_party/blink/renderer/core/exported/web_view_impl.cc third_party/blink/renderer/core/exported/web_view_impl.cc
index 68688f094a68..9eaabb3431e2 100644
index 065393eeee18..543b645dd380 100644
--- third_party/blink/renderer/core/exported/web_view_impl.cc
+++ third_party/blink/renderer/core/exported/web_view_impl.cc
@@ -238,8 +238,13 @@ void WebView::SetUseExternalPopupMenus(bool use_external_popup_menus) {

View File

@@ -1,5 +1,5 @@
diff --git chrome/app/generated_resources.grd chrome/app/generated_resources.grd
index 3a1f50cb713c..e915ab4ee03a 100644
index 3173fac28aa8..299722517a42 100644
--- chrome/app/generated_resources.grd
+++ chrome/app/generated_resources.grd
@@ -5083,7 +5083,7 @@ Keep your key file in a safe place. You will need it to create new versions of y

View File

@@ -1089,7 +1089,6 @@ void BrowserWindowOsrGtk::SetBounds(int x, int y, size_t width, size_t height) {
void BrowserWindowOsrGtk::SetFocus(bool focus) {
REQUIRE_MAIN_THREAD();
ScopedGdkThreadsEnter scoped_gdk_threads;
if (glarea_ && focus) {
gtk_widget_grab_focus(glarea_);
}
@@ -1314,11 +1313,11 @@ bool BrowserWindowOsrGtk::StartDragging(
return false;
}
ScopedGdkThreadsEnter scoped_gdk_threads;
DragReset();
drag_data_ = drag_data;
ScopedGdkThreadsEnter scoped_gdk_threads;
// Begin drag.
if (drag_trigger_event_) {
LOG(ERROR) << "Dragging started, but last mouse event is missing";
@@ -1433,7 +1432,7 @@ void BrowserWindowOsrGtk::Create(ClientWindowHandle parent_handle) {
gint BrowserWindowOsrGtk::SizeAllocation(GtkWidget* widget,
GtkAllocation* allocation,
BrowserWindowOsrGtk* self) {
CEF_REQUIRE_UI_THREAD();
REQUIRE_MAIN_THREAD();
if (self->browser_.get()) {
// Results in a call to GetViewRect().
self->browser_->GetHost()->WasResized();
@@ -1445,7 +1444,7 @@ gint BrowserWindowOsrGtk::SizeAllocation(GtkWidget* widget,
gint BrowserWindowOsrGtk::ClickEvent(GtkWidget* widget,
GdkEventButton* event,
BrowserWindowOsrGtk* self) {
CEF_REQUIRE_UI_THREAD();
REQUIRE_MAIN_THREAD();
if (!self->browser_.get())
return TRUE;
@@ -1515,7 +1514,7 @@ gint BrowserWindowOsrGtk::ClickEvent(GtkWidget* widget,
gint BrowserWindowOsrGtk::KeyEvent(GtkWidget* widget,
GdkEventKey* event,
BrowserWindowOsrGtk* self) {
CEF_REQUIRE_UI_THREAD();
REQUIRE_MAIN_THREAD();
if (!self->browser_.get())
return TRUE;
@@ -1571,8 +1570,6 @@ gint BrowserWindowOsrGtk::KeyEvent(GtkWidget* widget,
gint BrowserWindowOsrGtk::MoveEvent(GtkWidget* widget,
GdkEventMotion* event,
BrowserWindowOsrGtk* self) {
CEF_REQUIRE_UI_THREAD();
if (!self->browser_.get())
return TRUE;
@@ -1628,7 +1625,7 @@ gint BrowserWindowOsrGtk::MoveEvent(GtkWidget* widget,
gint BrowserWindowOsrGtk::ScrollEvent(GtkWidget* widget,
GdkEventScroll* event,
BrowserWindowOsrGtk* self) {
CEF_REQUIRE_UI_THREAD();
REQUIRE_MAIN_THREAD();
if (!self->browser_.get())
return TRUE;
@@ -1889,7 +1886,6 @@ void BrowserWindowOsrGtk::RegisterDragDrop() {
}
void BrowserWindowOsrGtk::UnregisterDragDrop() {
CEF_REQUIRE_UI_THREAD();
ScopedGdkThreadsEnter scoped_gdk_threads;
gtk_drag_dest_unset(glarea_);
// Drag events are unregistered in OnBeforeClose by calling
@@ -1897,7 +1893,6 @@ void BrowserWindowOsrGtk::UnregisterDragDrop() {
}
void BrowserWindowOsrGtk::DragReset() {
CEF_REQUIRE_UI_THREAD();
if (drag_trigger_event_) {
gdk_event_free(drag_trigger_event_);
drag_trigger_event_ = nullptr;
@@ -1916,8 +1911,6 @@ void BrowserWindowOsrGtk::DragReset() {
void BrowserWindowOsrGtk::DragBegin(GtkWidget* widget,
GdkDragContext* drag_context,
BrowserWindowOsrGtk* self) {
CEF_REQUIRE_UI_THREAD();
// Load drag icon.
if (!self->drag_data_->HasImage()) {
LOG(ERROR) << "Failed to set drag icon, drag image not available";
@@ -1940,6 +1933,8 @@ void BrowserWindowOsrGtk::DragBegin(GtkWidget* widget,
return;
}
ScopedGdkThreadsEnter scoped_gdk_threads;
size_t image_size = image_binary->GetSize();
guint8* image_buffer = (guint8*)malloc(image_size); // must free
image_binary->GetData((void*)image_buffer, image_size, 0);
@@ -1987,7 +1982,7 @@ void BrowserWindowOsrGtk::DragDataGet(GtkWidget* widget,
guint info,
guint time,
BrowserWindowOsrGtk* self) {
CEF_REQUIRE_UI_THREAD();
REQUIRE_MAIN_THREAD();
// No drag targets are set so this callback is never called.
}
@@ -1995,7 +1990,7 @@ void BrowserWindowOsrGtk::DragDataGet(GtkWidget* widget,
void BrowserWindowOsrGtk::DragEnd(GtkWidget* widget,
GdkDragContext* drag_context,
BrowserWindowOsrGtk* self) {
CEF_REQUIRE_UI_THREAD();
REQUIRE_MAIN_THREAD();
if (self->browser_) {
// Sometimes there is DragEnd event generated without prior DragDrop.
@@ -2018,7 +2013,7 @@ gboolean BrowserWindowOsrGtk::DragMotion(GtkWidget* widget,
gint y,
guint time,
BrowserWindowOsrGtk* self) {
CEF_REQUIRE_UI_THREAD();
REQUIRE_MAIN_THREAD();
float device_scale_factor;
{
@@ -2078,7 +2073,7 @@ void BrowserWindowOsrGtk::DragLeave(GtkWidget* widget,
GdkDragContext* drag_context,
guint time,
BrowserWindowOsrGtk* self) {
CEF_REQUIRE_UI_THREAD();
REQUIRE_MAIN_THREAD();
// There is no drag-enter event in GTK. The first drag-motion event
// after drag-leave will be a drag-enter event.
@@ -2100,7 +2095,7 @@ gboolean BrowserWindowOsrGtk::DragFailed(GtkWidget* widget,
GdkDragContext* drag_context,
GtkDragResult result,
BrowserWindowOsrGtk* self) {
CEF_REQUIRE_UI_THREAD();
REQUIRE_MAIN_THREAD();
// Send drag end coordinates and system drag ended event.
if (self->browser_) {
@@ -2120,7 +2115,7 @@ gboolean BrowserWindowOsrGtk::DragDrop(GtkWidget* widget,
gint y,
guint time,
BrowserWindowOsrGtk* self) {
CEF_REQUIRE_UI_THREAD();
REQUIRE_MAIN_THREAD();
// Finish GTK drag.
gtk_drag_finish(drag_context, TRUE, FALSE, time);
@@ -2164,7 +2159,7 @@ void BrowserWindowOsrGtk::DragDataReceived(GtkWidget* widget,
guint info,
guint time,
BrowserWindowOsrGtk* self) {
CEF_REQUIRE_UI_THREAD();
REQUIRE_MAIN_THREAD();
// This callback is never called because DragDrop does not call
// gtk_drag_get_data, as only dragging inside web view is supported.
}

View File

@@ -143,10 +143,6 @@ GtkWindow* GetWindow(CefRefPtr<CefBrowser> browser) {
return nullptr;
}
void RunCallback(base::Callback<void(GtkWindow*)> callback, GtkWindow* window) {
callback.Run(window);
}
} // namespace
ClientDialogHandlerGtk::ClientDialogHandlerGtk() : gtk_dialog_(nullptr) {}
@@ -227,7 +223,7 @@ void ClientDialogHandlerGtk::OnResetDialogState(CefRefPtr<CefBrowser> browser) {
void ClientDialogHandlerGtk::OnFileDialogContinue(OnFileDialogParams params,
GtkWindow* window) {
CEF_REQUIRE_UI_THREAD();
REQUIRE_MAIN_THREAD();
ScopedGdkThreadsEnter scoped_gdk_threads;
@@ -367,7 +363,7 @@ void ClientDialogHandlerGtk::OnFileDialogContinue(OnFileDialogParams params,
void ClientDialogHandlerGtk::OnJSDialogContinue(OnJSDialogParams params,
GtkWindow* window) {
CEF_REQUIRE_UI_THREAD();
REQUIRE_MAIN_THREAD();
ScopedGdkThreadsEnter scoped_gdk_threads;
@@ -443,7 +439,7 @@ void ClientDialogHandlerGtk::GetWindowAndContinue(
GtkWindow* window = GetWindow(browser);
if (window) {
CefPostTask(TID_UI, base::Bind(RunCallback, callback, window));
callback.Run(window);
}
}
@@ -451,7 +447,7 @@ void ClientDialogHandlerGtk::GetWindowAndContinue(
void ClientDialogHandlerGtk::OnDialogResponse(GtkDialog* dialog,
gint response_id,
ClientDialogHandlerGtk* handler) {
CEF_REQUIRE_UI_THREAD();
REQUIRE_MAIN_THREAD();
DCHECK_EQ(dialog, GTK_DIALOG(handler->gtk_dialog_));
switch (response_id) {
@@ -466,7 +462,8 @@ void ClientDialogHandlerGtk::OnDialogResponse(GtkDialog* dialog,
NOTREACHED();
}
handler->OnResetDialogState(nullptr);
CefPostTask(TID_UI, base::Bind(&ClientDialogHandlerGtk::OnResetDialogState,
handler, nullptr));
}
} // namespace client

View File

@@ -78,10 +78,9 @@ MainMessageLoopMultithreadedGtk::~MainMessageLoopMultithreadedGtk() {
int MainMessageLoopMultithreadedGtk::Run() {
DCHECK(RunsTasksOnCurrentThread());
// Chromium uses the default GLib context so we create our own context and
// make it the default for this thread.
main_context_ = g_main_context_new();
g_main_context_push_thread_default(main_context_);
// We use the default Glib context and Chromium creates its own context in
// MessagePumpGlib (starting in M86).
main_context_ = g_main_context_default();
main_loop_ = g_main_loop_new(main_context_, TRUE);
@@ -100,8 +99,6 @@ int MainMessageLoopMultithreadedGtk::Run() {
g_main_loop_unref(main_loop_);
main_loop_ = nullptr;
g_main_context_pop_thread_default(main_context_);
g_main_context_unref(main_context_);
main_context_ = nullptr;
return 0;

View File

@@ -94,13 +94,9 @@ void RootWindowGtk::Init(RootWindow::Delegate* delegate,
initialized_ = true;
// Create the native root window on the main thread.
if (CURRENTLY_ON_MAIN_THREAD()) {
CreateRootWindow(settings, config.initially_hidden);
} else {
MAIN_POST_CLOSURE(base::Bind(&RootWindowGtk::CreateRootWindow, this,
settings, config.initially_hidden));
}
// Always post asynchronously to avoid reentrancy of the GDK lock.
MAIN_POST_CLOSURE(base::Bind(&RootWindowGtk::CreateRootWindow, this, settings,
config.initially_hidden));
}
void RootWindowGtk::InitAsPopup(RootWindow::Delegate* delegate,
@@ -682,7 +678,7 @@ void RootWindowGtk::NotifyDestroyedIfDone(bool window_destroyed,
gboolean RootWindowGtk::WindowFocusIn(GtkWidget* widget,
GdkEventFocus* event,
RootWindowGtk* self) {
CEF_REQUIRE_UI_THREAD();
REQUIRE_MAIN_THREAD();
if (event->in) {
self->NotifySetFocus();
@@ -698,7 +694,7 @@ gboolean RootWindowGtk::WindowFocusIn(GtkWidget* widget,
gboolean RootWindowGtk::WindowState(GtkWidget* widget,
GdkEventWindowState* event,
RootWindowGtk* self) {
CEF_REQUIRE_UI_THREAD();
REQUIRE_MAIN_THREAD();
// Called when the root window is iconified or restored. Hide the browser
// window when the root window is iconified to reduce resource usage.
@@ -714,7 +710,7 @@ gboolean RootWindowGtk::WindowState(GtkWidget* widget,
gboolean RootWindowGtk::WindowConfigure(GtkWindow* window,
GdkEvent* event,
RootWindowGtk* self) {
CEF_REQUIRE_UI_THREAD();
REQUIRE_MAIN_THREAD();
self->NotifyMoveOrResizeStarted();
return FALSE; // Don't stop this message.
}
@@ -729,7 +725,7 @@ void RootWindowGtk::WindowDestroy(GtkWidget* widget, RootWindowGtk* self) {
gboolean RootWindowGtk::WindowDelete(GtkWidget* widget,
GdkEvent* event,
RootWindowGtk* self) {
CEF_REQUIRE_UI_THREAD();
REQUIRE_MAIN_THREAD();
// Called to query whether the root window should be closed.
if (self->force_close_)
@@ -769,7 +765,7 @@ void RootWindowGtk::MenubarSizeAllocated(GtkWidget* widget,
// static
gboolean RootWindowGtk::MenuItemActivated(GtkWidget* widget,
RootWindowGtk* self) {
CEF_REQUIRE_UI_THREAD();
REQUIRE_MAIN_THREAD();
// Retrieve the menu ID set in AddMenuEntry.
int id = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), kMenuIdKey));
@@ -787,33 +783,33 @@ void RootWindowGtk::ToolbarSizeAllocated(GtkWidget* widget,
// static
void RootWindowGtk::BackButtonClicked(GtkButton* button, RootWindowGtk* self) {
CEF_REQUIRE_UI_THREAD();
REQUIRE_MAIN_THREAD();
self->NotifyButtonClicked(IDC_NAV_BACK);
}
// static
void RootWindowGtk::ForwardButtonClicked(GtkButton* button,
RootWindowGtk* self) {
CEF_REQUIRE_UI_THREAD();
REQUIRE_MAIN_THREAD();
self->NotifyButtonClicked(IDC_NAV_FORWARD);
}
// static
void RootWindowGtk::StopButtonClicked(GtkButton* button, RootWindowGtk* self) {
CEF_REQUIRE_UI_THREAD();
REQUIRE_MAIN_THREAD();
self->NotifyButtonClicked(IDC_NAV_STOP);
}
// static
void RootWindowGtk::ReloadButtonClicked(GtkButton* button,
RootWindowGtk* self) {
CEF_REQUIRE_UI_THREAD();
REQUIRE_MAIN_THREAD();
self->NotifyButtonClicked(IDC_NAV_RELOAD);
}
// static
void RootWindowGtk::URLEntryActivate(GtkEntry* entry, RootWindowGtk* self) {
CEF_REQUIRE_UI_THREAD();
REQUIRE_MAIN_THREAD();
const gchar* url = gtk_entry_get_text(entry);
self->NotifyLoadURL(std::string(url));
}
@@ -822,7 +818,7 @@ void RootWindowGtk::URLEntryActivate(GtkEntry* entry, RootWindowGtk* self) {
gboolean RootWindowGtk::URLEntryButtonPress(GtkWidget* widget,
GdkEventButton* event,
RootWindowGtk* self) {
CEF_REQUIRE_UI_THREAD();
REQUIRE_MAIN_THREAD();
// Give focus to the GTK window. This is a work-around for bad focus-related
// interaction between the root window managed by GTK and the browser managed

View File

@@ -547,43 +547,32 @@ class V8RendererTest : public ClientAppRenderer::Delegate,
bool destructorCalled = false;
bool releaseBufferCalled = false;
bool neuteredDestructorCalled = false;
bool neuteredReleaseBufferCalled = false;
// Enter the V8 context.
EXPECT_TRUE(context->Enter());
{
int static_data[16];
CefRefPtr<CefV8Value> value;
CefRefPtr<TestArrayBufferReleaseCallback> release_callback =
new TestArrayBufferReleaseCallback(&destructorCalled,
&releaseBufferCalled);
CefRefPtr<CefV8Value> neuteredValue;
CefRefPtr<TestArrayBufferReleaseCallback> neuteredReleaseCallback =
new TestArrayBufferReleaseCallback(&neuteredDestructorCalled,
&neuteredReleaseBufferCalled);
value = CefV8Value::CreateArrayBuffer(static_data, sizeof(static_data),
release_callback);
neuteredValue = CefV8Value::CreateArrayBuffer(
static_data, sizeof(static_data), neuteredReleaseCallback);
CefRefPtr<CefV8Value> value = CefV8Value::CreateArrayBuffer(
static_data, sizeof(static_data), release_callback);
EXPECT_TRUE(value.get());
EXPECT_TRUE(value->IsArrayBuffer());
EXPECT_TRUE(value->IsObject());
EXPECT_FALSE(value->HasValue(0));
EXPECT_FALSE(destructorCalled);
EXPECT_TRUE(value->GetArrayBufferReleaseCallback().get() != nullptr);
EXPECT_TRUE(((TestArrayBufferReleaseCallback*)value
->GetArrayBufferReleaseCallback()
.get()) == release_callback);
EXPECT_TRUE(neuteredValue->NeuterArrayBuffer());
// |Value| buffer is explicitly freed by NeuterArrayBuffer().
EXPECT_FALSE(destructorCalled);
EXPECT_FALSE(releaseBufferCalled);
EXPECT_TRUE(value->NeuterArrayBuffer());
EXPECT_TRUE(releaseBufferCalled);
}
// Exit the V8 context.
EXPECT_TRUE(destructorCalled);
EXPECT_TRUE(releaseBufferCalled);
EXPECT_TRUE(neuteredDestructorCalled);
EXPECT_FALSE(neuteredReleaseBufferCalled);
EXPECT_TRUE(context->Exit());
DestroyTest();
}