Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
… into master.lion
  • Loading branch information
bluebox authored and bluebox committed Sep 1, 2020
2 parents dd3a7dc + 83dffc5 commit a23c771
Show file tree
Hide file tree
Showing 278 changed files with 4,531 additions and 2,346 deletions.
12 changes: 6 additions & 6 deletions DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ vars = {
# Three lines of non-changing comments so that
# the commit queue can handle CLs rolling ANGLE
# and whatever else without interference from each other.
'angle_revision': 'c0dda02196e838fcfbd265c7063014d86d1c2564',
'angle_revision': 'c21fdb07d60c31e961751cf701a554a1589ce9df',
# Three lines of non-changing comments so that
# the commit queue can handle CLs rolling SwiftShader
# and whatever else without interference from each other.
Expand Down Expand Up @@ -266,7 +266,7 @@ vars = {
# Three lines of non-changing comments so that
# the commit queue can handle CLs rolling devtools-frontend
# and whatever else without interference from each other.
'devtools_frontend_revision': 'af609dca0136150dcafa435e0d544f0322efe25f',
'devtools_frontend_revision': '4977f960c9501f759e6ebca337be1836cdd6a749',
# Three lines of non-changing comments so that
# the commit queue can handle CLs rolling libprotobuf-mutator
# and whatever else without interference from each other.
Expand Down Expand Up @@ -302,7 +302,7 @@ vars = {
# Three lines of non-changing comments so that
# the commit queue can handle CLs rolling feed
# and whatever else without interference from each other.
'spv_tools_revision': 'f428aa39ca2b18061c85abba1ed5a244b09fc411',
'spv_tools_revision': '8a0ebd40f86d1f18ad42ea96c6ac53915076c3c7',
# Three lines of non-changing comments so that
# the commit queue can handle CLs rolling feed
# and whatever else without interference from each other.
Expand All @@ -318,7 +318,7 @@ vars = {
# Three lines of non-changing comments so that
# the commit queue can handle CLs rolling feed
# and whatever else without interference from each other.
'dawn_revision': '0b89b27263b127a46371641b299fdf0f2cd7caff',
'dawn_revision': '1c4a7f780f10ba4ebd1718b08d4d986aaa344c66',
# Three lines of non-changing comments so that
# the commit queue can handle CLs rolling feed
# and whatever else without interference from each other.
Expand Down Expand Up @@ -1249,7 +1249,7 @@ deps = {
},

'src/third_party/perfetto':
Var('android_git') + '/platform/external/perfetto.git' + '@' + '19157ee4a2fd54a2cf183060f230835982fd6467',
Var('android_git') + '/platform/external/perfetto.git' + '@' + '64e4b1e8e2e8a178818a00269de1e354f1028ecd',

'src/third_party/perl': {
'url': Var('chromium_git') + '/chromium/deps/perl.git' + '@' + '6f3e5028eb65d0b4c5fdd792106ac4c84eee1eb3',
Expand Down Expand Up @@ -1543,7 +1543,7 @@ deps = {
Var('chromium_git') + '/v8/v8.git' + '@' + Var('v8_revision'),

'src-internal': {
'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@1a42d4b381835dc816d7d0d12cd99f553987a9cf',
'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@d397f7662abb127dc16e3dc74c0bfbd8cac84d01',
'condition': 'checkout_src_internal',
},

Expand Down
1 change: 0 additions & 1 deletion PRESUBMIT.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,6 @@
'^chromecast/media/',
'^chromeos/attestation/',
'^chromeos/components/',
'^chromeos/services/',
'^components/arc/',
'^components/autofill/',
'^components/autofill_assistant/',
Expand Down
20 changes: 16 additions & 4 deletions base/synchronization/lock_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,26 @@
#endif

namespace base {
class Lock;
class ConditionVariable;

namespace win {
namespace internal {
class AutoNativeLock;
class ScopedHandleVerifier;
} // namespace internal
} // namespace win

namespace internal {

// This class implements the underlying platform-specific spin-lock mechanism
// used for the Lock class. Most users should not use LockImpl directly, but
// should instead use Lock.
// used for the Lock class. Do not use, use Lock instead.
class BASE_EXPORT LockImpl {
public:
friend class base::Lock;
friend class base::ConditionVariable;
friend class base::win::internal::AutoNativeLock;
friend class base::win::internal::ScopedHandleVerifier;

#if defined(OS_WIN)
using NativeHandle = CHROME_SRWLOCK;
#elif defined(OS_POSIX) || defined(OS_FUCHSIA)
Expand Down Expand Up @@ -58,7 +71,6 @@ class BASE_EXPORT LockImpl {
static bool PriorityInheritanceAvailable();
#endif

private:
NativeHandle native_handle_;

DISALLOW_COPY_AND_ASSIGN(LockImpl);
Expand Down
39 changes: 18 additions & 21 deletions base/win/scoped_handle_verifier.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,24 +39,6 @@ using HandleMap =
std::unordered_map<HANDLE, ScopedHandleVerifierInfo, HandleHash>;
using NativeLock = base::internal::LockImpl;

NativeLock* GetScopedHandleVerifierLock() {
static auto* native_lock = new NativeLock();
return native_lock;
}

// Simple automatic locking using a native critical section so it supports
// recursive locking.
class AutoNativeLock {
public:
explicit AutoNativeLock(NativeLock& lock) : lock_(lock) { lock_.Lock(); }

~AutoNativeLock() { lock_.Unlock(); }

private:
NativeLock& lock_;
DISALLOW_COPY_AND_ASSIGN(AutoNativeLock);
};

NOINLINE void ReportErrorOnScopedHandleOperation(
const base::debug::StackTrace& creation_stack) {
auto creation_stack_copy = creation_stack;
Expand All @@ -78,6 +60,19 @@ NOINLINE void ReportErrorOnScopedHandleOperation(

} // namespace

// Simple automatic locking using a native critical section so it supports
// recursive locking.
class AutoNativeLock {
public:
explicit AutoNativeLock(NativeLock& lock) : lock_(lock) { lock_.Lock(); }

~AutoNativeLock() { lock_.Unlock(); }

private:
NativeLock& lock_;
DISALLOW_COPY_AND_ASSIGN(AutoNativeLock);
};

ScopedHandleVerifierInfo::ScopedHandleVerifierInfo(
const void* owner,
const void* pc1,
Expand Down Expand Up @@ -116,10 +111,11 @@ bool CloseHandleWrapper(HANDLE handle) {

// Assigns the g_active_verifier global within the ScopedHandleVerifier lock.
// If |existing_verifier| is non-null then |enabled| is ignored.
void ThreadSafeAssignOrCreateScopedHandleVerifier(
// static
void ScopedHandleVerifier::ThreadSafeAssignOrCreateScopedHandleVerifier(
ScopedHandleVerifier* existing_verifier,
bool enabled) {
AutoNativeLock lock(*GetScopedHandleVerifierLock());
AutoNativeLock lock(*GetLock());
// Another thread in this module might be trying to assign the global
// verifier, so check that within the lock here.
if (g_active_verifier)
Expand Down Expand Up @@ -180,7 +176,8 @@ bool ScopedHandleVerifier::CloseHandle(HANDLE handle) {

// static
NativeLock* ScopedHandleVerifier::GetLock() {
return GetScopedHandleVerifierLock();
static auto* native_lock = new NativeLock();
return native_lock;
}

void ScopedHandleVerifier::StartTracking(HANDLE handle,
Expand Down
2 changes: 2 additions & 0 deletions base/win/scoped_handle_verifier.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ class [[clang::lto_visibility_public]] ScopedHandleVerifier {

static base::internal::LockImpl* GetLock();
static void InstallVerifier();
static void ThreadSafeAssignOrCreateScopedHandleVerifier(
ScopedHandleVerifier * existing_verifier, bool enabled);

base::debug::StackTrace creation_stack_;
bool enabled_;
Expand Down
3 changes: 3 additions & 0 deletions build/args/headless.gn
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,6 @@ v8_enable_lazy_source_positions = false
use_glib = false
use_gtk = false
use_pangocairo = false

# TODO(1096425): Remove this once use_x11 goes away.
use_x11 = false
18 changes: 9 additions & 9 deletions build/config/ui.gni
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,15 @@ import("//build/config/chromeos/ui_mode.gni")

declare_args() {
# Indicates if Ozone is enabled. Ozone is a low-level library layer for Linux
# that does not require X11. Enabling this feature disables use of x11.
use_ozone = is_chromeos || (is_chromecast && !is_android) || is_fuchsia
# that does not require X11.
use_ozone =
is_chromeos || (is_chromecast && !is_android) || is_fuchsia || is_linux

# Indicates if the UI toolkit depends on X11.
# Enabled by default. Can be disabled if Ozone only build is required and
# vice-versa.
use_x11 =
is_linux && !is_chromecast && !is_chromeos && !chromeos_is_browser_only

# Indicates if Aura is enabled. Aura is a low-level windowing library, sort
# of a replacement for GDI or GTK.
Expand All @@ -38,13 +45,6 @@ declare_args() {
use_glib = is_desktop_linux && !is_chromecast
}

# Additional dependent variables -----------------------------------------------
#
# These variables depend on other variables and can't be set externally.

# Indicates if the UI toolkit depends on X11.
use_x11 = is_linux && !use_ozone

# Make sure glib is not used if building for ChromeOS/Chromecast
assert(!use_glib || (is_linux && !is_chromeos && !is_chromecast))

Expand Down
2 changes: 1 addition & 1 deletion build/fuchsia/linux.sdk.sha1
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.20200831.3.1
0.20200901.1.1
2 changes: 1 addition & 1 deletion build/fuchsia/mac.sdk.sha1
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.20200831.3.1
0.20200901.1.1
3 changes: 3 additions & 0 deletions chrome/android/features/autofill_assistant/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ android_library("java") {
"java/src/org/chromium/chrome/browser/autofill_assistant/AbstractListObserver.java",
"java/src/org/chromium/chrome/browser/autofill_assistant/AssistantAccessibilityUtils.java",
"java/src/org/chromium/chrome/browser/autofill_assistant/AssistantBottomBarCoordinator.java",
"java/src/org/chromium/chrome/browser/autofill_assistant/AssistantBottomBarDelegate.java",
"java/src/org/chromium/chrome/browser/autofill_assistant/AssistantBottomBarNativeDelegate.java",
"java/src/org/chromium/chrome/browser/autofill_assistant/AssistantBottomSheetContent.java",
"java/src/org/chromium/chrome/browser/autofill_assistant/AssistantCoordinator.java",
"java/src/org/chromium/chrome/browser/autofill_assistant/AssistantDialogButton.java",
Expand Down Expand Up @@ -185,6 +187,7 @@ android_library("java") {

generate_jni("jni_headers") {
sources = [
"java/src/org/chromium/chrome/browser/autofill_assistant/AssistantBottomBarNativeDelegate.java",
"java/src/org/chromium/chrome/browser/autofill_assistant/AssistantDialogButton.java",
"java/src/org/chromium/chrome/browser/autofill_assistant/AssistantInfoPopup.java",
"java/src/org/chromium/chrome/browser/autofill_assistant/AssistantModel.java",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
import org.chromium.chrome.browser.util.ChromeAccessibilityUtil;
import org.chromium.components.browser_ui.bottomsheet.BottomSheetContent;
import org.chromium.components.browser_ui.bottomsheet.BottomSheetController;
import org.chromium.components.browser_ui.bottomsheet.BottomSheetController.SheetState;
import org.chromium.components.browser_ui.bottomsheet.BottomSheetObserver;
import org.chromium.components.browser_ui.bottomsheet.EmptyBottomSheetObserver;
import org.chromium.content_public.browser.UiThreadTaskTraits;
import org.chromium.content_public.browser.WebContents;
Expand All @@ -60,6 +62,7 @@ class AssistantBottomBarCoordinator implements AssistantPeekHeightCoordinator.De
private WebContents mWebContents;
private ApplicationViewportInsetSupplier mWindowApplicationInsetSupplier;
private final ChromeAccessibilityUtil.Observer mAccessibilityObserver;
private final BottomSheetObserver mBottomSheetObserver;

// Child coordinators.
private final AssistantHeaderCoordinator mHeaderCoordinator;
Expand Down Expand Up @@ -98,8 +101,7 @@ class AssistantBottomBarCoordinator implements AssistantPeekHeightCoordinator.De
AssistantBottomBarCoordinator(Activity activity, AssistantModel model,
BottomSheetController controller,
ApplicationViewportInsetSupplier applicationViewportInsetSupplier,
TabObscuringHandler tabObscuringHandler,
AssistantBottomSheetContent.Delegate bottomSheetDelegate) {
TabObscuringHandler tabObscuringHandler) {
mModel = model;
mBottomSheetController = controller;
mTabObscuringHandler = tabObscuringHandler;
Expand All @@ -114,7 +116,7 @@ class AssistantBottomBarCoordinator implements AssistantPeekHeightCoordinator.De
if (currentSheetContent instanceof AssistantBottomSheetContent) {
mContent = (AssistantBottomSheetContent) currentSheetContent;
} else {
mContent = new AssistantBottomSheetContent(activity, bottomSheetDelegate);
mContent = new AssistantBottomSheetContent(activity, model::getBottomBarDelegate);
}

// Replace or set the content to the actual Autofill Assistant views.
Expand Down Expand Up @@ -189,9 +191,14 @@ class AssistantBottomBarCoordinator implements AssistantPeekHeightCoordinator.De
setHorizontalMargins(mInfoBoxCoordinator.getView());
setHorizontalMargins(mDetailsCoordinator.getView());

controller.addObserver(new EmptyBottomSheetObserver() {
mBottomSheetObserver = new EmptyBottomSheetObserver() {
@Override
public void onSheetStateChanged(int newState) {
if (newState == SheetState.PEEK || newState == SheetState.HALF
|| newState == SheetState.FULL) {
mModel.setBottomSheetState(newState);
}

// Note: recycler view updates while the bottom sheet is SCROLLING result in a
// BottomSheet assertion.
if (newState != BottomSheetController.SheetState.SCROLLING) {
Expand All @@ -210,13 +217,14 @@ public void onSheetContentChanged(@Nullable BottomSheetContent newContent) {
public void onSheetOffsetChanged(float heightFraction, float offsetPx) {
updateVisualViewportHeight();
}
});
};
controller.addObserver(mBottomSheetObserver);

// Show or hide the bottom sheet content when the Autofill Assistant visibility is changed.
model.addObserver((source, propertyKey) -> {
if (AssistantModel.VISIBLE == propertyKey) {
if (model.get(AssistantModel.VISIBLE)) {
showContentAndExpand();
showContent(/* shouldExpand = */ false, /* animate = */ false);
} else {
hide();
}
Expand Down Expand Up @@ -320,6 +328,7 @@ public void destroy() {
resetVisualViewportHeight();
mWindowApplicationInsetSupplier.removeSupplier(mInsetSupplier);
ChromeAccessibilityUtil.get().removeObserver(mAccessibilityObserver);
mBottomSheetController.removeObserver(mBottomSheetObserver);

if (mObscuringToken != TokenHolder.INVALID_TOKEN) {
mTabObscuringHandler.unobscureAllTabs(mObscuringToken);
Expand All @@ -334,9 +343,9 @@ public void destroy() {
}

/** Request showing the Assistant bottom bar view and expand the sheet. */
public void showContentAndExpand() {
BottomSheetUtils.showContentAndExpand(
mBottomSheetController, mContent, /* animate= */ true);
public void showContent(boolean shouldExpand, boolean animate) {
BottomSheetUtils.showContentAndMaybeExpand(
mBottomSheetController, mContent, shouldExpand, animate);
}

/** Hide the Assistant bottom bar view. */
Expand Down Expand Up @@ -373,6 +382,10 @@ void collapse() {
mBottomSheetController.collapseSheet(/* animate = */ true);
}

void restoreState(@SheetState int state) {
BottomSheetUtils.restoreState(mBottomSheetController, mContent, state);
}

@Override
public void setShowOnlyCarousels(boolean showOnlyCarousels) {
mScrollableContent.setVisibility(showOnlyCarousels ? View.GONE : View.VISIBLE);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.chromium.chrome.browser.autofill_assistant;

/** Common interface for the bottom bar delegate. */
public interface AssistantBottomBarDelegate {
/** The back button has been pressed. */
boolean onBackButtonPressed();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.chromium.chrome.browser.autofill_assistant;

import org.chromium.base.annotations.CalledByNative;
import org.chromium.base.annotations.JNINamespace;
import org.chromium.base.annotations.NativeMethods;

/** Delegate for the bottom bar which forwards events to a native counterpart. */
@JNINamespace("autofill_assistant")
public class AssistantBottomBarNativeDelegate implements AssistantBottomBarDelegate {
private long mNativeAssistantBottomBarDelegate;

@CalledByNative
private static AssistantBottomBarNativeDelegate create(long nativeAssistantBottomBarDelegate) {
return new AssistantBottomBarNativeDelegate(nativeAssistantBottomBarDelegate);
}

private AssistantBottomBarNativeDelegate(long nativeAssistantBottomBarDelegate) {
mNativeAssistantBottomBarDelegate = nativeAssistantBottomBarDelegate;
}

@Override
public boolean onBackButtonPressed() {
if (mNativeAssistantBottomBarDelegate != 0) {
return AssistantBottomBarNativeDelegateJni.get().onBackButtonClicked(
mNativeAssistantBottomBarDelegate, AssistantBottomBarNativeDelegate.this);
}
return false;
}

@CalledByNative
private void clearNativePtr() {
mNativeAssistantBottomBarDelegate = 0;
}

@NativeMethods
interface Natives {
boolean onBackButtonClicked(
long nativeAssistantBottomBarDelegate, AssistantBottomBarNativeDelegate caller);
}
}
Loading

0 comments on commit a23c771

Please sign in to comment.