diff --git a/DEPS b/DEPS index 50d96e2..886ccbc 100644 --- a/DEPS +++ b/DEPS
@@ -44,7 +44,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling V8 # and whatever else without interference from each other. - 'v8_revision': '133b5e7e3117b9eb1a699aa4591b04394c67aa07', + 'v8_revision': '975e9a320b6eaf9f12280c35df98e013beb8f041', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling swarming_client # and whatever else without interference from each other. @@ -96,7 +96,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling catapult # and whatever else without interference from each other. - 'catapult_revision': 'cfcae9b972f24e331a8ed0110b5afc96e75919a0', + 'catapult_revision': '1e05d2f8401ce9b112c2f0e21269f1d7493ce88b', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling libFuzzer # and whatever else without interference from each other. @@ -120,7 +120,7 @@ deps = { 'src/breakpad/src': - Var('chromium_git') + '/breakpad/breakpad/src.git' + '@' + '3166d8be97c96e567e2c23a496cae4b9194f57fa', + Var('chromium_git') + '/breakpad/breakpad/src.git' + '@' + 'efa6d5c1c84e2fcacf6a2eafcf9010f98ef3a4d7', 'src/buildtools': Var('chromium_git') + '/chromium/buildtools.git' + '@' + Var('buildtools_revision'),
diff --git a/base/metrics/histogram.h b/base/metrics/histogram.h index 63fd243..4500efcf 100644 --- a/base/metrics/histogram.h +++ b/base/metrics/histogram.h
@@ -81,7 +81,8 @@ #include "base/macros.h" #include "base/metrics/bucket_ranges.h" #include "base/metrics/histogram_base.h" -#if !defined(OS_MACOSX) || defined(OS_IOS) +#if defined(OS_ANDROID) || defined(OS_CHROMEOS) || defined(OS_IOS) || \ + defined(OS_WIN) // TODO(asvitkine): Migrate callers to to include this directly and remove this. // Note: Incrementally migrating platforms as they become clean. #include "base/metrics/histogram_macros.h"
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/CardsVariationParameters.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/CardsVariationParameters.java index 0681a57..32bbeed0 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/CardsVariationParameters.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/CardsVariationParameters.java
@@ -23,7 +23,8 @@ private static final String TAG = "CardsVariationParams"; // Also defined in ntp_snippets_constants.cc - private static final String FIELD_TRIAL_NAME = "NTPSnippets"; + private static final String FIELD_TRIAL_NAME_MAIN = "NTPSnippets"; + private static final String FIELD_TRIAL_NAME_VISIBILITY = "NTPSnippetsVisibility"; private static final String PARAM_FAVICON_SERVICE_NAME = "favicons_fetch_from_service"; private static final String PARAM_FIRST_CARD_OFFSET = "first_card_offset"; @@ -54,37 +55,41 @@ * with a command line flag). It will return 0 if there is no such field trial. */ public static int getFirstCardOffsetDp() { - return getIntValue(PARAM_FIRST_CARD_OFFSET, 0); + return getIntValue(FIELD_TRIAL_NAME_VISIBILITY, PARAM_FIRST_CARD_OFFSET, 0); } /** * Gets the number of times the first card peeking animation should run. */ public static int getFirstCardAnimationMaxRuns() { - return getIntValue(PARAM_FIRST_CARD_ANIMATION_MAX_RUNS, FIRST_CARD_ANIMATION_DEFAULT_VALUE); + return getIntValue(FIELD_TRIAL_NAME_VISIBILITY, PARAM_FIRST_CARD_ANIMATION_MAX_RUNS, + FIRST_CARD_ANIMATION_DEFAULT_VALUE); } /** * @return Whether the NTP should initially be scrolled below the fold. */ public static boolean isScrollBelowTheFoldEnabled() { - return Boolean.parseBoolean(getParamValue(PARAM_SCROLL_BELOW_THE_FOLD)); + return Boolean.parseBoolean(getParamValue(FIELD_TRIAL_NAME_VISIBILITY, + PARAM_SCROLL_BELOW_THE_FOLD)); } /** * @return Whether the NTP should ignore updates for suggestions that have not been seen yet. */ public static boolean ignoreUpdatesForExistingSuggestions() { - return Boolean.parseBoolean(getParamValue(PARAM_IGNORE_UPDATES_FOR_EXISTING_SUGGESTIONS)); + return Boolean.parseBoolean(getParamValue(FIELD_TRIAL_NAME_MAIN, + PARAM_IGNORE_UPDATES_FOR_EXISTING_SUGGESTIONS)); } public static boolean isFaviconServiceEnabled() { - return !PARAM_DISABLED_VALUE.equals(getParamValue(PARAM_FAVICON_SERVICE_NAME)); + return !PARAM_DISABLED_VALUE.equals(getParamValue(FIELD_TRIAL_NAME_MAIN, + PARAM_FAVICON_SERVICE_NAME)); } - private static int getIntValue(String paramName, int defaultValue) { + private static int getIntValue(String fieldTrialName, String paramName, int defaultValue) { // TODO(jkrcal): Get parameter by feature name, not field trial name. - String value = getParamValue(paramName); + String value = getParamValue(fieldTrialName, paramName); if (!TextUtils.isEmpty(value)) { try { @@ -97,13 +102,13 @@ return defaultValue; } - private static String getParamValue(String paramName) { + private static String getParamValue(String fieldTrialName, String paramName) { if (sTestVariationParams != null) { String value = sTestVariationParams.get(paramName); if (value == null) return ""; return value; } - return VariationsAssociatedData.getVariationParamValue(FIELD_TRIAL_NAME, paramName); + return VariationsAssociatedData.getVariationParamValue(fieldTrialName, paramName); } }
diff --git a/chrome/browser/chromeos/policy/active_directory_policy_manager.cc b/chrome/browser/chromeos/policy/active_directory_policy_manager.cc index a1b91b9..fd35815 100644 --- a/chrome/browser/chromeos/policy/active_directory_policy_manager.cc +++ b/chrome/browser/chromeos/policy/active_directory_policy_manager.cc
@@ -13,6 +13,7 @@ #include "chromeos/dbus/dbus_thread_manager.h" #include "components/policy/core/common/policy_bundle.h" #include "components/policy/core/common/policy_types.h" +#include "components/policy/policy_constants.h" namespace policy { @@ -115,6 +116,7 @@ // TODO(tnagel): Rename CloudPolicyStore to PolicyStore and make the source // configurable, then drop PolicyMap::SetSourceForAll(). policy_map.SetSourceForAll(POLICY_SOURCE_ACTIVE_DIRECTORY); + SetEnterpriseUsersDefaults(&policy_map); UpdatePolicy(std::move(bundle)); }
diff --git a/chrome/browser/policy/policy_network_browsertest.cc b/chrome/browser/policy/policy_network_browsertest.cc index 323b6b1..faf7466 100644 --- a/chrome/browser/policy/policy_network_browsertest.cc +++ b/chrome/browser/policy/policy_network_browsertest.cc
@@ -195,6 +195,8 @@ command_line->AppendSwitch( chromeos::switches::kIgnoreUserProfileMappingForTests); #endif + // Ensure that QUIC is enabled by default on browser startup. + command_line->AppendSwitch(switches::kEnableQuic); } void SetUpInProcessBrowserTestFixture() override {
diff --git a/components/ntp_snippets/features.cc b/components/ntp_snippets/features.cc index a4cb51d..25935a6df 100644 --- a/components/ntp_snippets/features.cc +++ b/components/ntp_snippets/features.cc
@@ -19,7 +19,7 @@ "NTPBookmarkSuggestions", base::FEATURE_ENABLED_BY_DEFAULT}; const base::Feature kRecentOfflineTabSuggestionsFeature{ - "NTPOfflinePageSuggestions", base::FEATURE_ENABLED_BY_DEFAULT}; + "NTPOfflinePageSuggestions", base::FEATURE_DISABLED_BY_DEFAULT}; const base::Feature kSaveToOfflineFeature{ "NTPSaveToOffline", base::FEATURE_ENABLED_BY_DEFAULT};
diff --git a/components/storage_monitor/storage_monitor_linux.cc b/components/storage_monitor/storage_monitor_linux.cc index 4b3a01f..1bbffa9 100644 --- a/components/storage_monitor/storage_monitor_linux.cc +++ b/components/storage_monitor/storage_monitor_linux.cc
@@ -15,7 +15,7 @@ #include "base/bind.h" #include "base/macros.h" -#include "base/metrics/histogram.h" +#include "base/metrics/histogram_macros.h" #include "base/process/kill.h" #include "base/process/launch.h" #include "base/process/process.h"
diff --git a/components/translate/ios/browser/BUILD.gn b/components/translate/ios/browser/BUILD.gn index d95a2f7..b514e91 100644 --- a/components/translate/ios/browser/BUILD.gn +++ b/components/translate/ios/browser/BUILD.gn
@@ -5,6 +5,7 @@ import("//ios/web/js_compile.gni") source_set("browser") { + configs += [ "//build/config/compiler:enable_arc" ] sources = [ "ios_translate_driver.h", "ios_translate_driver.mm",
diff --git a/components/translate/ios/browser/ios_translate_driver.mm b/components/translate/ios/browser/ios_translate_driver.mm index e1851db..2bb266fd 100644 --- a/components/translate/ios/browser/ios_translate_driver.mm +++ b/components/translate/ios/browser/ios_translate_driver.mm
@@ -29,6 +29,10 @@ #include "ui/base/window_open_disposition.h" #include "url/gurl.h" +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + namespace translate { namespace {
diff --git a/components/translate/ios/browser/js_language_detection_manager.mm b/components/translate/ios/browser/js_language_detection_manager.mm index aa338475..822b896 100644 --- a/components/translate/ios/browser/js_language_detection_manager.mm +++ b/components/translate/ios/browser/js_language_detection_manager.mm
@@ -5,10 +5,13 @@ #import "components/translate/ios/browser/js_language_detection_manager.h" #include "base/callback.h" -#include "base/mac/scoped_nsobject.h" #include "base/strings/string_util.h" #include "base/strings/sys_string_conversions.h" +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + namespace language_detection { // Note: This should stay in sync with the constant in language_detection.js. const size_t kMaxIndexChars = 65535;
diff --git a/components/translate/ios/browser/js_translate_manager.mm b/components/translate/ios/browser/js_translate_manager.mm index 47f2a4e3..aa5df282 100644 --- a/components/translate/ios/browser/js_translate_manager.mm +++ b/components/translate/ios/browser/js_translate_manager.mm
@@ -10,14 +10,18 @@ #include "base/logging.h" #include "base/mac/bundle_locations.h" -#import "base/mac/scoped_nsobject.h" +#import "ios/web/public/web_state/js/crw_js_injection_receiver.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif @implementation JsTranslateManager { - base::scoped_nsobject<NSString> _translationScript; + NSString* _translationScript; } - (NSString*)script { - return _translationScript.get(); + return _translationScript; } - (void)setScript:(NSString*)script { @@ -43,7 +47,7 @@ error:&error]; DCHECK(!error && [content length]); script = [script stringByAppendingString:content]; - _translationScript.reset([script copy]); + _translationScript = [script copy]; } - (void)injectWaitUntilTranslateReadyScript { @@ -75,7 +79,9 @@ - (NSString*)injectionContent { DCHECK(_translationScript); - return _translationScript.autorelease(); + NSString* translationScript = _translationScript; + _translationScript = nil; + return translationScript; } @end
diff --git a/components/translate/ios/browser/language_detection_controller.h b/components/translate/ios/browser/language_detection_controller.h index 70c691e..72a3d5bc 100644 --- a/components/translate/ios/browser/language_detection_controller.h +++ b/components/translate/ios/browser/language_detection_controller.h
@@ -10,7 +10,6 @@ #include "base/callback_list.h" #include "base/gtest_prod_util.h" -#include "base/mac/scoped_nsobject.h" #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "base/strings/string16.h" @@ -84,7 +83,7 @@ void WebStateDestroyed() override; CallbackList language_detection_callbacks_; - base::scoped_nsobject<JsLanguageDetectionManager> js_manager_; + JsLanguageDetectionManager* js_manager_; BooleanPrefMember translate_enabled_; base::WeakPtrFactory<LanguageDetectionController> weak_method_factory_;
diff --git a/components/translate/ios/browser/language_detection_controller.mm b/components/translate/ios/browser/language_detection_controller.mm index 5e631a5..04f387c 100644 --- a/components/translate/ios/browser/language_detection_controller.mm +++ b/components/translate/ios/browser/language_detection_controller.mm
@@ -18,6 +18,10 @@ #import "ios/web/public/url_scheme_util.h" #include "ios/web/public/web_state/web_state.h" +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + namespace translate { namespace { @@ -33,7 +37,7 @@ JsLanguageDetectionManager* manager, PrefService* prefs) : web::WebStateObserver(web_state), - js_manager_([manager retain]), + js_manager_(manager), weak_method_factory_(this) { DCHECK(web::WebStateObserver::web_state()); DCHECK(js_manager_);
diff --git a/components/translate/ios/browser/translate_controller.h b/components/translate/ios/browser/translate_controller.h index 6cf848e..c8556e2e 100644 --- a/components/translate/ios/browser/translate_controller.h +++ b/components/translate/ios/browser/translate_controller.h
@@ -8,7 +8,6 @@ #include <string> #include "base/gtest_prod_util.h" -#include "base/mac/scoped_nsobject.h" #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "ios/web/public/web_state/web_state_observer.h" @@ -69,7 +68,7 @@ // Changes the JsTranslateManager used by this TranslateController. // Only used for testing. void SetJsTranslateManagerForTesting(JsTranslateManager* manager) { - js_manager_.reset([manager retain]); + js_manager_ = manager; } private: @@ -95,7 +94,7 @@ void WebStateDestroyed() override; Observer* observer_; - base::scoped_nsobject<JsTranslateManager> js_manager_; + JsTranslateManager* js_manager_; base::WeakPtrFactory<TranslateController> weak_method_factory_; DISALLOW_COPY_AND_ASSIGN(TranslateController);
diff --git a/components/translate/ios/browser/translate_controller.mm b/components/translate/ios/browser/translate_controller.mm index 6035ba5..ea181c6 100644 --- a/components/translate/ios/browser/translate_controller.mm +++ b/components/translate/ios/browser/translate_controller.mm
@@ -12,6 +12,10 @@ #import "components/translate/ios/browser/js_translate_manager.h" #include "ios/web/public/web_state/web_state.h" +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + namespace translate { namespace { @@ -24,7 +28,7 @@ JsTranslateManager* manager) : web::WebStateObserver(web_state), observer_(nullptr), - js_manager_([manager retain]), + js_manager_(manager), weak_method_factory_(this) { DCHECK(js_manager_); DCHECK(web::WebStateObserver::web_state());
diff --git a/content/renderer/media/gpu/rtc_video_decoder.cc b/content/renderer/media/gpu/rtc_video_decoder.cc index 63239737..4a7ebf7 100644 --- a/content/renderer/media/gpu/rtc_video_decoder.cc +++ b/content/renderer/media/gpu/rtc_video_decoder.cc
@@ -739,7 +739,7 @@ DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent(); if (!IsProfileSupported(profile)) { - DVLOG(1) << "Unsupported profile " << profile; + DVLOG(1) << "Unsupported profile " << GetProfileName(profile); } else { vda_ = factories_->CreateVideoDecodeAccelerator();
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc index 6d11014..d6315802 100644 --- a/content/renderer/render_thread_impl.cc +++ b/content/renderer/render_thread_impl.cc
@@ -891,6 +891,9 @@ record_purge_suspend_metric_closure_.Reset(base::Bind( &RenderThreadImpl::RecordPurgeAndSuspendMetrics, base::Unretained(this))); + record_purge_suspend_growth_metric_closure_.Reset( + base::Bind(&RenderThreadImpl::RecordPurgeAndSuspendMemoryGrowthMetrics, + base::Unretained(this))); base::MemoryCoordinatorClientRegistry::GetInstance()->Register(this); @@ -1646,6 +1649,10 @@ record_purge_suspend_metric_closure_.Reset( base::Bind(&RenderThreadImpl::RecordPurgeAndSuspendMetrics, base::Unretained(this))); + record_purge_suspend_growth_metric_closure_.Cancel(); + record_purge_suspend_growth_metric_closure_.Reset( + base::Bind(&RenderThreadImpl::RecordPurgeAndSuspendMemoryGrowthMetrics, + base::Unretained(this))); } } @@ -1760,7 +1767,7 @@ // we should collect the metrics using memory-infra. // TODO(tasak): We should also report a difference between the memory usages // before and after purging by using memory-infra. -void RenderThreadImpl::RecordPurgeAndSuspendMetrics() const { +void RenderThreadImpl::RecordPurgeAndSuspendMetrics() { // If this renderer is resumed, we should not update UMA. if (!RendererIsHidden()) return; @@ -1781,6 +1788,56 @@ memory_metrics.v8_main_thread_isolate_mb); UMA_HISTOGRAM_MEMORY_MB("PurgeAndSuspend.Memory.TotalAllocatedMB", memory_metrics.total_allocated_mb); + purge_and_suspend_memory_metrics_ = memory_metrics; + + // record how many memory usage increases after purged. + GetRendererScheduler()->DefaultTaskRunner()->PostDelayedTask( + FROM_HERE, record_purge_suspend_growth_metric_closure_.callback(), + base::TimeDelta::FromMinutes(5)); + GetRendererScheduler()->DefaultTaskRunner()->PostDelayedTask( + FROM_HERE, record_purge_suspend_growth_metric_closure_.callback(), + base::TimeDelta::FromMinutes(10)); + GetRendererScheduler()->DefaultTaskRunner()->PostDelayedTask( + FROM_HERE, record_purge_suspend_growth_metric_closure_.callback(), + base::TimeDelta::FromMinutes(15)); +} + +#define GET_MEMORY_GROWTH(current, previous, allocator) \ + (current.allocator > previous.allocator \ + ? current.allocator - previous.allocator \ + : 0) + +void RenderThreadImpl::RecordPurgeAndSuspendMemoryGrowthMetrics() const { + // If this renderer is resumed, we should not update UMA. + if (!RendererIsHidden()) + return; + + RendererMemoryMetrics memory_metrics; + GetRendererMemoryMetrics(&memory_metrics); + UMA_HISTOGRAM_MEMORY_KB( + "PurgeAndSuspend.Experimental.MemoryGrowth.PartitionAllocKB", + GET_MEMORY_GROWTH(memory_metrics, purge_and_suspend_memory_metrics_, + partition_alloc_kb)); + UMA_HISTOGRAM_MEMORY_KB( + "PurgeAndSuspend.Experimental.MemoryGrowth.BlinkGCKB", + GET_MEMORY_GROWTH(memory_metrics, purge_and_suspend_memory_metrics_, + blink_gc_kb)); + UMA_HISTOGRAM_MEMORY_MB( + "PurgeAndSuspend.Experimental.MemoryGrowth.MallocKB", + GET_MEMORY_GROWTH(memory_metrics, purge_and_suspend_memory_metrics_, + malloc_mb) * 1024); + UMA_HISTOGRAM_MEMORY_KB( + "PurgeAndSuspend.Experimental.MemoryGrowth.DiscardableKB", + GET_MEMORY_GROWTH(memory_metrics, purge_and_suspend_memory_metrics_, + discardable_kb)); + UMA_HISTOGRAM_MEMORY_MB( + "PurgeAndSuspend.Experimental.MemoryGrowth.V8MainThreadIsolateKB", + GET_MEMORY_GROWTH(memory_metrics, purge_and_suspend_memory_metrics_, + v8_main_thread_isolate_mb) * 1024); + UMA_HISTOGRAM_MEMORY_MB( + "PurgeAndSuspend.Experimental.MemoryGrowth.TotalAllocatedKB", + GET_MEMORY_GROWTH(memory_metrics, purge_and_suspend_memory_metrics_, + total_allocated_mb) * 1024); } void RenderThreadImpl::OnProcessResume() {
diff --git a/content/renderer/render_thread_impl.h b/content/renderer/render_thread_impl.h index 9c0cfe3..5ec1c93 100644 --- a/content/renderer/render_thread_impl.h +++ b/content/renderer/render_thread_impl.h
@@ -564,7 +564,8 @@ void OnRendererHidden(); void OnRendererVisible(); - void RecordPurgeAndSuspendMetrics() const; + void RecordPurgeAndSuspendMetrics(); + void RecordPurgeAndSuspendMemoryGrowthMetrics() const; void ReleaseFreeMemory(); @@ -763,6 +764,8 @@ thread_safe_render_message_filter_; base::CancelableClosure record_purge_suspend_metric_closure_; + RendererMemoryMetrics purge_and_suspend_memory_metrics_; + base::CancelableClosure record_purge_suspend_growth_metric_closure_; int32_t client_id_;
diff --git a/dbus/exported_object.cc b/dbus/exported_object.cc index 19d1715..0024df6 100644 --- a/dbus/exported_object.cc +++ b/dbus/exported_object.cc
@@ -11,7 +11,7 @@ #include "base/logging.h" #include "base/memory/ref_counted.h" #include "base/message_loop/message_loop.h" -#include "base/metrics/histogram.h" +#include "base/metrics/histogram_macros.h" #include "base/threading/thread_restrictions.h" #include "base/time/time.h" #include "dbus/bus.h"
diff --git a/dbus/object_proxy.cc b/dbus/object_proxy.cc index 5d9d8e84..15f20c7 100644 --- a/dbus/object_proxy.cc +++ b/dbus/object_proxy.cc
@@ -10,7 +10,7 @@ #include "base/bind.h" #include "base/logging.h" #include "base/message_loop/message_loop.h" -#include "base/metrics/histogram.h" +#include "base/metrics/histogram_macros.h" #include "base/strings/string_piece.h" #include "base/strings/stringprintf.h" #include "base/task_runner_util.h"
diff --git a/dbus/signal_sender_verification_unittest.cc b/dbus/signal_sender_verification_unittest.cc index 320718d..7f5c7906 100644 --- a/dbus/signal_sender_verification_unittest.cc +++ b/dbus/signal_sender_verification_unittest.cc
@@ -6,7 +6,7 @@ #include "base/bind.h" #include "base/message_loop/message_loop.h" -#include "base/metrics/histogram.h" +#include "base/metrics/histogram_macros.h" #include "base/metrics/histogram_samples.h" #include "base/metrics/statistics_recorder.h" #include "base/run_loop.h"
diff --git a/device/battery/battery_status_manager_linux.cc b/device/battery/battery_status_manager_linux.cc index ce52f9f..7d9469e 100644 --- a/device/battery/battery_status_manager_linux.cc +++ b/device/battery/battery_status_manager_linux.cc
@@ -14,7 +14,7 @@ #include <vector> #include "base/macros.h" -#include "base/metrics/histogram.h" +#include "base/metrics/histogram_macros.h" #include "base/single_thread_task_runner.h" #include "base/threading/thread.h" #include "base/values.h"
diff --git a/device/bluetooth/bluez/bluetooth_adapter_bluez.cc b/device/bluetooth/bluez/bluetooth_adapter_bluez.cc index f2a6884..81e189e 100644 --- a/device/bluetooth/bluez/bluetooth_adapter_bluez.cc +++ b/device/bluetooth/bluez/bluetooth_adapter_bluez.cc
@@ -16,7 +16,7 @@ #include "base/location.h" #include "base/logging.h" #include "base/memory/ptr_util.h" -#include "base/metrics/histogram.h" +#include "base/metrics/histogram_macros.h" #include "base/sequenced_task_runner.h" #include "base/single_thread_task_runner.h" #include "base/strings/stringprintf.h"
diff --git a/device/bluetooth/bluez/bluetooth_device_bluez.cc b/device/bluetooth/bluez/bluetooth_device_bluez.cc index 50b54cbb..b060b2f 100644 --- a/device/bluetooth/bluez/bluetooth_device_bluez.cc +++ b/device/bluetooth/bluez/bluetooth_device_bluez.cc
@@ -12,7 +12,7 @@ #include "base/bind.h" #include "base/memory/ptr_util.h" -#include "base/metrics/histogram.h" +#include "base/metrics/histogram_macros.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_util.h" #include "dbus/bus.h"
diff --git a/device/bluetooth/bluez/bluetooth_pairing_bluez.cc b/device/bluetooth/bluez/bluetooth_pairing_bluez.cc index 611ad01..2602ab9 100644 --- a/device/bluetooth/bluez/bluetooth_pairing_bluez.cc +++ b/device/bluetooth/bluez/bluetooth_pairing_bluez.cc
@@ -5,7 +5,7 @@ #include "device/bluetooth/bluez/bluetooth_pairing_bluez.h" #include "base/logging.h" -#include "base/metrics/histogram.h" +#include "base/metrics/histogram_macros.h" #include "device/bluetooth/bluetooth_device.h" #include "device/bluetooth/bluez/bluetooth_device_bluez.h"
diff --git a/headless/lib/embedder_mojo_browsertest.cc b/headless/lib/embedder_mojo_browsertest.cc index 0ae117b33..92800f1 100644 --- a/headless/lib/embedder_mojo_browsertest.cc +++ b/headless/lib/embedder_mojo_browsertest.cc
@@ -234,7 +234,7 @@ } void ReturnTestResult(const std::string& result) override { - FinishAsynchronousTest(); + DisableClientAndFinishAsynchronousTest(); FAIL() << "The HTTP page should not have been served and we should not have" " recieved a mojo callback!"; } @@ -242,6 +242,12 @@ void OnLoadingFailed(const network::LoadingFailedParams& params) override { // The navigation should fail since HTTP requests are blackholed. EXPECT_EQ(params.GetErrorText(), "net::ERR_FILE_NOT_FOUND"); + DisableClientAndFinishAsynchronousTest(); + } + + void DisableClientAndFinishAsynchronousTest() { + devtools_client_->GetNetwork()->Disable(); + devtools_client_->GetNetwork()->RemoveObserver(this); FinishAsynchronousTest(); } };
diff --git a/headless/lib/headless_devtools_client_browsertest.cc b/headless/lib/headless_devtools_client_browsertest.cc index 4c19d056..6dbd79fa 100644 --- a/headless/lib/headless_devtools_client_browsertest.cc +++ b/headless/lib/headless_devtools_client_browsertest.cc
@@ -65,6 +65,7 @@ } void OnLoadEventFired(const page::LoadEventFiredParams& params) override { + devtools_client_->GetPage()->Disable(); devtools_client_->GetPage()->GetExperimental()->RemoveObserver(this); FinishAsynchronousTest(); } @@ -174,6 +175,7 @@ &content_type)); EXPECT_EQ("text/html", content_type); + devtools_client_->GetNetwork()->Disable(); devtools_client_->GetNetwork()->RemoveObserver(this); FinishAsynchronousTest(); } @@ -208,6 +210,9 @@ void OnFrameStoppedLoading( const page::FrameStoppedLoadingParams& params) override { + devtools_client_->GetPage()->Disable(); + devtools_client_->GetPage()->GetExperimental()->RemoveObserver(this); + // Check that a non-experimental command which has no return value can be // called with a void() callback. devtools_client_->GetPage()->Reload(
diff --git a/headless/lib/headless_web_contents_browsertest.cc b/headless/lib/headless_web_contents_browsertest.cc index 03097ca1..693e2dc 100644 --- a/headless/lib/headless_web_contents_browsertest.cc +++ b/headless/lib/headless_web_contents_browsertest.cc
@@ -139,6 +139,9 @@ const security::SecurityStateChangedParams& params) override { EXPECT_EQ(security::SecurityState::NEUTRAL, params.GetSecurityState()); + devtools_client_->GetSecurity()->GetExperimental()->Disable( + security::DisableParams::Builder().Build()); + devtools_client_->GetSecurity()->GetExperimental()->RemoveObserver(this); FinishAsynchronousTest(); } };
diff --git a/headless/public/util/dom_tree_extractor_browsertest.cc b/headless/public/util/dom_tree_extractor_browsertest.cc index 808a10b..22b2379 100644 --- a/headless/public/util/dom_tree_extractor_browsertest.cc +++ b/headless/public/util/dom_tree_extractor_browsertest.cc
@@ -49,6 +49,7 @@ } void OnLoadEventFired(const page::LoadEventFiredParams& params) override { + devtools_client_->GetPage()->Disable(); devtools_client_->GetPage()->RemoveObserver(this); extractor_.reset(new DomTreeExtractor(devtools_client_.get()));
diff --git a/ios/chrome/DEPS b/ios/chrome/DEPS index f502fa8..cba7de6 100644 --- a/ios/chrome/DEPS +++ b/ios/chrome/DEPS
@@ -1,5 +1,6 @@ include_rules = [ "+crypto", + "+ios/shared/chrome/common", "+ios/third_party", "+net", "+sql",
diff --git a/ios/chrome/app/application_delegate/BUILD.gn b/ios/chrome/app/application_delegate/BUILD.gn index c29ebfc..cf22cd0 100644 --- a/ios/chrome/app/application_delegate/BUILD.gn +++ b/ios/chrome/app/application_delegate/BUILD.gn
@@ -73,6 +73,7 @@ } source_set("application_delegate_internal") { + configs += [ "//build/config/compiler:enable_arc" ] sources = [ "app_navigation.h", "app_state.h",
diff --git a/ios/chrome/app/application_delegate/app_state.h b/ios/chrome/app/application_delegate/app_state.h index 52aff1d..fa1f415 100644 --- a/ios/chrome/app/application_delegate/app_state.h +++ b/ios/chrome/app/application_delegate/app_state.h
@@ -37,7 +37,7 @@ // Window for the application, it is not set during the initialization method. // Set the property before calling methods related to it. -@property(nonatomic, assign) UIWindow* window; +@property(nonatomic, weak) UIWindow* window; // Saves the launchOptions to be used from -newTabFromLaunchOptions. If the // application is in background, initialize the browser to basic. If not, launch
diff --git a/ios/chrome/app/application_delegate/app_state.mm b/ios/chrome/app/application_delegate/app_state.mm index 593da25..2c41052 100644 --- a/ios/chrome/app/application_delegate/app_state.mm +++ b/ios/chrome/app/application_delegate/app_state.mm
@@ -6,8 +6,8 @@ #include "base/critical_closure.h" #import "base/mac/bind_objc_block.h" -#import "base/mac/scoped_nsobject.h" #include "components/metrics/metrics_service.h" +#import "ios/chrome/app/main_application_delegate.h" #import "ios/chrome/app/application_delegate/app_navigation.h" #import "ios/chrome/app/application_delegate/browser_launcher.h" #import "ios/chrome/app/application_delegate/memory_warning_helper.h" @@ -40,6 +40,10 @@ #include "ios/web/net/request_tracker_impl.h" #include "net/url_request/url_request_context.h" +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + namespace { // Helper method to post |closure| on the UI thread. void PostTaskOnUIThread(const base::Closure& closure) { @@ -50,16 +54,16 @@ @interface AppState ()<SafeModeCoordinatorDelegate> { // Container for startup information. - base::WeakNSProtocol<id<StartupInformation>> _startupInformation; + __weak id<StartupInformation> _startupInformation; // Browser launcher to launch browser in different states. - base::WeakNSProtocol<id<BrowserLauncher>> _browserLauncher; + __weak id<BrowserLauncher> _browserLauncher; // UIApplicationDelegate for the application. - base::WeakNSObject<MainApplicationDelegate> _mainApplicationDelegate; + __weak MainApplicationDelegate* _mainApplicationDelegate; // Window for the application. - base::WeakNSObject<UIWindow> _window; + __weak UIWindow* _window; // Variables backing properties of same name. - base::scoped_nsobject<SafeModeCoordinator> _safeModeCoordinator; + SafeModeCoordinator* _safeModeCoordinator; // Start of the current session, used for UMA. base::TimeTicks _sessionStartTime; @@ -69,7 +73,7 @@ // active. BOOL _shouldOpenNTPTabOnActive; // Interstitial view used to block any incognito tabs after backgrounding. - base::scoped_nsobject<UIView> _incognitoBlocker; + UIView* _incognitoBlocker; // Whether the application is currently in the background. // This is a workaround for rdar://22392526 where // -applicationDidEnterBackground: can be called twice. @@ -81,7 +85,7 @@ // Safe mode coordinator. If this is non-nil, the app is displaying the safe // mode UI. -@property(nonatomic, retain) SafeModeCoordinator* safeModeCoordinator; +@property(nonatomic, strong) SafeModeCoordinator* safeModeCoordinator; // Return value for -requiresHandlingAfterLaunchWithOptions that determines if // UIKit should make followup delegate calls such as @@ -115,9 +119,9 @@ applicationDelegate:(MainApplicationDelegate*)applicationDelegate { self = [super init]; if (self) { - _startupInformation.reset(startupInformation); - _browserLauncher.reset(browserLauncher); - _mainApplicationDelegate.reset(applicationDelegate); + _startupInformation = startupInformation; + _browserLauncher = browserLauncher; + _mainApplicationDelegate = applicationDelegate; } return self; } @@ -129,11 +133,11 @@ } - (void)setSafeModeCoordinator:(SafeModeCoordinator*)safeModeCoordinator { - _safeModeCoordinator.reset([safeModeCoordinator retain]); + _safeModeCoordinator = safeModeCoordinator; } - (void)setWindow:(UIWindow*)window { - _window.reset(window); + _window = window; } - (UIWindow*)window { @@ -192,8 +196,8 @@ CGRect screenBounds = [[UIScreen mainScreen] bounds]; CGFloat maxDimension = std::max(CGRectGetWidth(screenBounds), CGRectGetHeight(screenBounds)); - _incognitoBlocker.reset([[UIView alloc] - initWithFrame:CGRectMake(0, 0, maxDimension, maxDimension)]); + _incognitoBlocker = [[UIView alloc] + initWithFrame:CGRectMake(0, 0, maxDimension, maxDimension)]; InstallBackgroundInView(_incognitoBlocker); [_window addSubview:_incognitoBlocker]; } @@ -207,12 +211,13 @@ [[_browserLauncher browserViewInformation] currentBVC] .browserState->GetRequestContext(); _savingCookies = YES; - base::Closure criticalClosure = base::MakeCriticalClosure(base::BindBlock(^{ - DCHECK_CURRENTLY_ON(web::WebThread::UI); - _savingCookies = NO; - })); + base::Closure criticalClosure = + base::MakeCriticalClosure(base::BindBlockArc(^{ + DCHECK_CURRENTLY_ON(web::WebThread::UI); + _savingCookies = NO; + })); web::WebThread::PostTask( - web::WebThread::IO, FROM_HERE, base::BindBlock(^{ + web::WebThread::IO, FROM_HERE, base::BindBlockArc(^{ net::CookieStoreIOS* store = static_cast<net::CookieStoreIOS*>( getter->GetURLRequestContext()->cookie_store()); // FlushStore() runs its callback on any thread. Jump back to UI. @@ -259,7 +264,7 @@ _applicationInBackground = NO; [_incognitoBlocker removeFromSuperview]; - _incognitoBlocker.reset(); + _incognitoBlocker = nil; breakpad_helper::SetCurrentlyInBackground(false); @@ -315,7 +320,7 @@ - (void)resumeSessionWithTabOpener:(id<TabOpening>)tabOpener tabSwitcher:(id<TabSwitching>)tabSwitcher { [_incognitoBlocker removeFromSuperview]; - _incognitoBlocker.reset(); + _incognitoBlocker = nil; DCHECK([_browserLauncher browserInitializationStage] == INITIALIZATION_STAGE_FOREGROUND); @@ -443,7 +448,7 @@ DCHECK([_window rootViewController] == nil); if ([SafeModeCoordinator shouldStart]) { SafeModeCoordinator* safeModeCoordinator = - [[[SafeModeCoordinator alloc] initWithWindow:_window] autorelease]; + [[SafeModeCoordinator alloc] initWithWindow:_window]; self.safeModeCoordinator = safeModeCoordinator; [self.safeModeCoordinator setDelegate:self];
diff --git a/ios/chrome/app/application_delegate/background_activity.mm b/ios/chrome/app/application_delegate/background_activity.mm index f5c55250..2949ee5 100644 --- a/ios/chrome/app/application_delegate/background_activity.mm +++ b/ios/chrome/app/application_delegate/background_activity.mm
@@ -4,7 +4,6 @@ #import "ios/chrome/app/application_delegate/background_activity.h" -#import "base/ios/weak_nsobject.h" #include "base/metrics/histogram_macros.h" #include "base/metrics/user_metrics.h" #include "base/metrics/user_metrics_action.h" @@ -16,6 +15,10 @@ #import "ios/chrome/browser/metrics/previous_session_info.h" #include "url/gurl.h" +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + namespace { // Key of the UMA Startup.BackgroundFetchTimeInterval histogram. const char* const kUMAMobileBackgroundFetchTimeInterval =
diff --git a/ios/chrome/app/application_delegate/metrics_mediator.mm b/ios/chrome/app/application_delegate/metrics_mediator.mm index 074ff8fc2..0f0385e1 100644 --- a/ios/chrome/app/application_delegate/metrics_mediator.mm +++ b/ios/chrome/app/application_delegate/metrics_mediator.mm
@@ -4,7 +4,6 @@ #import "ios/chrome/app/application_delegate/metrics_mediator.h" -#include "base/ios/weak_nsobject.h" #include "base/mac/bind_objc_block.h" #include "base/metrics/user_metrics_action.h" #include "base/strings/sys_string_conversions.h" @@ -31,6 +30,10 @@ #include "ios/web/public/web_thread.h" #include "url/gurl.h" +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + namespace { // The amount of time (in seconds) between two background fetch calls. // TODO(crbug.com/496172): Re-enable background fetch. @@ -238,18 +241,16 @@ } // If metrics are enabled, process the logs. Otherwise, just delete them. - base::mac::ScopedBlock<app_group::ProceduralBlockWithData> callback; + app_group::ProceduralBlockWithData callback; if (enabled) { - callback.reset( - ^(NSData* log_content) { - std::string log(static_cast<const char*>([log_content bytes]), - static_cast<size_t>([log_content length])); - web::WebThread::PostTask(web::WebThread::UI, FROM_HERE, - base::BindBlock(^{ - metrics->PushExternalLog(log); - })); - }, - base::scoped_policy::RETAIN); + callback = [^(NSData* log_content) { + std::string log(static_cast<const char*>([log_content bytes]), + static_cast<size_t>([log_content length])); + web::WebThread::PostTask(web::WebThread::UI, FROM_HERE, + base::BindBlockArc(^{ + metrics->PushExternalLog(log); + })); + } copy]; } web::WebThread::PostTask(
diff --git a/ios/chrome/app/application_delegate/url_opener.mm b/ios/chrome/app/application_delegate/url_opener.mm index 718d470..2f48018 100644 --- a/ios/chrome/app/application_delegate/url_opener.mm +++ b/ios/chrome/app/application_delegate/url_opener.mm
@@ -6,14 +6,16 @@ #import <Foundation/Foundation.h> -#import "base/ios/weak_nsobject.h" -#import "base/mac/scoped_nsobject.h" #include "base/metrics/histogram_macros.h" #import "ios/chrome/app/application_delegate/app_state.h" #import "ios/chrome/app/application_delegate/startup_information.h" #import "ios/chrome/app/application_delegate/tab_opening.h" #include "ios/chrome/app/chrome_app_startup_parameters.h" +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + namespace { // Key of the UMA Startup.MobileSessionStartFromApps histogram. const char* const kUMAMobileSessionStartFromAppsHistogram = @@ -36,10 +38,9 @@ startupInformation:(id<StartupInformation>)startupInformation { NSString* sourceApplication = options[UIApplicationOpenURLOptionsSourceApplicationKey]; - base::scoped_nsobject<ChromeAppStartupParameters> params( - [ChromeAppStartupParameters - newChromeAppStartupParametersWithURL:url - fromSourceApplication:sourceApplication]); + ChromeAppStartupParameters* params = [ChromeAppStartupParameters + newChromeAppStartupParametersWithURL:url + fromSourceApplication:sourceApplication]; MobileSessionCallerApp callerApp = [params callerApp];
diff --git a/ios/chrome/app/application_delegate/user_activity_handler.mm b/ios/chrome/app/application_delegate/user_activity_handler.mm index 6b3b9e8c..5d6a9909 100644 --- a/ios/chrome/app/application_delegate/user_activity_handler.mm +++ b/ios/chrome/app/application_delegate/user_activity_handler.mm
@@ -9,7 +9,6 @@ #include "base/ios/block_types.h" #include "base/ios/ios_util.h" -#include "base/ios/weak_nsobject.h" #include "base/mac/foundation_util.h" #include "base/metrics/histogram_macros.h" #include "base/metrics/user_metrics_action.h" @@ -32,6 +31,10 @@ #include "ui/base/page_transition_types.h" #include "url/gurl.h" +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + using base::UserMetricsAction; namespace { @@ -76,8 +79,8 @@ // at this time is opening a New Tab Page. GURL newTabURL(kChromeUINewTabURL); webpageURL = net::NSURLWithGURL(newTabURL); - base::scoped_nsobject<AppStartupParameters> startupParams( - [[AppStartupParameters alloc] initWithExternalURL:newTabURL]); + AppStartupParameters* startupParams = + [[AppStartupParameters alloc] initWithExternalURL:newTabURL]; [startupInformation setStartupParameters:startupParams]; base::RecordAction(base::UserMetricsAction("IOSLaunchedByUniversalLink")); } else if (spotlight::IsSpotlightAvailable() && @@ -101,9 +104,8 @@ if (domain == spotlight::DOMAIN_ACTIONS) { webpageURL = [NSURL URLWithString:base::SysUTF8ToNSString(kChromeUINewTabURL)]; - base::scoped_nsobject<AppStartupParameters> startupParams( - [[AppStartupParameters alloc] - initWithExternalURL:GURL(kChromeUINewTabURL)]); + AppStartupParameters* startupParams = [[AppStartupParameters alloc] + initWithExternalURL:GURL(kChromeUINewTabURL)]; BOOL startupParamsSet = spotlight::SetStartupParametersForSpotlightAction( itemID, startupParams); if (!startupParamsSet) { @@ -174,8 +176,8 @@ [startupInformation resetFirstUserActionRecorder]; if (![startupInformation startupParameters]) { - base::scoped_nsobject<AppStartupParameters> startupParams( - [[AppStartupParameters alloc] initWithExternalURL:webpageGURL]); + AppStartupParameters* startupParams = + [[AppStartupParameters alloc] initWithExternalURL:webpageGURL]; [startupInformation setStartupParameters:startupParams]; } return YES; @@ -256,9 +258,8 @@ if ([startupInformation isPresentingFirstRunUI]) return NO; - base::scoped_nsobject<AppStartupParameters> startupParams( - [[AppStartupParameters alloc] - initWithExternalURL:GURL(kChromeUINewTabURL)]); + AppStartupParameters* startupParams = [[AppStartupParameters alloc] + initWithExternalURL:GURL(kChromeUINewTabURL)]; if ([shortcutItem.type isEqualToString:kShortcutNewTab]) { base::RecordAction(UserMetricsAction("ApplicationShortcut.NewTabPressed"));
diff --git a/ios/chrome/browser/DEPS b/ios/chrome/browser/DEPS index 5d7aca8..ceb3045 100644 --- a/ios/chrome/browser/DEPS +++ b/ios/chrome/browser/DEPS
@@ -93,6 +93,7 @@ "+ios/net", "+ios/public/provider/chrome", "+ios/public/provider/components", + "+ios/shared/chrome/browser", "+ios/web/public", "+libxml/xmlwriter.h", "+net",
diff --git a/ios/chrome/browser/ui/browser_view_controller.mm b/ios/chrome/browser/ui/browser_view_controller.mm index 31d9288..af75824e2 100644 --- a/ios/chrome/browser/ui/browser_view_controller.mm +++ b/ios/chrome/browser/ui/browser_view_controller.mm
@@ -161,7 +161,6 @@ #include "ios/public/provider/chrome/browser/voice/voice_search_controller.h" #include "ios/public/provider/chrome/browser/voice/voice_search_controller_delegate.h" #include "ios/public/provider/chrome/browser/voice/voice_search_provider.h" -#import "ios/third_party/material_components_ios/src/components/Snackbar/src/MaterialSnackbar.h" #import "ios/web/navigation/crw_session_controller.h" #import "ios/web/navigation/crw_session_entry.h" #include "ios/web/navigation/navigation_manager_impl.h" @@ -288,8 +287,6 @@ // they are added to the tab model. NSString* const kNativeControllerTemporaryKey = @"NativeControllerTemporaryKey"; -NSString* const kReadingListSnackbarCategory = @"ReadingListSnackbarCategory"; - } // anonymous namespace @interface BrowserViewController ()<AppRatingPromptDelegate, @@ -3504,12 +3501,8 @@ readingModel->AddEntry(URL, base::SysNSStringToUTF8(title), reading_list::ADDED_VIA_CURRENT_APP); - NSString* snackBarMessage = - l10n_util::GetNSString(IDS_IOS_READING_LIST_SNACKBAR_MESSAGE); - MDCSnackbarMessage* message = - [MDCSnackbarMessage messageWithText:snackBarMessage]; - message.category = kReadingListSnackbarCategory; - [MDCSnackbarManager showMessage:message]; + [self showSnackbar:l10n_util::GetNSString( + IDS_IOS_READING_LIST_SNACKBAR_MESSAGE)]; } #pragma mark - Keyboard commands management
diff --git a/ios/chrome/browser/ui/contextual_search/BUILD.gn b/ios/chrome/browser/ui/contextual_search/BUILD.gn index e251d1e3..bc3cd07 100644 --- a/ios/chrome/browser/ui/contextual_search/BUILD.gn +++ b/ios/chrome/browser/ui/contextual_search/BUILD.gn
@@ -32,6 +32,7 @@ } source_set("contextual_search") { + configs += [ "//build/config/compiler:enable_arc" ] sources = [ "contextual_search_context.cc", "contextual_search_context.h",
diff --git a/ios/chrome/browser/ui/contextual_search/contextual_search_controller.h b/ios/chrome/browser/ui/contextual_search/contextual_search_controller.h index 5b30b3ce..4576353 100644 --- a/ios/chrome/browser/ui/contextual_search/contextual_search_controller.h +++ b/ios/chrome/browser/ui/contextual_search/contextual_search_controller.h
@@ -89,7 +89,7 @@ // the old panel and its views. // This property can only be assigned a non-nil value, and can only be assigned // a value when its current value is nil. -@property(nonatomic, assign) ContextualSearchPanelView* panel; +@property(nonatomic, weak) ContextualSearchPanelView* panel; // Designated initializer. - (instancetype)initWithBrowserState:(ios::ChromeBrowserState*)browserState
diff --git a/ios/chrome/browser/ui/contextual_search/contextual_search_controller.mm b/ios/chrome/browser/ui/contextual_search/contextual_search_controller.mm index 39bc9d8..9bc3956 100644 --- a/ios/chrome/browser/ui/contextual_search/contextual_search_controller.mm +++ b/ios/chrome/browser/ui/contextual_search/contextual_search_controller.mm
@@ -8,13 +8,11 @@ #include <utility> #include "base/ios/ios_util.h" -#import "base/ios/weak_nsobject.h" #include "base/json/json_reader.h" #include "base/logging.h" #import "base/mac/bind_objc_block.h" #include "base/mac/foundation_util.h" #include "base/mac/scoped_block.h" -#include "base/mac/scoped_nsobject.h" #include "base/strings/sys_string_conversions.h" #include "base/strings/utf_string_conversions.h" #include "base/time/time.h" @@ -61,6 +59,10 @@ // Returns |value| clamped so that min <= value <= max #define CLAMP(min, value, max) MAX(min, MIN(value, max)) +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + namespace { // command prefix for injected JavaScript. const std::string kCommandPrefix = "contextualSearch"; @@ -124,7 +126,7 @@ NSArray* StringValueToRectArray(const std::string& list) { NSString* nsList = base::SysUTF8ToNSString(list); - NSMutableArray* rectsArray = [[[NSMutableArray alloc] init] autorelease]; + NSMutableArray* rectsArray = [[NSMutableArray alloc] init]; NSArray* items = [nsList componentsSeparatedByString:@","]; for (NSString* item : items) { CGRect rect = StringValueToRect(item); @@ -151,11 +153,11 @@ TouchToSearchPermissionsChangeAudience> // Controller delegate for the controller to call back to. -@property(nonatomic, readwrite, assign) id<ContextualSearchControllerDelegate> +@property(nonatomic, readwrite, weak) id<ContextualSearchControllerDelegate> controllerDelegate; // Permissions interface for this feature. Property is readwrite for testing. -@property(nonatomic, readwrite, retain) +@property(nonatomic, readwrite, strong) TouchToSearchPermissionsMediator* permissions; // Synchronous method executed by -asynchronouslyEnableContextualSearch: @@ -243,13 +245,13 @@ @implementation ContextualSearchController { // Permissions interface for this feature. - base::scoped_nsobject<TouchToSearchPermissionsMediator> _permissions; + TouchToSearchPermissionsMediator* _permissions; // WebState for the tab this object is attached to. web::WebState* _webState; // Access to the web view from |_webState|. - base::scoped_nsprotocol<id<CRWWebViewProxy>> _webViewProxy; + id<CRWWebViewProxy> _webViewProxy; // Observer for |_webState|. std::unique_ptr<ContextualSearchWebStateObserver> _webStateObserver; @@ -258,22 +260,22 @@ std::unique_ptr<ContextualSearchWebStateObserver> _searchTabWebStateObserver; // Object that manages find_in_page.js injection into the web view. - base::WeakNSObject<JsContextualSearchManager> _contextualSearchJsManager; + __weak JsContextualSearchManager* _contextualSearchJsManager; // Gesture reccognizer for contextual search taps. - base::scoped_nsobject<UITapGestureRecognizer> _tapRecognizer; + UITapGestureRecognizer* _tapRecognizer; // Gesture reccognizer for double tap. It is used to prevent |_tapRecognizer| // from firing if there is a double tap on the web view. It is disabled when // the panel is displayed, since any tap will dismiss the panel in that case. - base::scoped_nsobject<UITapGestureRecognizer> _doubleTapRecognizer; + UITapGestureRecognizer* _doubleTapRecognizer; // Gesture recognizer for long-tap copy. - base::scoped_nsobject<UILongPressGestureRecognizer> _copyGestureRecognizer; + UILongPressGestureRecognizer* _copyGestureRecognizer; // Gesture recognizer to detect taps outside of the CS interface that would // cause it to dismiss. - base::scoped_nsobject<WindowGestureObserver> _dismissRecognizer; + WindowGestureObserver* _dismissRecognizer; // Context information retrieved from a search tap. std::shared_ptr<ContextualSearchContext> _searchContext; @@ -286,22 +288,22 @@ // The panel view controlled by this object; it is created externally and // owned by its superview. There is no guarantee about its lifetime. - base::WeakNSObject<ContextualSearchPanelView> _panelView; + __weak ContextualSearchPanelView* _panelView; // The view containing the highlighting of the search terms. - base::WeakNSObject<ContextualSearchHighlighterView> _contextualHighlightView; + __weak ContextualSearchHighlighterView* _contextualHighlightView; // Content view displayed in the peeking section of the panel. - base::scoped_nsobject<ContextualSearchHeaderView> _headerView; + ContextualSearchHeaderView* _headerView; // Vertical constraints for layout of the search tab. - base::scoped_nsobject<NSArray> _searchTabVerticalConstraints; + NSArray* _searchTabVerticalConstraints; // Container view for the opt-out promo and the search tab view. - base::scoped_nsobject<ContextualSearchResultsView> _searchResultsView; + ContextualSearchResultsView* _searchResultsView; // View for the opt-out promo. - base::scoped_nsobject<ContextualSearchPromoView> _promoView; + ContextualSearchPromoView* _promoView; // The tab that should be used as the opener for the search tab. Tab* _opener; @@ -377,7 +379,7 @@ BOOL _preventScrollToShowSelection; // The time of the last dismiss. - base::scoped_nsobject<NSDate> _lastDismiss; + NSDate* _lastDismiss; } @synthesize enabled = _enabled; @@ -388,8 +390,8 @@ delegate:(id<ContextualSearchControllerDelegate>) delegate { if ((self = [super init])) { - _permissions.reset([[TouchToSearchPermissionsMediator alloc] - initWithBrowserState:browserState]); + _permissions = [[TouchToSearchPermissionsMediator alloc] + initWithBrowserState:browserState]; [_permissions setAudience:self]; self.controllerDelegate = delegate; @@ -398,12 +400,12 @@ // but it will observe and un-observe the web tabs as it changes over time. _webStateObserver.reset(new ContextualSearchWebStateObserver(self)); - _copyGestureRecognizer.reset([[UILongPressGestureRecognizer alloc] + _copyGestureRecognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self - action:@selector(handleLongPressFrom:)]); + action:@selector(handleLongPressFrom:)]; - base::WeakNSObject<ContextualSearchController> weakself(self); - auto callback = base::BindBlock( + __weak ContextualSearchController* weakself = self; + auto callback = base::BindBlockArc( ^(ContextualSearchDelegate::SearchResolution resolution) { [weakself updateForResolvedSearch:resolution]; }); @@ -418,7 +420,7 @@ } - (void)setPermissions:(TouchToSearchPermissionsMediator*)permissions { - _permissions.reset(permissions); + _permissions = permissions; } - (ContextualSearchPanelView*)panel { @@ -430,28 +432,28 @@ DCHECK(panel); // Save the new panel, set up observation and delegation relationships. - _panelView.reset(panel); + _panelView = panel; [_panelView addMotionObserver:self]; [_dismissRecognizer setViewToExclude:_panelView]; // Create new subviews. NSMutableArray* panelContents = [NSMutableArray arrayWithCapacity:3]; - _headerView.reset([[ContextualSearchHeaderView alloc] - initWithHeight:[_panelView configuration].peekingHeight]); + _headerView = [[ContextualSearchHeaderView alloc] + initWithHeight:[_panelView configuration].peekingHeight]; [_headerView addGestureRecognizer:_copyGestureRecognizer]; [_headerView setTapHandler:self]; [panelContents addObject:_headerView]; if (self.permissions.preferenceState == TouchToSearch::UNDECIDED) { - _promoView.reset([[ContextualSearchPromoView alloc] initWithFrame:CGRectZero - delegate:self]); + _promoView = [[ContextualSearchPromoView alloc] initWithFrame:CGRectZero + delegate:self]; [panelContents addObject:_promoView]; } - _searchResultsView.reset( - [[ContextualSearchResultsView alloc] initWithFrame:CGRectZero]); + _searchResultsView = + [[ContextualSearchResultsView alloc] initWithFrame:CGRectZero]; [_searchResultsView setPromoter:self]; [_searchResultsView setPreloadChecker:self]; [panelContents addObject:_searchResultsView]; @@ -463,7 +465,7 @@ // Asynchronously enables contextual search, so that some preferences // (UIAccessibilityIsVoiceOverRunning(), for example) have time to synchronize // with their own notifications. - base::WeakNSObject<ContextualSearchController> weakSelf(self); + __weak ContextualSearchController* weakSelf = self; dispatch_async(dispatch_get_main_queue(), ^{ [weakSelf doEnableContextualSearch:enabled]; }); @@ -486,7 +488,7 @@ if (_webViewProxy) { [[_webViewProxy scrollViewProxy] removeObserver:self]; } - _webViewProxy.reset([webViewProxy retain]); + _webViewProxy = webViewProxy; if (_webViewProxy) { [[_webViewProxy scrollViewProxy] addObserver:self]; } @@ -500,9 +502,9 @@ - (void)setWebState:(web::WebState*)webState { [self disconnectWebState]; if (webState) { - _contextualSearchJsManager.reset(static_cast<JsContextualSearchManager*>( + _contextualSearchJsManager = static_cast<JsContextualSearchManager*>( [webState->GetJSInjectionReceiver() - instanceOfClass:[JsContextualSearchManager class]])); + instanceOfClass:[JsContextualSearchManager class]]); _webState = webState; _webStateObserver->ObserveWebState(webState); [self updateWebViewProxy:webState->GetWebViewProxy()]; @@ -519,12 +521,11 @@ if (!_webStateEnabled) { DOMAlteringLock::CreateForWebState([self webState]); - base::WeakNSObject<ContextualSearchController> weakSelf(self); - auto callback = - base::BindBlock(^bool(const base::DictionaryValue& JSON, - const GURL& originURL, bool userIsInteracting) { - base::scoped_nsobject<ContextualSearchController> strongSelf( - [weakSelf retain]); + __weak ContextualSearchController* weakSelf = self; + auto callback = base::BindBlockArc( + ^bool(const base::DictionaryValue& JSON, const GURL& originURL, + bool userIsInteracting) { + ContextualSearchController* strongSelf = weakSelf; // |originURL| and |isInteracting| aren't used. return [strongSelf handleScriptCommand:JSON]; }); @@ -532,16 +533,16 @@ // |_doubleTapRecognizer| should be added to the web view before // |_tapRecognizer| so |_tapRecognizer| can require it to fail. - _doubleTapRecognizer.reset([[UITapGestureRecognizer alloc] - initWithTarget:self - action:@selector(ignoreTap:)]); + _doubleTapRecognizer = + [[UITapGestureRecognizer alloc] initWithTarget:self + action:@selector(ignoreTap:)]; [_doubleTapRecognizer setDelegate:self]; [_doubleTapRecognizer setNumberOfTapsRequired:2]; [_webViewProxy addGestureRecognizer:_doubleTapRecognizer]; - _tapRecognizer.reset([[UITapGestureRecognizer alloc] + _tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self - action:@selector(handleTapFrom:)]); + action:@selector(handleTapFrom:)]; [_tapRecognizer setDelegate:self]; [_webViewProxy addGestureRecognizer:_tapRecognizer]; @@ -584,7 +585,7 @@ - (void)disconnectWebState { if (_webState) { - _contextualSearchJsManager.reset(); + _contextualSearchJsManager = nil; _webStateObserver->ObserveWebState(nullptr); [self updateWebViewProxy:nil]; [self disableCurrentWebState]; @@ -595,9 +596,9 @@ if (!_panelView) return; if (!_dismissRecognizer) { - _dismissRecognizer.reset([[WindowGestureObserver alloc] + _dismissRecognizer = [[WindowGestureObserver alloc] initWithTarget:self - action:@selector(handleWindowGesture:)]); + action:@selector(handleWindowGesture:)]; [_dismissRecognizer setViewToExclude:_panelView]; [[_panelView window] addGestureRecognizer:_dismissRecognizer]; } @@ -616,11 +617,10 @@ - (void)dealloc { [self close]; - [super dealloc]; } - (void)handleWindowGesture:(UIGestureRecognizer*)recognizer { - DCHECK(recognizer == _dismissRecognizer.get()); + DCHECK(recognizer == _dismissRecognizer); [self dismissPane:ContextualSearch::BASE_PAGE_TAP]; } @@ -706,7 +706,7 @@ bool selectionValid; if (!JSONCommand.GetBoolean("valid", &selectionValid)) selectionValid = true; - base::WeakNSObject<ContextualSearchController> weakSelf(self); + __weak ContextualSearchController* weakSelf = self; ProceduralBlockWithBool lockAction = ^(BOOL lockAcquired) { if (lockAcquired) { [weakSelf handleSelectionChanged:selectedText @@ -732,7 +732,7 @@ } - (void)handleTapFrom:(UIGestureRecognizer*)recognizer { - DCHECK(recognizer == _tapRecognizer.get()); + DCHECK(recognizer == _tapRecognizer); // Taps will be triggered by long-presses to make a selection in the webview, // as well as 'regular' taps. Long-presses that create a selection will set // |_newSelectionDisplaying| as well as populating _selectedText (this happens @@ -774,7 +774,7 @@ dispatch_time_t dispatch = dispatch_time( DISPATCH_TIME_NOW, static_cast<int64_t>(kDOMModificationDelaySeconds * NSEC_PER_SEC)); - base::WeakNSObject<ContextualSearchController> weakSelf(self); + __weak ContextualSearchController* weakSelf = self; dispatch_after(dispatch, dispatch_get_main_queue(), ^{ [weakSelf handleTapAtPoint:tapPoint]; }); @@ -783,7 +783,7 @@ } - (void)handleLongPressFrom:(UIGestureRecognizer*)recognizer { - DCHECK(recognizer == _copyGestureRecognizer.get()); + DCHECK(recognizer == _copyGestureRecognizer); if (recognizer.state != UIGestureRecognizerStateEnded) return; @@ -827,8 +827,7 @@ relativeTapPoint.x /= contentSize.width; relativeTapPoint.y /= contentSize.height; - base::WeakNSProtocol<id<CRWWebViewProxy>> weakWebViewProxy( - _webViewProxy.get()); + __weak id<CRWWebViewProxy> weakWebViewProxy = _webViewProxy; void (^handler)(NSString*) = ^(NSString* result) { [_tapRecognizer setEnabled:YES]; // If there has been an error in the javascript, return can be nil. @@ -1022,7 +1021,7 @@ animated:[_panelView state] != ContextualSearch::DISMISSED]; if (_resolvedSearch.start_offset != -1 && _resolvedSearch.end_offset != -1) { - base::WeakNSObject<ContextualSearchController> weakSelf(self); + __weak ContextualSearchController* weakSelf = self; [_contextualSearchJsManager expandHighlightToStartOffset:_resolvedSearch.start_offset endOffset:_resolvedSearch.end_offset @@ -1076,7 +1075,7 @@ - (void)scrollToShowSelection:(CRWWebViewScrollViewProxy*)scrollView { if (!scrollView || _preventScrollToShowSelection) return; - if (!_contextualHighlightView.get()) { + if (!_contextualHighlightView) { return; } CGRect highlightBoundingRect = [_contextualHighlightView boundingRect]; @@ -1164,13 +1163,12 @@ if (![self webState]) { return; } - if (!_contextualHighlightView.get() && [rects count]) { + if (!_contextualHighlightView && [rects count]) { CGRect frame = [[self webState]->GetWebViewProxy() frame]; ContextualSearchHighlighterView* highlightView = - [[[ContextualSearchHighlighterView alloc] initWithFrame:frame - delegate:self] - autorelease]; - _contextualHighlightView.reset(highlightView); + [[ContextualSearchHighlighterView alloc] initWithFrame:frame + delegate:self]; + _contextualHighlightView = highlightView; [[self webState]->GetWebViewProxy() addSubview:highlightView]; } CGPoint scroll = [[_webViewProxy scrollViewProxy] contentOffset]; @@ -1213,7 +1211,7 @@ [[_panelView window] removeGestureRecognizer:_dismissRecognizer]; _delegate.reset(); [_searchResultsView setActive:NO]; - _searchResultsView.reset(); + _searchResultsView = nil; } #pragma mark - Promo view management @@ -1289,7 +1287,7 @@ - (void)panelWillPromote:(ContextualSearchPanelView*)panel { DCHECK(panel == _panelView); [panel removeMotionObserver:self]; - _panelView.reset(); + _panelView = nil; [self setState:ContextualSearch::DISMISSED reason:ContextualSearch::TAB_PROMOTION]; } @@ -1423,7 +1421,7 @@ - (void)cleanUpWebStateForDismissWithCompletion: (ProceduralBlock)completionHandler { - _lastDismiss.reset([[NSDate date] retain]); + _lastDismiss = [NSDate date]; _currentTapCancelled = YES; ContextualSearch::PanelState originalState = [_panelView state]; if (originalState == ContextualSearch::DISMISSED) { @@ -1448,10 +1446,10 @@ ContextualSearchDelegate::SearchResolution blank; _resolvedSearch = blank; if (completionHandler) { - base::WeakNSObject<ContextualSearchController> weakSelf(self); + __weak ContextualSearchController* weakSelf = self; ProceduralBlock javaScriptCompletion = ^{ - if ([self webState]) { - DOMAlteringLock::FromWebState([self webState])->Release(self); + if ([weakSelf webState]) { + DOMAlteringLock::FromWebState([weakSelf webState])->Release(weakSelf); completionHandler(); } }; @@ -1520,9 +1518,8 @@ } - (void)promoViewSettingsTapped { - base::scoped_nsobject<GenericChromeCommand> command( - [[GenericChromeCommand alloc] - initWithTag:IDC_SHOW_CONTEXTUAL_SEARCH_SETTINGS]); + GenericChromeCommand* command = [[GenericChromeCommand alloc] + initWithTag:IDC_SHOW_CONTEXTUAL_SEARCH_SETTINGS]; UIWindow* main_window = [[UIApplication sharedApplication] keyWindow]; [main_window chromeExecuteCommand:command]; } @@ -1550,8 +1547,8 @@ - (BOOL)gestureRecognizer:(UIGestureRecognizer*)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer: (UIGestureRecognizer*)otherGestureRecognizer { - return gestureRecognizer == _tapRecognizer.get() || - gestureRecognizer == _doubleTapRecognizer.get(); + return gestureRecognizer == _tapRecognizer || + gestureRecognizer == _doubleTapRecognizer; } #pragma mark - CRWWebViewScrollViewObserver methods @@ -1623,7 +1620,7 @@ #pragma mark - ContextualSearchHighlighterDelegate methods - (void)updateHighlight { - base::WeakNSObject<ContextualSearchController> weakSelf(self); + __weak ContextualSearchController* weakSelf = self; [_contextualSearchJsManager highlightRectsWithCompletionHandler:^void(id result, NSError* error) { [weakSelf handleHighlightJSResult:result withError:error];
diff --git a/ios/chrome/browser/ui/contextual_search/contextual_search_header_view.h b/ios/chrome/browser/ui/contextual_search/contextual_search_header_view.h index de0c7d7..ecc31896 100644 --- a/ios/chrome/browser/ui/contextual_search/contextual_search_header_view.h +++ b/ios/chrome/browser/ui/contextual_search/contextual_search_header_view.h
@@ -12,7 +12,7 @@ @interface ContextualSearchHeaderView : UIView<ContextualSearchPanelMotionObserver> -@property(nonatomic, assign) id<ContextualSearchPanelTapHandler> tapHandler; +@property(nonatomic, weak) id<ContextualSearchPanelTapHandler> tapHandler; - (instancetype)initWithHeight:(CGFloat)height NS_DESIGNATED_INITIALIZER;
diff --git a/ios/chrome/browser/ui/contextual_search/contextual_search_header_view.mm b/ios/chrome/browser/ui/contextual_search/contextual_search_header_view.mm index f156b86..5656d85c 100644 --- a/ios/chrome/browser/ui/contextual_search/contextual_search_header_view.mm +++ b/ios/chrome/browser/ui/contextual_search/contextual_search_header_view.mm
@@ -4,10 +4,8 @@ #import "ios/chrome/browser/ui/contextual_search/contextual_search_header_view.h" -#import "base/ios/weak_nsobject.h" #include "base/logging.h" #include "base/mac/scoped_cftyperef.h" -#include "base/mac/scoped_nsobject.h" #import "ios/chrome/browser/ui/contextual_search/contextual_search_panel_view.h" #import "ios/chrome/browser/ui/uikit_ui_util.h" #import "ios/chrome/common/material_timing.h" @@ -16,6 +14,10 @@ #include "ios/public/provider/chrome/browser/images/branded_image_provider.h" #import "ios/third_party/material_components_ios/src/components/Typography/src/MaterialTypography.h" +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + namespace { const CGFloat kHorizontalMargin = 24.0; const CGFloat kHorizontalLayoutGap = 16.0; @@ -105,8 +107,8 @@ // Label showing the text the user tapped on in the web page, and any // additional context that will be displayed. __unsafe_unretained UILabel* _textLabel; - base::WeakNSProtocol<id<ContextualSearchPanelTapHandler>> _tapHandler; - base::scoped_nsobject<UIGestureRecognizer> _tapRecognizer; + __weak id<ContextualSearchPanelTapHandler> _tapHandler; + UIGestureRecognizer* _tapRecognizer; } + (BOOL)requiresConstraintBasedLayout { @@ -122,27 +124,30 @@ self.translatesAutoresizingMaskIntoConstraints = NO; self.backgroundColor = [UIColor whiteColor]; - _tapRecognizer.reset([[UITapGestureRecognizer alloc] init]); + _tapRecognizer = [[UITapGestureRecognizer alloc] init]; [self addGestureRecognizer:_tapRecognizer]; [_tapRecognizer addTarget:self action:@selector(panelWasTapped:)]; UIImage* logoImage = ios::GetChromeBrowserProvider() ->GetBrandedImageProvider() ->GetContextualSearchHeaderImage(); - _logo = [[[IrisingImageView alloc] initWithImage:logoImage] autorelease]; + IrisingImageView* logo = [[IrisingImageView alloc] initWithImage:logoImage]; + _logo = logo; _logo.translatesAutoresizingMaskIntoConstraints = NO; _logo.iris = 0.0; - _caret = [[[UIImageView alloc] - initWithImage:[UIImage imageNamed:@"expand_less"]] autorelease]; + UIImageView* caret = + [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"expand_less"]]; + _caret = caret; _caret.translatesAutoresizingMaskIntoConstraints = NO; [_caret setContentHuggingPriority:UILayoutPriorityDefaultHigh forAxis:UILayoutConstraintAxisVertical]; [_caret setContentHuggingPriority:UILayoutPriorityDefaultHigh forAxis:UILayoutConstraintAxisHorizontal]; - _closeButton = - [[[TappableButton alloc] initWithFrame:CGRectZero] autorelease]; + TappableButton* closeButton = + [[TappableButton alloc] initWithFrame:CGRectZero]; + _closeButton = closeButton; _closeButton.translatesAutoresizingMaskIntoConstraints = NO; [_closeButton setImage:[UIImage imageNamed:@"card_close_button"] forState:UIControlStateNormal]; @@ -154,7 +159,8 @@ forAxis:UILayoutConstraintAxisHorizontal]; _closeButton.alpha = 0; - _textLabel = [[[UILabel alloc] initWithFrame:CGRectZero] autorelease]; + UILabel* textLabel = [[UILabel alloc] initWithFrame:CGRectZero]; + _textLabel = textLabel; _textLabel.translatesAutoresizingMaskIntoConstraints = NO; _textLabel.font = [MDCTypography subheadFont]; _textLabel.textAlignment = NSTextAlignmentNatural; @@ -227,7 +233,7 @@ action:@selector(closePanel) forControlEvents:UIControlEventTouchUpInside]; } - _tapHandler.reset(tapHandler); + _tapHandler = tapHandler; if (_tapHandler) { [_closeButton addTarget:_tapHandler action:@selector(closePanel) @@ -302,7 +308,7 @@ followingTextRange:(NSRange)followingTextRange animated:(BOOL)animated { NSMutableAttributedString* styledText = - [[[NSMutableAttributedString alloc] initWithString:text] autorelease]; + [[NSMutableAttributedString alloc] initWithString:text]; [styledText addAttribute:NSForegroundColorAttributeName value:[UIColor colorWithWhite:0 alpha:0.71f] range:followingTextRange];
diff --git a/ios/chrome/browser/ui/contextual_search/contextual_search_highlighter_view.mm b/ios/chrome/browser/ui/contextual_search/contextual_search_highlighter_view.mm index 7461001..bbc9ad8 100644 --- a/ios/chrome/browser/ui/contextual_search/contextual_search_highlighter_view.mm +++ b/ios/chrome/browser/ui/contextual_search/contextual_search_highlighter_view.mm
@@ -5,9 +5,12 @@ #import "ios/chrome/browser/ui/contextual_search/contextual_search_highlighter_view.h" #include "base/logging.h" -#import "base/mac/scoped_nsobject.h" #import "ios/chrome/browser/ui/contextual_search/contextual_search_controller.h" +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + @implementation ContextualSearchHighlighterView { // Store size of the container view. If size change, text layout will likely // change and should be updated. @@ -18,7 +21,7 @@ CGFloat _zoom; CGFloat _offset; - __unsafe_unretained id<ContextualSearchHighlighterDelegate> _delegate; + __weak id<ContextualSearchHighlighterDelegate> _delegate; } - (instancetype)initWithFrame:(CGRect)frame @@ -70,7 +73,7 @@ rect.size.height *= zoom; rect.origin.x -= scroll.x; rect.origin.y += offset - scroll.y; - UIView* view = [[[UIView alloc] initWithFrame:rect] autorelease]; + UIView* view = [[UIView alloc] initWithFrame:rect]; [self addSubview:view]; view.backgroundColor = [UIColor colorWithRed:0.67 green:0.88 blue:0.96 alpha:0.6];
diff --git a/ios/chrome/browser/ui/contextual_search/contextual_search_mask_view.mm b/ios/chrome/browser/ui/contextual_search/contextual_search_mask_view.mm index 23592c6..e9651ec7 100644 --- a/ios/chrome/browser/ui/contextual_search/contextual_search_mask_view.mm +++ b/ios/chrome/browser/ui/contextual_search/contextual_search_mask_view.mm
@@ -11,6 +11,10 @@ // Linearly map |delta| in the range [0, 1] to a value in [min, max]. #define LERP(min, max, delta) (min * (1 - delta) + max * delta) +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + namespace { const CGFloat kPhoneMaskLimit = 1.0; const CGFloat kPadMaskLimit = 0.8;
diff --git a/ios/chrome/browser/ui/contextual_search/contextual_search_metrics.mm b/ios/chrome/browser/ui/contextual_search/contextual_search_metrics.mm index 0dd4438..f875c3d6 100644 --- a/ios/chrome/browser/ui/contextual_search/contextual_search_metrics.mm +++ b/ios/chrome/browser/ui/contextual_search/contextual_search_metrics.mm
@@ -10,6 +10,10 @@ #include "base/metrics/user_metrics.h" #include "base/time/time.h" +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + using ContextualSearch::PanelState; using ContextualSearch::StateChangeReason;
diff --git a/ios/chrome/browser/ui/contextual_search/contextual_search_panel_view.h b/ios/chrome/browser/ui/contextual_search/contextual_search_panel_view.h index 5299df0..e0e82b40 100644 --- a/ios/chrome/browser/ui/contextual_search/contextual_search_panel_view.h +++ b/ios/chrome/browser/ui/contextual_search/contextual_search_panel_view.h
@@ -21,7 +21,7 @@ @property(nonatomic, assign) ContextualSearch::PanelState state; // Panel configuration, for motion observers that want to do different // computations around panel state and position. -@property(nonatomic, readonly) PanelConfiguration* configuration; +@property(nonatomic, strong, readonly) PanelConfiguration* configuration; // Create a panel view. It will need to have a delegate and controller assigned // to do anything useful.
diff --git a/ios/chrome/browser/ui/contextual_search/contextual_search_panel_view.mm b/ios/chrome/browser/ui/contextual_search/contextual_search_panel_view.mm index 1b556aa99..ad94baa 100644 --- a/ios/chrome/browser/ui/contextual_search/contextual_search_panel_view.mm +++ b/ios/chrome/browser/ui/contextual_search/contextual_search_panel_view.mm
@@ -5,10 +5,7 @@ #import "ios/chrome/browser/ui/contextual_search/contextual_search_panel_view.h" #import "base/ios/crb_protocol_observers.h" -#include "base/ios/weak_nsobject.h" #include "base/logging.h" -#include "base/mac/scoped_block.h" -#include "base/mac/scoped_nsobject.h" #import "ios/chrome/browser/procedural_block_types.h" #import "ios/chrome/browser/ui/contextual_search/contextual_search_panel_protocols.h" #import "ios/chrome/browser/ui/uikit_ui_util.h" @@ -16,6 +13,10 @@ #import "ios/third_party/material_components_ios/src/components/ShadowElevations/src/MaterialShadowElevations.h" #import "ios/third_party/material_components_ios/src/components/ShadowLayer/src/MaterialShadowLayer.h" +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + namespace { // Animation timings. @@ -42,12 +43,13 @@ // that motion will not cause the panel to move, but if the scrolling reaches // the end of its possible range, the gesture will then start dragging the // panel. -@property(nonatomic, assign) +@property(nonatomic, weak) UIView<ContextualSearchPanelScrollSynchronizer>* scrollSynchronizer; // Private readonly property to be used by weak pointers to |self| for non- // retaining access to the underlying ivar in blocks. -@property(nonatomic, readonly) ContextualSearchPanelObservers* observers; +@property(nonatomic, strong, readonly) + ContextualSearchPanelObservers* observers; // Utility to generate a PanelMotion struct for the panel's current position. - (ContextualSearch::PanelMotion)motion; @@ -58,26 +60,19 @@ // Constraints that define the size of this view. These will be cleared and // regenerated when the horizontal size class changes. - base::scoped_nsobject<NSArray> _sizingConstraints; + NSArray* _sizingConstraints; CGPoint _draggingStartPosition; CGPoint _scrolledOffset; - base::scoped_nsobject<UIPanGestureRecognizer> _dragRecognizer; - - base::scoped_nsobject<ContextualSearchPanelObservers> _observers; - - base::scoped_nsobject<PanelConfiguration> _configuration; - - base::WeakNSProtocol<id<ContextualSearchPanelScrollSynchronizer>> - _scrollSynchronizer; + UIPanGestureRecognizer* _dragRecognizer; // Guide that's used to position this view. - base::WeakNSObject<UILayoutGuide> _positioningGuide; + __weak UILayoutGuide* _positioningGuide; // Constraint that sets the size of |_positioningView| so this view is // positioned correctly for its state. - base::WeakNSObject<NSLayoutConstraint> _positioningViewConstraint; + __weak NSLayoutConstraint* _positioningViewConstraint; // Other constraints that determine the position of this view. - base::scoped_nsobject<NSArray> _positioningConstraints; + NSArray* _positioningConstraints; // Promotion state variables. BOOL _resizingForPromotion; @@ -93,6 +88,9 @@ } @synthesize state = _state; +@synthesize scrollSynchronizer = _scrollSynchronizer; +@synthesize configuration = _configuration; +@synthesize observers = _observers; + (BOOL)requiresConstraintBasedLayout { return YES; @@ -102,27 +100,26 @@ - (instancetype)initWithConfiguration:(PanelConfiguration*)configuration { if ((self = [super initWithFrame:CGRectZero])) { - _configuration.reset([configuration retain]); + _configuration = configuration; _state = ContextualSearch::DISMISSED; self.translatesAutoresizingMaskIntoConstraints = NO; self.backgroundColor = [UIColor whiteColor]; self.accessibilityIdentifier = @"contextualSearchPanel"; - _observers.reset([[ContextualSearchPanelObservers - observersWithProtocol:@protocol(ContextualSearchPanelMotionObserver)] - retain]); + _observers = [ContextualSearchPanelObservers + observersWithProtocol:@protocol(ContextualSearchPanelMotionObserver)]; [self addMotionObserver:self]; // Add gesture recognizer. - _dragRecognizer.reset([[UIPanGestureRecognizer alloc] + _dragRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self - action:@selector(handleDragFrom:)]); + action:@selector(handleDragFrom:)]; [self addGestureRecognizer:_dragRecognizer]; [_dragRecognizer setDelegate:self]; // Set up the stack view that holds the panel content - _contents = [[[UIStackView alloc] initWithFrame:self.bounds] autorelease]; + _contents = [[UIStackView alloc] initWithFrame:self.bounds]; [self addSubview:_contents]; _contents.translatesAutoresizingMaskIntoConstraints = NO; _contents.accessibilityIdentifier = @"panelContents"; @@ -197,16 +194,7 @@ #pragma mark - Public property getters/setters - (PanelConfiguration*)configuration { - return _configuration.get(); -} - -- (void)setScrollSynchronizer: - (id<ContextualSearchPanelScrollSynchronizer>)scrollSynchronizer { - _scrollSynchronizer.reset(scrollSynchronizer); -} - -- (id<ContextualSearchPanelScrollSynchronizer>)scrollSynchronizer { - return _scrollSynchronizer; + return _configuration; } - (ContextualSearchPanelObservers*)observers { @@ -218,11 +206,10 @@ return; [_positioningViewConstraint setActive:NO]; - _positioningViewConstraint.reset(); - base::WeakNSObject<ContextualSearchPanelView> weakSelf(self); + _positioningViewConstraint = nil; + __weak ContextualSearchPanelView* weakSelf = self; void (^transform)(void) = ^{ - base::scoped_nsobject<ContextualSearchPanelView> strongSelf( - [weakSelf retain]); + ContextualSearchPanelView* strongSelf = weakSelf; if (strongSelf) { [strongSelf setNeedsUpdateConstraints]; [[strongSelf superview] layoutIfNeeded]; @@ -231,15 +218,13 @@ } }; - base::mac::ScopedBlock<ProceduralBlockWithBool> completion; + ProceduralBlockWithBool completion; NSTimeInterval animationDuration; if (state == ContextualSearch::DISMISSED) { animationDuration = kDismissAnimationDuration; - completion.reset( - ^(BOOL) { - [weakSelf setHidden:YES]; - }, - base::scoped_policy::RETAIN); + completion = [^(BOOL) { + [weakSelf setHidden:YES]; + } copy]; } else { self.hidden = NO; animationDuration = kPanelAnimationDuration; @@ -282,8 +267,7 @@ if (self.traitCollection.horizontalSizeClass != UIUserInterfaceSizeClassUnspecified && !_sizingConstraints) { - _sizingConstraints.reset( - [[_configuration constraintsForSizingPanel:self] retain]); + _sizingConstraints = [_configuration constraintsForSizingPanel:self]; [NSLayoutConstraint activateConstraints:_sizingConstraints]; } // Update positioning constraints if they don't exist. @@ -296,12 +280,12 @@ ]; [NSLayoutConstraint activateConstraints:positioningConstraints]; - _positioningConstraints.reset([positioningConstraints retain]); + _positioningConstraints = positioningConstraints; } // Always update the positioning view constraint. - _positioningViewConstraint.reset([self.configuration - constraintForPositioningGuide:_positioningGuide - atState:self.state]); + _positioningViewConstraint = + [self.configuration constraintForPositioningGuide:_positioningGuide + atState:self.state]; [_positioningViewConstraint setActive:YES]; } [super updateConstraints]; @@ -312,10 +296,10 @@ return; // Set up the invisible positioning view used to constrain this view's // position. - UILayoutGuide* positioningGuide = [[[UILayoutGuide alloc] init] autorelease]; + UILayoutGuide* positioningGuide = [[UILayoutGuide alloc] init]; positioningGuide.identifier = @"contextualSearchPosition"; [self.superview addLayoutGuide:positioningGuide]; - _positioningGuide.reset(positioningGuide); + _positioningGuide = positioningGuide; [self setNeedsUpdateConstraints]; } @@ -330,7 +314,7 @@ [_configuration setHorizontalSizeClass:self.traitCollection.horizontalSizeClass]; [NSLayoutConstraint deactivateConstraints:_sizingConstraints]; - _sizingConstraints.reset(); + _sizingConstraints = nil; [self setNeedsUpdateConstraints]; } @@ -360,7 +344,6 @@ [self removeMotionObserver:self]; [self removeGestureRecognizer:_dragRecognizer]; [[_positioningGuide owningView] removeLayoutGuide:_positioningGuide]; - [super dealloc]; } #pragma mark - Gesture recognizer callbacks @@ -465,12 +448,12 @@ (UIGestureRecognizer*)otherGestureRecognizer { // Allow the drag recognizer and the panel content scroll recognizer to // co-recognize. - if (gestureRecognizer == _dragRecognizer.get() && + if (gestureRecognizer == _dragRecognizer && otherGestureRecognizer == self.scrollSynchronizer.scrollRecognizer) { return YES; } - if (gestureRecognizer == _dragRecognizer.get() && + if (gestureRecognizer == _dragRecognizer && [_dragRecognizer state] == UIGestureRecognizerStateChanged) { [gestureRecognizer setEnabled:NO]; }
diff --git a/ios/chrome/browser/ui/contextual_search/contextual_search_promo_view.mm b/ios/chrome/browser/ui/contextual_search/contextual_search_promo_view.mm index a4e91b3e..d7209692 100644 --- a/ios/chrome/browser/ui/contextual_search/contextual_search_promo_view.mm +++ b/ios/chrome/browser/ui/contextual_search/contextual_search_promo_view.mm
@@ -4,8 +4,6 @@ #import "ios/chrome/browser/ui/contextual_search/contextual_search_promo_view.h" -#include "base/ios/weak_nsobject.h" -#import "base/mac/scoped_nsobject.h" #import "ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.h" #import "ios/chrome/browser/ui/contextual_search/contextual_search_panel_view.h" #include "ios/chrome/browser/ui/uikit_ui_util.h" @@ -18,6 +16,10 @@ #include "ui/base/l10n/l10n_util.h" #include "url/gurl.h" +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + namespace { const int kMargin = 16; const int kSpaceBelowText = 32; @@ -38,12 +40,12 @@ } @interface ContextualSearchPromoView () -@property(nonatomic, assign) id<ContextualSearchPromoViewDelegate> delegate; +@property(nonatomic, weak) id<ContextualSearchPromoViewDelegate> delegate; @end @implementation ContextualSearchPromoView { - base::scoped_nsobject<LabelLinkController> _linkController; - base::scoped_nsobject<NSMutableArray> _constraints; + LabelLinkController* _linkController; + NSMutableArray* _constraints; } @synthesize disabled = _disabled; @@ -65,13 +67,13 @@ NSMutableArray* constraints = [NSMutableArray array]; // Initialize text label and its link controller. - UILabel* text = [[[UILabel alloc] initWithFrame:CGRectZero] autorelease]; - base::WeakNSObject<ContextualSearchPromoView> weakSelf(self); - _linkController.reset([[LabelLinkController alloc] + UILabel* text = [[UILabel alloc] initWithFrame:CGRectZero]; + __weak ContextualSearchPromoView* weakSelf = self; + _linkController = [[LabelLinkController alloc] initWithLabel:text action:^(const GURL& gurl) { [[weakSelf delegate] promoViewSettingsTapped]; - }]); + }]; [_linkController setLinkColor:UIColorFromRGB(kLinkColorRGB)]; // Label is as wide as the content area of the view. @@ -87,7 +89,7 @@ // Build style attributes for the label. NSMutableParagraphStyle* paragraphStyle = - [[[NSMutableParagraphStyle alloc] init] autorelease]; + [[NSMutableParagraphStyle alloc] init]; [paragraphStyle setLineBreakMode:NSLineBreakByWordWrapping]; [paragraphStyle setLineHeightMultiple:kLineSpace]; NSDictionary* attributes = @{ @@ -99,8 +101,8 @@ }; // Create and assign attributed text to label. - base::scoped_nsobject<NSMutableAttributedString> attributedText( - [[NSMutableAttributedString alloc] initWithString:textString]); + NSMutableAttributedString* attributedText = + [[NSMutableAttributedString alloc] initWithString:textString]; [attributedText setAttributes:attributes range:NSMakeRange(0, textString.length)]; text.attributedText = attributedText; @@ -113,7 +115,7 @@ // Create accept and decline buttons with dimensions defined by the // minimum height and width constants. - MDCFlatButton* acceptButton = [[[MDCFlatButton alloc] init] autorelease]; + MDCFlatButton* acceptButton = [[MDCFlatButton alloc] init]; acceptButton.hasOpaqueBackground = YES; acceptButton.inkColor = [[[MDCPalette cr_bluePalette] tint300] colorWithAlphaComponent:0.5f]; @@ -136,7 +138,7 @@ [acceptButton.titleLabel setFont:buttonFont]; UIColor* customTitleColor = [[MDCPalette cr_bluePalette] tint500]; - MDCButton* declineButton = [[[MDCFlatButton alloc] init] autorelease]; + MDCButton* declineButton = [[MDCFlatButton alloc] init]; [constraints addObjectsFromArray:@[ [declineButton.widthAnchor constraintGreaterThanOrEqualToConstant:kButtonMinWidth], @@ -153,7 +155,7 @@ // Create the divider (a simple colored view) with height defined by // |kDividerHeight| and width spanning this view's width. - UIView* divider = [[[UIView alloc] initWithFrame:CGRectZero] autorelease]; + UIView* divider = [[UIView alloc] initWithFrame:CGRectZero]; divider.backgroundColor = [UIColor colorWithWhite:0.745 alpha:1.0]; [constraints addObjectsFromArray:@[ [divider.widthAnchor constraintEqualToAnchor:self.widthAnchor], @@ -200,7 +202,7 @@ ]]; [NSLayoutConstraint activateConstraints:constraints]; - _constraints.reset([constraints retain]); + _constraints = constraints; return self; } @@ -212,7 +214,6 @@ // constraints are disabled and will not be applied even if some subviews // are lingering. [NSLayoutConstraint deactivateConstraints:_constraints]; - [super dealloc]; } - (void)setHidden:(BOOL)hidden {
diff --git a/ios/chrome/browser/ui/contextual_search/contextual_search_results_view.h b/ios/chrome/browser/ui/contextual_search/contextual_search_results_view.h index d63227e..09fd4a3 100644 --- a/ios/chrome/browser/ui/contextual_search/contextual_search_results_view.h +++ b/ios/chrome/browser/ui/contextual_search/contextual_search_results_view.h
@@ -32,11 +32,11 @@ ContextualSearchTabProvider> @property(nonatomic, assign) BOOL active; // The tab that is credited with opening the search results tab. -@property(nonatomic, assign) Tab* opener; +@property(nonatomic, weak) Tab* opener; // Object that can handle promoting the search results. -@property(nonatomic, assign) id<ContextualSearchTabPromoter> promoter; +@property(nonatomic, weak) id<ContextualSearchTabPromoter> promoter; // Object that can determine if search results can be preloaded. -@property(nonatomic, assign) id<ContextualSearchPreloadChecker> preloadChecker; +@property(nonatomic, weak) id<ContextualSearchPreloadChecker> preloadChecker; // YES if the search results have loaded and this view was visible. @property(nonatomic, readonly) BOOL contentVisible;
diff --git a/ios/chrome/browser/ui/contextual_search/contextual_search_results_view.mm b/ios/chrome/browser/ui/contextual_search/contextual_search_results_view.mm index 50ba220..92e6652 100644 --- a/ios/chrome/browser/ui/contextual_search/contextual_search_results_view.mm +++ b/ios/chrome/browser/ui/contextual_search/contextual_search_results_view.mm
@@ -6,8 +6,6 @@ #include <memory> -#import "base/ios/weak_nsobject.h" -#include "base/mac/scoped_nsobject.h" #import "ios/chrome/browser/tabs/tab.h" #import "ios/chrome/browser/ui/contextual_search/contextual_search_metrics.h" #import "ios/chrome/browser/ui/contextual_search/contextual_search_panel_view.h" @@ -19,6 +17,10 @@ #import "ios/web/public/web_state/ui/crw_native_content_provider.h" #import "ios/web/web_state/ui/crw_web_controller.h" +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + namespace { enum SearchResultsViewVisibility { OFFSCREEN, PRELOAD, VISIBLE }; } @@ -31,15 +33,13 @@ @end @implementation ContextualSearchResultsView { - base::WeakNSProtocol<id<ContextualSearchTabPromoter>> _promoter; - base::WeakNSProtocol<id<ContextualSearchPreloadChecker>> _preloadChecker; std::unique_ptr<ContextualSearchWebStateObserver> _webStateObserver; // Tab that loads the search results. - base::scoped_nsobject<Tab> _tab; + Tab* _tab; // Access to the search tab's web view proxy. - base::scoped_nsprotocol<id<CRWWebViewProxy>> _webViewProxy; + id<CRWWebViewProxy> _webViewProxy; BOOL _loaded; BOOL _displayed; @@ -58,6 +58,8 @@ @synthesize active = _active; @synthesize opener = _opener; +@synthesize promoter = _promoter; +@synthesize preloadChecker = _preloadChecker; - (instancetype)initWithFrame:(CGRect)frame { if ((self = [super initWithFrame:frame])) { @@ -89,7 +91,7 @@ } - (void)setPromoter:(id<ContextualSearchTabPromoter>)promoter { - _promoter.reset(promoter); + _promoter = promoter; } - (id<ContextualSearchPreloadChecker>)preloadChecker { @@ -97,7 +99,7 @@ } - (void)setPreloadChecker:(id<ContextualSearchPreloadChecker>)preloadChecker { - _preloadChecker.reset(preloadChecker); + _preloadChecker = preloadChecker; } - (BOOL)contentVisible { @@ -109,12 +111,12 @@ // Start watching the embedded Tab's web activity. _webStateObserver->ObserveWebState([_tab webState]); [[_tab webController] setShouldSuppressDialogs:NO]; - _webViewProxy.reset([[[_tab webController] webViewProxy] retain]); + _webViewProxy = [[_tab webController] webViewProxy]; [[_webViewProxy scrollViewProxy] setBounces:NO]; } else { // Stop watching the embedded Tab's web activity. _webStateObserver->ObserveWebState(nullptr); - _webViewProxy.reset(nil); + _webViewProxy = nil; } _active = active; @@ -148,7 +150,7 @@ opener:self.opener desktopUserAgent:false configuration:searchTabConfiguration]; - _tab.reset([tab retain]); + _tab = tab; // Don't actually start the page load yet -- that happens in -loadTab _preloadEnabled = preloadEnabled; @@ -159,7 +161,9 @@ [self disconnectTab]; // Allow the search tab to be sized by autoresizing mask again. [[_tab view] setTranslatesAutoresizingMaskIntoConstraints:YES]; - return [_tab.release() autorelease]; + Tab* tab = _tab; + _tab = nil; + return tab; } - (void)recordFinishedSearchChained:(BOOL)chained { @@ -173,7 +177,7 @@ [[_tab view] removeFromSuperview]; [[_tab webController] setNativeProvider:nil]; self.active = NO; - _webViewProxy.reset(); + _webViewProxy = nil; } - (void)cancelLoad { @@ -181,12 +185,12 @@ _loadInProgress = NO; _loaded = NO; [_tab close]; - _tab.reset(); + _tab = nil; } - (void)loadPendingSearchIfPossible { // If the search tab hasn't been created, or if it's already loaded, no-op. - if (!_tab.get() || _loadInProgress || self.active || _visibility == OFFSCREEN) + if (!_tab || _loadInProgress || self.active || _visibility == OFFSCREEN) return; // If this view is in a position where loading would be "preloading", check @@ -199,7 +203,7 @@ } - (void)loadTab { - DCHECK(_tab.get()); + DCHECK(_tab); // Start observing the search tab. self.active = YES; // TODO(crbug.com/546223): See if |_waitingForInitialSearchTabLoad| and
diff --git a/ios/chrome/browser/ui/contextual_search/contextual_search_web_state_observer.mm b/ios/chrome/browser/ui/contextual_search/contextual_search_web_state_observer.mm index 6b4595d6..ad23ed5 100644 --- a/ios/chrome/browser/ui/contextual_search/contextual_search_web_state_observer.mm +++ b/ios/chrome/browser/ui/contextual_search/contextual_search_web_state_observer.mm
@@ -4,6 +4,10 @@ #include "ios/chrome/browser/ui/contextual_search/contextual_search_web_state_observer.h" +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + ContextualSearchWebStateObserver::ContextualSearchWebStateObserver( id<ContextualSearchWebStateDelegate> delegate) : web::WebStateObserver(), delegate_(delegate), loaded_(false) {}
diff --git a/ios/chrome/browser/ui/contextual_search/js_contextual_search_manager.mm b/ios/chrome/browser/ui/contextual_search/js_contextual_search_manager.mm index 872571d..ec37c55f 100644 --- a/ios/chrome/browser/ui/contextual_search/js_contextual_search_manager.mm +++ b/ios/chrome/browser/ui/contextual_search/js_contextual_search_manager.mm
@@ -7,10 +7,13 @@ #include "base/ios/ios_util.h" #include "base/mac/foundation_util.h" #include "base/mac/scoped_block.h" -#include "base/mac/scoped_nsobject.h" #include "base/strings/string_util.h" #include "base/strings/sys_string_conversions.h" +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + static NSString* const kEnableSelectionChangeListener = @"__gCrWeb.contextualSearch.enableSelectionChangeListener(%@);";
diff --git a/ios/chrome/browser/ui/contextual_search/panel_configuration.mm b/ios/chrome/browser/ui/contextual_search/panel_configuration.mm index 7e836d9..54675748 100644 --- a/ios/chrome/browser/ui/contextual_search/panel_configuration.mm +++ b/ios/chrome/browser/ui/contextual_search/panel_configuration.mm
@@ -5,7 +5,10 @@ #include "ios/chrome/browser/ui/contextual_search/panel_configuration.h" #include "base/logging.h" -#include "base/mac/scoped_nsobject.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif namespace { // Amount of tab that a previewing pane leaves visible, expressed as a fraction. @@ -43,7 +46,7 @@ + (instancetype)configurationForContainerSize:(CGSize)containerSize horizontalSizeClass: (UIUserInterfaceSizeClass)horizontalSizeClass { - PanelConfiguration* config = [[[self alloc] init] autorelease]; + PanelConfiguration* config = [[self alloc] init]; config.containerSize = containerSize; config.horizontalSizeClass = horizontalSizeClass; return config;
diff --git a/ios/chrome/browser/ui/contextual_search/touch_to_search_permissions_mediator.h b/ios/chrome/browser/ui/contextual_search/touch_to_search_permissions_mediator.h index 44ebdbac..af85360f 100644 --- a/ios/chrome/browser/ui/contextual_search/touch_to_search_permissions_mediator.h +++ b/ios/chrome/browser/ui/contextual_search/touch_to_search_permissions_mediator.h
@@ -58,7 +58,7 @@ TouchToSearch::TouchToSearchPreferenceState preferenceState; // Current audience object. -@property(nonatomic, assign) +@property(nonatomic, weak) NSObject<TouchToSearchPermissionsChangeAudience>* audience; // YES if, given the current permissions state, touch-to-search can be enabled.
diff --git a/ios/chrome/browser/ui/contextual_search/touch_to_search_permissions_mediator.mm b/ios/chrome/browser/ui/contextual_search/touch_to_search_permissions_mediator.mm index ce48928e..7a2598c6 100644 --- a/ios/chrome/browser/ui/contextual_search/touch_to_search_permissions_mediator.mm +++ b/ios/chrome/browser/ui/contextual_search/touch_to_search_permissions_mediator.mm
@@ -7,7 +7,6 @@ #import <UIKit/UIKit.h> #include "base/command_line.h" -#import "base/ios/weak_nsobject.h" #include "base/logging.h" #include "components/prefs/pref_change_registrar.h" #include "components/prefs/pref_service.h" @@ -22,6 +21,10 @@ #include "ios/chrome/browser/sync/sync_setup_service_factory.h" #include "net/base/network_change_notifier.h" +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + namespace { // Maps pref string values to state enum. const struct { @@ -37,8 +40,7 @@ @interface TouchToSearchPermissionsMediator ()<PrefObserverDelegate> { ios::ChromeBrowserState* _browserState; SyncSetupService* _syncService; - base::WeakNSProtocol<NSObject<TouchToSearchPermissionsChangeAudience>*> - _audience; + __weak NSObject<TouchToSearchPermissionsChangeAudience>* _audience; // Pref observer to track changes to the touch-to-search and search engine // prefs. std::unique_ptr<PrefObserverBridge> _prefObserverBridge; @@ -89,7 +91,6 @@ if ((self = [super init])) { if (browserState && browserState->IsOffTheRecord()) { // Discard the allocated object and return a nil object. - [self release]; return nil; } [self setUpBrowserState:browserState]; @@ -105,7 +106,6 @@ - (void)dealloc { // Set audience to nil to stop observation. self.audience = nil; - [super dealloc]; } - (void)setUpBrowserState:(ios::ChromeBrowserState*)browserState { @@ -146,7 +146,7 @@ - (void)setAudience: (NSObject<TouchToSearchPermissionsChangeAudience>*)audience { [self stopObserving]; - _audience.reset(audience); + _audience = audience; [self startObserving]; } @@ -270,8 +270,8 @@ if (self.audience) { if ([self.audience respondsToSelector:@selector(touchToSearchPermissionsUpdated)]) { - base::WeakNSProtocol<NSObject<TouchToSearchPermissionsChangeAudience>*> - audience(self.audience); + __weak NSObject<TouchToSearchPermissionsChangeAudience>* audience = + self.audience; dispatch_async(dispatch_get_main_queue(), ^{ [audience touchToSearchPermissionsUpdated]; });
diff --git a/ios/chrome/browser/ui/contextual_search/window_gesture_observer.h b/ios/chrome/browser/ui/contextual_search/window_gesture_observer.h index 0bd2b1b..f0228c1 100644 --- a/ios/chrome/browser/ui/contextual_search/window_gesture_observer.h +++ b/ios/chrome/browser/ui/contextual_search/window_gesture_observer.h
@@ -33,8 +33,8 @@ @interface WindowGestureObserver : UIGestureRecognizer -@property(nonatomic, assign) UIView* viewToExclude; -@property(nonatomic, readonly) UIView* touchedView; +@property(nonatomic, weak) UIView* viewToExclude; +@property(nonatomic, weak, readonly) UIView* touchedView; @end #endif // IOS_CHROME_BROWSER_UI_CONTEXTUAL_SEARCH_WINDOW_GESTURE_OBSERVER_H_
diff --git a/ios/chrome/browser/ui/contextual_search/window_gesture_observer.mm b/ios/chrome/browser/ui/contextual_search/window_gesture_observer.mm index 0ef504e8..9a89c05 100644 --- a/ios/chrome/browser/ui/contextual_search/window_gesture_observer.mm +++ b/ios/chrome/browser/ui/contextual_search/window_gesture_observer.mm
@@ -4,6 +4,10 @@ #include "ios/chrome/browser/ui/contextual_search/window_gesture_observer.h" +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + @implementation WindowGestureObserver { NSObject* _target; SEL _action; @@ -42,11 +46,16 @@ if (![[touch view] isDescendantOfView:_viewToExclude]) { _touchedView = [touch view]; dispatch_async(dispatch_get_main_queue(), ^{ + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Warc-performSelector-leaks" if (_actionPassesSelf) { [_target performSelector:_action withObject:self]; } else { [_target performSelector:_action]; } +#pragma clang diagnostic pop + }); // Only invoke from the first qualifying touch. break;
diff --git a/ios/chrome/browser/ui/reading_list/reading_list_view_controller.mm b/ios/chrome/browser/ui/reading_list/reading_list_view_controller.mm index 808e0ac..f4ca8cb 100644 --- a/ios/chrome/browser/ui/reading_list/reading_list_view_controller.mm +++ b/ios/chrome/browser/ui/reading_list/reading_list_view_controller.mm
@@ -243,13 +243,6 @@ [audience setCollectionHasItems:self.readingListModel->size() > 0]; } -#pragma mark UIAccessibilityAction - -- (BOOL)accessibilityPerformEscape { - [self dismiss]; - return YES; -} - #pragma mark - UIViewController - (void)viewDidLoad {
diff --git a/ios/chrome/browser/ui/reading_list/reading_list_view_controller_container.mm b/ios/chrome/browser/ui/reading_list/reading_list_view_controller_container.mm index d3747b2..5da64cc 100644 --- a/ios/chrome/browser/ui/reading_list/reading_list_view_controller_container.mm +++ b/ios/chrome/browser/ui/reading_list/reading_list_view_controller_container.mm
@@ -88,6 +88,13 @@ return NO; } +#pragma mark UIAccessibilityAction + +- (BOOL)accessibilityPerformEscape { + [self dismiss]; + return YES; +} + #pragma mark - ReadingListViewControllerAudience - (void)setCollectionHasItems:(BOOL)hasItems {
diff --git a/ios/chrome/browser/ui/settings/translate_collection_view_controller.mm b/ios/chrome/browser/ui/settings/translate_collection_view_controller.mm index 6dd5036..25973246 100644 --- a/ios/chrome/browser/ui/settings/translate_collection_view_controller.mm +++ b/ios/chrome/browser/ui/settings/translate_collection_view_controller.mm
@@ -8,6 +8,7 @@ #include <memory> #include "base/mac/foundation_util.h" +#include "base/mac/scoped_nsobject.h" #include "components/google/core/browser/google_util.h" #include "components/prefs/pref_member.h" #include "components/prefs/pref_service.h"
diff --git a/ios/clean/DEPS b/ios/clean/DEPS index 81d0c5a8..7973743 100644 --- a/ios/clean/DEPS +++ b/ios/clean/DEPS
@@ -2,5 +2,6 @@ "+net", "+ui/base", "+ios/chrome", + "+ios/shared", "+ios/web", ]
diff --git a/ios/clean/chrome/browser/BUILD.gn b/ios/clean/chrome/browser/BUILD.gn index eaab38f..579d6d0 100644 --- a/ios/clean/chrome/browser/BUILD.gn +++ b/ios/clean/chrome/browser/BUILD.gn
@@ -18,6 +18,7 @@ "//ios/chrome/browser", "//ios/chrome/browser/browser_state", "//ios/chrome/browser/tabs:tabs_internal", + "//ios/shared/chrome/browser/coordinator_context", ] }
diff --git a/ios/clean/chrome/browser/browser_coordinator.h b/ios/clean/chrome/browser/browser_coordinator.h index 6efa0f2..06d7035 100644 --- a/ios/clean/chrome/browser/browser_coordinator.h +++ b/ios/clean/chrome/browser/browser_coordinator.h
@@ -11,6 +11,7 @@ #import <UIKit/UIKit.h> +@class CoordinatorContext; namespace ios { class ChromeBrowserState; } @@ -22,6 +23,9 @@ // call, or reset. @interface BrowserCoordinator : NSObject +// The context object for this coordinator. +@property(nonatomic, strong, readonly) CoordinatorContext* context; + // The browser state used by this coordinator and passed into any child // coordinators added to it. This is a weak pointer, and setting this property // doesn't transfer ownership of the browser state.
diff --git a/ios/clean/chrome/browser/browser_coordinator.mm b/ios/clean/chrome/browser/browser_coordinator.mm index 42cd8a1..9305297 100644 --- a/ios/clean/chrome/browser/browser_coordinator.mm +++ b/ios/clean/chrome/browser/browser_coordinator.mm
@@ -9,6 +9,7 @@ #import "base/logging.h" #import "ios/clean/chrome/browser/browser_coordinator+internal.h" #import "ios/clean/chrome/browser/browser_coordinator.h" +#import "ios/shared/chrome/browser/coordinator_context/coordinator_context.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -25,6 +26,7 @@ @implementation BrowserCoordinator +@synthesize context = _context; @synthesize browserState = _browserState; @synthesize rootViewController = _rootViewController; @synthesize childCoordinators = _childCoordinators; @@ -33,6 +35,7 @@ - (instancetype)init { if (self = [super init]) { + _context = [[CoordinatorContext alloc] init]; _childCoordinators = [NSMutableSet set]; } return self;
diff --git a/ios/clean/chrome/browser/ui/settings/BUILD.gn b/ios/clean/chrome/browser/ui/settings/BUILD.gn index c837f6bf..c10b381 100644 --- a/ios/clean/chrome/browser/ui/settings/BUILD.gn +++ b/ios/clean/chrome/browser/ui/settings/BUILD.gn
@@ -15,5 +15,6 @@ "//ios/clean/chrome/browser", "//ios/clean/chrome/browser/ui/actions", "//ios/clean/chrome/browser/ui/commands", + "//ios/shared/chrome/browser/coordinator_context", ] }
diff --git a/ios/clean/chrome/browser/ui/settings/settings_coordinator.mm b/ios/clean/chrome/browser/ui/settings/settings_coordinator.mm index c0ef8d7..127778a4 100644 --- a/ios/clean/chrome/browser/ui/settings/settings_coordinator.mm +++ b/ios/clean/chrome/browser/ui/settings/settings_coordinator.mm
@@ -11,6 +11,7 @@ #import "ios/chrome/browser/ui/settings/settings_navigation_controller.h" #import "ios/clean/chrome/browser/browser_coordinator+internal.h" #import "ios/clean/chrome/browser/ui/commands/settings_commands.h" +#import "ios/shared/chrome/browser/coordinator_context/coordinator_context.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -32,12 +33,13 @@ currentBrowserState:self.browserState delegate:self]; [self.rootViewController presentViewController:self.viewController - animated:YES + animated:self.context.animated completion:nil]; } - (void)stop { - [self.viewController dismissViewControllerAnimated:YES completion:nil]; + [self.viewController dismissViewControllerAnimated:self.context.animated + completion:nil]; } #pragma mark - SettingsNavigationControllerDelegate
diff --git a/ios/clean/chrome/browser/ui/tab/BUILD.gn b/ios/clean/chrome/browser/ui/tab/BUILD.gn index d0146d1..b1177b0 100644 --- a/ios/clean/chrome/browser/ui/tab/BUILD.gn +++ b/ios/clean/chrome/browser/ui/tab/BUILD.gn
@@ -20,6 +20,7 @@ "//ios/clean/chrome/browser/ui/presenters", "//ios/clean/chrome/browser/ui/toolbar", "//ios/clean/chrome/browser/ui/web_contents", + "//ios/shared/chrome/browser/coordinator_context", "//ios/web", ] }
diff --git a/ios/clean/chrome/browser/ui/tab/tab_coordinator.mm b/ios/clean/chrome/browser/ui/tab/tab_coordinator.mm index 2383dd7..321600d2 100644 --- a/ios/clean/chrome/browser/ui/tab/tab_coordinator.mm +++ b/ios/clean/chrome/browser/ui/tab/tab_coordinator.mm
@@ -17,6 +17,7 @@ #import "ios/clean/chrome/browser/ui/tab/tab_container_view_controller.h" #import "ios/clean/chrome/browser/ui/toolbar/toolbar_coordinator.h" #import "ios/clean/chrome/browser/ui/web_contents/web_coordinator.h" +#import "ios/shared/chrome/browser/coordinator_context/coordinator_context.h" #import "ios/web/public/web_state/web_state_observer_bridge.h" #if !defined(__has_feature) || !__has_feature(objc_arc) @@ -69,12 +70,13 @@ self.viewController.contentViewController = webCoordinator.viewController; [self.rootViewController presentViewController:self.viewController - animated:YES + animated:self.context.animated completion:nil]; } - (void)stop { - [self.viewController dismissViewControllerAnimated:YES completion:nil]; + [self.viewController dismissViewControllerAnimated:self.context.animated + completion:nil]; _webStateObserver.reset(); }
diff --git a/ios/clean/chrome/browser/ui/tab_grid/BUILD.gn b/ios/clean/chrome/browser/ui/tab_grid/BUILD.gn index 95850733..01b3f2b7 100644 --- a/ios/clean/chrome/browser/ui/tab_grid/BUILD.gn +++ b/ios/clean/chrome/browser/ui/tab_grid/BUILD.gn
@@ -18,6 +18,7 @@ "//ios/clean/chrome/browser/ui/commands", "//ios/clean/chrome/browser/ui/settings", "//ios/clean/chrome/browser/ui/tab_strip", + "//ios/shared/chrome/browser/coordinator_context", "//ios/web", "//net", "//ui/base",
diff --git a/ios/clean/chrome/browser/ui/tab_grid/tab_grid_coordinator.mm b/ios/clean/chrome/browser/ui/tab_grid/tab_grid_coordinator.mm index 2b477e3..c99fbb9 100644 --- a/ios/clean/chrome/browser/ui/tab_grid/tab_grid_coordinator.mm +++ b/ios/clean/chrome/browser/ui/tab_grid/tab_grid_coordinator.mm
@@ -17,8 +17,9 @@ #import "ios/clean/chrome/browser/ui/commands/tab_commands.h" #import "ios/clean/chrome/browser/ui/commands/tab_grid_commands.h" #import "ios/clean/chrome/browser/ui/settings/settings_coordinator.h" -#import "ios/clean/chrome/browser/ui/tab_strip/tab_strip_container_coordinator.h" #import "ios/clean/chrome/browser/ui/tab_grid/tab_grid_view_controller.h" +#import "ios/clean/chrome/browser/ui/tab_strip/tab_strip_container_coordinator.h" +#import "ios/shared/chrome/browser/coordinator_context/coordinator_context.h" #import "ios/web/public/navigation_manager.h" #include "ios/web/public/web_state/web_state.h" #import "net/base/mac/url_conversions.h" @@ -56,7 +57,7 @@ // been set. This may be true in a unit test, or if this coordinator is being // used as a root coordinator. [self.rootViewController presentViewController:self.viewController - animated:YES + animated:self.context.animated completion:nil]; }
diff --git a/ios/clean/chrome/browser/ui/tab_strip/tab_strip_container_view_controller.mm b/ios/clean/chrome/browser/ui/tab_strip/tab_strip_container_view_controller.mm index 4afbb09..3d94171 100644 --- a/ios/clean/chrome/browser/ui/tab_strip/tab_strip_container_view_controller.mm +++ b/ios/clean/chrome/browser/ui/tab_strip/tab_strip_container_view_controller.mm
@@ -8,8 +8,8 @@ #import "ios/clean/chrome/browser/ui/tab_strip/tab_strip_container_view_controller.h" -#import "ios/clean/chrome/browser/ui/ui_types.h" #import "ios/clean/chrome/browser/ui/actions/tab_strip_actions.h" +#import "ios/clean/chrome/browser/ui/ui_types.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support."
diff --git a/ios/clean/chrome/browser/ui/toolbar/BUILD.gn b/ios/clean/chrome/browser/ui/toolbar/BUILD.gn index 44936952..dd46a48b 100644 --- a/ios/clean/chrome/browser/ui/toolbar/BUILD.gn +++ b/ios/clean/chrome/browser/ui/toolbar/BUILD.gn
@@ -21,6 +21,7 @@ "//ios/clean/chrome/browser/ui/animators", "//ios/clean/chrome/browser/ui/commands", "//ios/clean/chrome/browser/ui/tools", + "//ios/shared/chrome/browser/coordinator_context", "//ios/web", ] }
diff --git a/ios/clean/chrome/browser/ui/toolbar/toolbar_coordinator.mm b/ios/clean/chrome/browser/ui/toolbar/toolbar_coordinator.mm index aba4969d..ed965fe 100644 --- a/ios/clean/chrome/browser/ui/toolbar/toolbar_coordinator.mm +++ b/ios/clean/chrome/browser/ui/toolbar/toolbar_coordinator.mm
@@ -13,6 +13,7 @@ #import "ios/clean/chrome/browser/ui/commands/toolbar_commands.h" #import "ios/clean/chrome/browser/ui/toolbar/toolbar_view_controller.h" #import "ios/clean/chrome/browser/ui/tools/tools_coordinator.h" +#import "ios/shared/chrome/browser/coordinator_context/coordinator_context.h" #include "ios/web/public/web_state/web_state.h" #if !defined(__has_feature) || !__has_feature(objc_arc) @@ -33,7 +34,7 @@ self.viewController.toolbarCommandHandler = self; [self.rootViewController presentViewController:self.viewController - animated:YES + animated:self.context.animated completion:nil]; }
diff --git a/ios/clean/chrome/browser/ui/tools/BUILD.gn b/ios/clean/chrome/browser/ui/tools/BUILD.gn index c764d0a..cb3e9b0b 100644 --- a/ios/clean/chrome/browser/ui/tools/BUILD.gn +++ b/ios/clean/chrome/browser/ui/tools/BUILD.gn
@@ -17,6 +17,7 @@ "//ios/clean/chrome/browser/ui/actions", "//ios/clean/chrome/browser/ui/animators", "//ios/clean/chrome/browser/ui/presenters", + "//ios/shared/chrome/browser/coordinator_context", ] }
diff --git a/ios/clean/chrome/browser/ui/tools/tools_coordinator.mm b/ios/clean/chrome/browser/ui/tools/tools_coordinator.mm index 3d01ac2..7bc1c72 100644 --- a/ios/clean/chrome/browser/ui/tools/tools_coordinator.mm +++ b/ios/clean/chrome/browser/ui/tools/tools_coordinator.mm
@@ -11,6 +11,7 @@ #import "ios/clean/chrome/browser/ui/animators/zoom_transition_animator.h" #import "ios/clean/chrome/browser/ui/presenters/menu_presentation_controller.h" #import "ios/clean/chrome/browser/ui/tools/menu_view_controller.h" +#import "ios/shared/chrome/browser/coordinator_context/coordinator_context.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -32,12 +33,13 @@ self.menuViewController.transitioningDelegate = self; [self.rootViewController presentViewController:self.menuViewController - animated:YES + animated:self.context.animated completion:nil]; } - (void)stop { - [self.menuViewController dismissViewControllerAnimated:YES completion:nil]; + [self.menuViewController dismissViewControllerAnimated:self.context.animated + completion:nil]; } #pragma mark - UIViewControllerTransitioningDelegate
diff --git a/ios/clean/chrome/browser/ui/web_contents/BUILD.gn b/ios/clean/chrome/browser/ui/web_contents/BUILD.gn index 4650fac..df8e8c68 100644 --- a/ios/clean/chrome/browser/ui/web_contents/BUILD.gn +++ b/ios/clean/chrome/browser/ui/web_contents/BUILD.gn
@@ -15,6 +15,7 @@ deps = [ "//ios/clean/chrome/browser", "//ios/clean/chrome/browser/web", + "//ios/shared/chrome/browser/coordinator_context", "//ios/web", "//ui/base", "//url",
diff --git a/ios/clean/chrome/browser/ui/web_contents/web_coordinator.mm b/ios/clean/chrome/browser/ui/web_contents/web_coordinator.mm index ab02726..70327bcc 100644 --- a/ios/clean/chrome/browser/ui/web_contents/web_coordinator.mm +++ b/ios/clean/chrome/browser/ui/web_contents/web_coordinator.mm
@@ -10,6 +10,7 @@ #import "ios/clean/chrome/browser/browser_coordinator+internal.h" #import "ios/clean/chrome/browser/ui/web_contents/web_contents_view_controller.h" +#import "ios/shared/chrome/browser/coordinator_context/coordinator_context.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -34,7 +35,7 @@ // when this coordinator's view controller will be contained instead of // presented. [self.rootViewController presentViewController:self.viewController - animated:YES + animated:self.context.animated completion:nil]; }
diff --git a/ios/shared/DEPS b/ios/shared/DEPS new file mode 100644 index 0000000..f47a8e23 --- /dev/null +++ b/ios/shared/DEPS
@@ -0,0 +1,5 @@ +include_rules = [ + # Shared code between ios/chrome and ios/clean/chrome must not depend on them. + "-ios/clean/chrome", + "-ios/chrome", +]
diff --git a/ios/shared/OWNERS b/ios/shared/OWNERS new file mode 100644 index 0000000..b8d3d41f --- /dev/null +++ b/ios/shared/OWNERS
@@ -0,0 +1,3 @@ +lpromero@chromium.org +marq@chromium.org +sdefresne@chromium.org
diff --git a/ios/shared/README.md b/ios/shared/README.md new file mode 100644 index 0000000..94ad31b --- /dev/null +++ b/ios/shared/README.md
@@ -0,0 +1,5 @@ +# Shared directory between ios/chrome and ios/clean/chrome + +This directory is here to hold the shared code between `ios/chrome` and +`ios/clean/chrome`. +Code in this directory should not depend on either.
diff --git a/ios/shared/chrome/browser/coordinator_context/BUILD.gn b/ios/shared/chrome/browser/coordinator_context/BUILD.gn new file mode 100644 index 0000000..4f3f5c2 --- /dev/null +++ b/ios/shared/chrome/browser/coordinator_context/BUILD.gn
@@ -0,0 +1,24 @@ +# Copyright 2017 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. + +source_set("coordinator_context") { + sources = [ + "coordinator_context.h", + "coordinator_context.mm", + ] + configs += [ "//build/config/compiler:enable_arc" ] + libs = [ "UIKit.framework" ] +} + +source_set("unit_tests") { + testonly = true + sources = [ + "coordinator_context_unittest.mm", + ] + deps = [ + ":coordinator_context", + "//testing/gtest", + ] + configs += [ "//build/config/compiler:enable_arc" ] +}
diff --git a/ios/shared/chrome/browser/coordinator_context/coordinator_context.h b/ios/shared/chrome/browser/coordinator_context/coordinator_context.h new file mode 100644 index 0000000..f52a62c --- /dev/null +++ b/ios/shared/chrome/browser/coordinator_context/coordinator_context.h
@@ -0,0 +1,17 @@ +// Copyright 2017 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. + +#ifndef IOS_SHARED_CHROME_BROWSER_COORDINATOR_CONTEXT_COORDINATOR_CONTEXT_H_ +#define IOS_SHARED_CHROME_BROWSER_COORDINATOR_CONTEXT_COORDINATOR_CONTEXT_H_ + +#import <UIKit/UIKit.h> + +@interface CoordinatorContext : NSObject + +// Default is YES. +@property(nonatomic, assign, getter=isAnimated) BOOL animated; + +@end + +#endif // IOS_SHARED_CHROME_BROWSER_COORDINATOR_CONTEXT_COORDINATOR_CONTEXT_H_
diff --git a/ios/shared/chrome/browser/coordinator_context/coordinator_context.mm b/ios/shared/chrome/browser/coordinator_context/coordinator_context.mm new file mode 100644 index 0000000..f53d002 --- /dev/null +++ b/ios/shared/chrome/browser/coordinator_context/coordinator_context.mm
@@ -0,0 +1,23 @@ +// Copyright 2017 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. + +#import "ios/shared/chrome/browser/coordinator_context/coordinator_context.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +@implementation CoordinatorContext + +@synthesize animated = _animated; + +- (instancetype)init { + self = [super init]; + if (self) { + _animated = YES; + } + return self; +} + +@end
diff --git a/ios/shared/chrome/browser/coordinator_context/coordinator_context_unittest.mm b/ios/shared/chrome/browser/coordinator_context/coordinator_context_unittest.mm new file mode 100644 index 0000000..30e377d --- /dev/null +++ b/ios/shared/chrome/browser/coordinator_context/coordinator_context_unittest.mm
@@ -0,0 +1,20 @@ +// Copyright 2017 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. + +#import "ios/shared/chrome/browser/coordinator_context/coordinator_context.h" + +#include "testing/gtest/include/gtest/gtest.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +namespace { + +TEST(CoordinatorContextTest, Initialization) { + CoordinatorContext* context = [[CoordinatorContext alloc] init]; + EXPECT_TRUE(context.animated); +} + +} // namespace
diff --git a/media/audio/linux/audio_manager_linux.cc b/media/audio/linux/audio_manager_linux.cc index 5d9676e..374d2ab8 100644 --- a/media/audio/linux/audio_manager_linux.cc +++ b/media/audio/linux/audio_manager_linux.cc
@@ -3,7 +3,7 @@ // found in the LICENSE file. #include "base/command_line.h" -#include "base/metrics/histogram.h" +#include "base/metrics/histogram_macros.h" #include "media/base/media_switches.h" #if defined(USE_ALSA)
diff --git a/media/filters/gpu_video_decoder.cc b/media/filters/gpu_video_decoder.cc index 124f8c0b..d4c064f 100644 --- a/media/filters/gpu_video_decoder.cc +++ b/media/filters/gpu_video_decoder.cc
@@ -253,7 +253,7 @@ factories_->GetVideoDecodeAcceleratorCapabilities(); if (!IsProfileSupported(capabilities, config.profile(), config.coded_size(), config.is_encrypted())) { - DVLOG(1) << "Unsupported profile " << config.profile() + DVLOG(1) << "Unsupported profile " << GetProfileName(config.profile()) << ", unsupported coded size " << config.coded_size().ToString() << ", or accelerator should only be used for encrypted content. " << " is_encrypted: " << (config.is_encrypted() ? "yes." : "no.");
diff --git a/media/gpu/android_video_decode_accelerator.cc b/media/gpu/android_video_decode_accelerator.cc index c907c601..c26289c 100644 --- a/media/gpu/android_video_decode_accelerator.cc +++ b/media/gpu/android_video_decode_accelerator.cc
@@ -289,7 +289,7 @@ codec_config_->codec != kCodecHEVC && #endif codec_config_->codec != kCodecH264) { - DLOG(ERROR) << "Unsupported profile: " << config.profile; + DLOG(ERROR) << "Unsupported profile: " << GetProfileName(config.profile); return false; }
diff --git a/media/gpu/android_video_encode_accelerator.cc b/media/gpu/android_video_encode_accelerator.cc index 2e8559dd..cfad7fa 100644 --- a/media/gpu/android_video_encode_accelerator.cc +++ b/media/gpu/android_video_encode_accelerator.cc
@@ -156,7 +156,8 @@ if (!(MediaCodecUtil::SupportsSetParameters() && format == PIXEL_FORMAT_I420)) { - DLOG(ERROR) << "Unexpected combo: " << format << ", " << output_profile; + DLOG(ERROR) << "Unexpected combo: " << format << ", " + << GetProfileName(output_profile); return false; }
diff --git a/media/gpu/vaapi_video_decode_accelerator.cc b/media/gpu/vaapi_video_decode_accelerator.cc index a119f0f..8c73ccc 100644 --- a/media/gpu/vaapi_video_decode_accelerator.cc +++ b/media/gpu/vaapi_video_decode_accelerator.cc
@@ -359,7 +359,7 @@ base::AutoLock auto_lock(lock_); DCHECK_EQ(state_, kUninitialized); - DVLOG(2) << "Initializing VAVDA, profile: " << profile; + DVLOG(2) << "Initializing VAVDA, profile: " << GetProfileName(profile); #if defined(USE_X11) if (gl::GetGLImplementation() != gl::kGLImplementationDesktopGL) { @@ -379,7 +379,8 @@ VaapiWrapper::kDecode, profile, base::Bind(&ReportToUMA, VAAPI_ERROR)); if (!vaapi_wrapper_.get()) { - DVLOG(1) << "Failed initializing VAAPI for profile " << profile; + DVLOG(1) << "Failed initializing VAAPI for profile " + << GetProfileName(profile); return false; } @@ -394,7 +395,7 @@ vp9_accelerator_.reset(new VaapiVP9Accelerator(this, vaapi_wrapper_.get())); decoder_.reset(new VP9Decoder(vp9_accelerator_.get())); } else { - DLOG(ERROR) << "Unsupported profile " << profile; + DLOG(ERROR) << "Unsupported profile " << GetProfileName(profile); return false; }
diff --git a/media/gpu/vaapi_video_encode_accelerator.cc b/media/gpu/vaapi_video_encode_accelerator.cc index 6505bb57..bf77ad7 100644 --- a/media/gpu/vaapi_video_encode_accelerator.cc +++ b/media/gpu/vaapi_video_encode_accelerator.cc
@@ -167,7 +167,7 @@ DVLOGF(1) << "Initializing VAVEA, input_format: " << VideoPixelFormatToString(format) << ", input_visible_size: " << input_visible_size.ToString() - << ", output_profile: " << output_profile + << ", output_profile: " << GetProfileName(output_profile) << ", initial_bitrate: " << initial_bitrate; client_ptr_factory_.reset(new base::WeakPtrFactory<Client>(client)); @@ -179,7 +179,8 @@ return profile.profile == output_profile; }); if (profile == profiles.end()) { - DVLOGF(1) << "Unsupported output profile " << output_profile; + DVLOGF(1) << "Unsupported output profile " + << GetProfileName(output_profile); return false; } if (input_visible_size.width() > profile->max_resolution.width() || @@ -212,7 +213,8 @@ VaapiWrapper::CreateForVideoCodec(VaapiWrapper::kEncode, output_profile, base::Bind(&ReportToUMA, VAAPI_ERROR)); if (!vaapi_wrapper_.get()) { - DVLOGF(1) << "Failed initializing VAAPI for profile " << output_profile; + DVLOGF(1) << "Failed initializing VAAPI for profile " + << GetProfileName(output_profile); return false; }
diff --git a/media/gpu/video_decode_accelerator_unittest.cc b/media/gpu/video_decode_accelerator_unittest.cc index 6723474..dea106b 100644 --- a/media/gpu/video_decode_accelerator_unittest.cc +++ b/media/gpu/video_decode_accelerator_unittest.cc
@@ -1012,7 +1012,7 @@ return (size > 0 && !(data[0] & 0x01)); } // Shouldn't happen at this point. - LOG(FATAL) << "Invalid profile: " << profile; + LOG(FATAL) << "Invalid profile: " << GetProfileName(profile); return false; }
diff --git a/media/gpu/video_encode_accelerator_unittest.cc b/media/gpu/video_encode_accelerator_unittest.cc index ded9b86..11f019b9 100644 --- a/media/gpu/video_encode_accelerator_unittest.cc +++ b/media/gpu/video_encode_accelerator_unittest.cc
@@ -700,7 +700,7 @@ } else if (IsVP8(profile)) { validator.reset(new VP8Validator(frame_cb)); } else { - LOG(FATAL) << "Unsupported profile: " << profile; + LOG(FATAL) << "Unsupported profile: " << GetProfileName(profile); } return validator; @@ -773,7 +773,7 @@ COLOR_SPACE_UNSPECIFIED, coded_size, visible_size, natural_size, EmptyExtraData(), Unencrypted()); else - LOG_ASSERT(0) << "Invalid profile " << profile_; + LOG_ASSERT(0) << "Invalid profile " << GetProfileName(profile_); decoder_->Initialize( config, false, nullptr,
diff --git a/media/gpu/vt_video_encode_accelerator_mac.cc b/media/gpu/vt_video_encode_accelerator_mac.cc index cc5ed0d0..f5aff7e 100644 --- a/media/gpu/vt_video_encode_accelerator_mac.cc +++ b/media/gpu/vt_video_encode_accelerator_mac.cc
@@ -123,7 +123,7 @@ Client* client) { DVLOG(3) << __func__ << ": input_format=" << VideoPixelFormatToString(format) << ", input_visible_size=" << input_visible_size.ToString() - << ", output_profile=" << output_profile + << ", output_profile=" << GetProfileName(output_profile) << ", initial_bitrate=" << initial_bitrate; DCHECK(thread_checker_.CalledOnValidThread()); DCHECK(client); @@ -134,7 +134,8 @@ return false; } if (H264PROFILE_BASELINE != output_profile) { - DLOG(ERROR) << "Output profile not supported= " << output_profile; + DLOG(ERROR) << "Output profile not supported= " + << GetProfileName(output_profile); return false; }
diff --git a/skia/BUILD.gn b/skia/BUILD.gn index 2b154a7..8e14ac1 100644 --- a/skia/BUILD.gn +++ b/skia/BUILD.gn
@@ -93,6 +93,7 @@ "//third_party/skia/include/private", "//third_party/skia/include/client/android", "//third_party/skia/src/core", + "//third_party/skia/src/effects/gradients", "//third_party/skia/src/image", "//third_party/skia/src/opts", "//third_party/skia/src/pdf",
diff --git a/testing/buildbot/chromium.chromiumos.json b/testing/buildbot/chromium.chromiumos.json index 73d3a37..7946643 100644 --- a/testing/buildbot/chromium.chromiumos.json +++ b/testing/buildbot/chromium.chromiumos.json
@@ -179,10 +179,13 @@ "test": "gl_unittests" }, { + "args": [ + "--ozone-platform=x11" + ], "swarming": { "can_use_on_swarming_builders": true }, - "test": "gl_unittests_ozonex" + "test": "gl_unittests_ozone" }, { "swarming": {
diff --git a/testing/buildbot/gn_isolate_map.pyl b/testing/buildbot/gn_isolate_map.pyl index 7c4e712..b85c1e7 100644 --- a/testing/buildbot/gn_isolate_map.pyl +++ b/testing/buildbot/gn_isolate_map.pyl
@@ -26,8 +26,7 @@ # "windowed_test_launcher" # : the test is a gtest-based test that uses the "brave-new-test-launcher" # from //base/test:test_support and needs to run under Xvfb if run on -# an X11-based platform (use_x11=true or use_ozone=true && -# --ozone_platform=x11). +# some platforms (eg. Linux Desktop, X11 CrOS and Ozone CrOS). # "console_test_launcher" # : the test is a gtest-based test that uses the "brave-new-test-launcher" # from //base/test:test_support but does not need Xvfb. @@ -447,12 +446,11 @@ "type": "raw", "args": [], }, - "gl_unittests_ozonex": { - "label": "//ui/gl:gl_unittests_ozonex", + "gl_unittests_ozone": { + "label": "//ui/gl:gl_unittests_ozone", "label_type": "group", "type": "windowed_test_launcher", "executable": "gl_unittests", - "args": ["--ozone-platform=x11"], }, "gn_unittests": { "label": "//tools/gn:gn_unittests",
diff --git a/third_party/WebKit/LayoutTests/TestExpectations b/third_party/WebKit/LayoutTests/TestExpectations index ec2b2a3..90a89f6 100644 --- a/third_party/WebKit/LayoutTests/TestExpectations +++ b/third_party/WebKit/LayoutTests/TestExpectations
@@ -1629,6 +1629,7 @@ crbug.com/613659 external/wpt/quirks-mode/percentage-height-calculation.html [ Failure ] crbug.com/613661 external/wpt/quirks-mode/table-cell-nowrap-minimum-width-calculation.html [ Failure ] crbug.com/613663 external/wpt/quirks-mode/table-cell-width-calculation.html [ Failure ] +crbug.com/613663 external/wpt/quirks-mode/unitless-length.html [ Failure Timeout ] # Note: this test was previously marked as slow on Debug builds. Skipping until crash is fixed crbug.com/619978 fast/css/giant-stylesheet-crash.html [ Skip ]
diff --git a/third_party/WebKit/LayoutTests/svg/text/tspan-outline-multiple-inline-box-expected.txt b/third_party/WebKit/LayoutTests/svg/text/tspan-outline-multiple-inline-box-expected.txt index 42dc792c..c0ee13e 100644 --- a/third_party/WebKit/LayoutTests/svg/text/tspan-outline-multiple-inline-box-expected.txt +++ b/third_party/WebKit/LayoutTests/svg/text/tspan-outline-multiple-inline-box-expected.txt
@@ -1 +1 @@ -Passes if no crash with ENABLE(ASSERT). לגabc +Passes if no crash with DCHECK_IS_ON(). לגabc
diff --git a/third_party/WebKit/LayoutTests/svg/text/tspan-outline-multiple-inline-box.svg b/third_party/WebKit/LayoutTests/svg/text/tspan-outline-multiple-inline-box.svg index d23a7df..c7b9f74 100644 --- a/third_party/WebKit/LayoutTests/svg/text/tspan-outline-multiple-inline-box.svg +++ b/third_party/WebKit/LayoutTests/svg/text/tspan-outline-multiple-inline-box.svg
@@ -4,7 +4,7 @@ testRunner.dumpAsText(); </script> <text x="100" y="100"> - Passes if no crash with ENABLE(ASSERT). + Passes if no crash with DCHECK_IS_ON(). ל<tspan style="outline: 1px solid black">גa</tspan>bc </text> </svg>
diff --git a/third_party/WebKit/Source/bindings/core/v8/DOMWrapperWorld.cpp b/third_party/WebKit/Source/bindings/core/v8/DOMWrapperWorld.cpp index d3ece36..eac486e7 100644 --- a/third_party/WebKit/Source/bindings/core/v8/DOMWrapperWorld.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/DOMWrapperWorld.cpp
@@ -193,7 +193,7 @@ m_domDataStore.reset(); } -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() static bool isIsolatedWorldId(int worldId) { return MainWorldId < worldId && worldId < IsolatedWorldIdLimit; }
diff --git a/third_party/WebKit/Source/bindings/core/v8/ExceptionState.h b/third_party/WebKit/Source/bindings/core/v8/ExceptionState.h index c34c579..fd45146 100644 --- a/third_party/WebKit/Source/bindings/core/v8/ExceptionState.h +++ b/third_party/WebKit/Source/bindings/core/v8/ExceptionState.h
@@ -83,7 +83,7 @@ ContextType contextType, const char* interfaceName) : ExceptionState(isolate, contextType, interfaceName, nullptr) { -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() switch (m_context) { case ConstructionContext: case EnumerationContext: @@ -94,7 +94,7 @@ default: NOTREACHED(); } -#endif // ENABLE(ASSERT) +#endif // DCHECK_IS_ON() } ~ExceptionState() { @@ -176,7 +176,7 @@ // This can be used as a default value of an ExceptionState parameter like this: // // Node* removeChild(Node*, ExceptionState& = ASSERT_NO_EXCEPTION); -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() #define ASSERT_NO_EXCEPTION \ (::blink::NonThrowableExceptionState(__FILE__, __LINE__).returnThis()) #else
diff --git a/third_party/WebKit/Source/bindings/core/v8/ExceptionStatePlaceholder.cpp b/third_party/WebKit/Source/bindings/core/v8/ExceptionStatePlaceholder.cpp index 3c2e4beb..709ebf73 100644 --- a/third_party/WebKit/Source/bindings/core/v8/ExceptionStatePlaceholder.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/ExceptionStatePlaceholder.cpp
@@ -32,7 +32,7 @@ namespace blink { -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() NoExceptionStateAssertionChecker::NoExceptionStateAssertionChecker( const char* file,
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptFunction.cpp b/third_party/WebKit/Source/bindings/core/v8/ScriptFunction.cpp index 1c448de6..f9ee245 100644 --- a/third_party/WebKit/Source/bindings/core/v8/ScriptFunction.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptFunction.cpp
@@ -9,7 +9,7 @@ namespace blink { v8::Local<v8::Function> ScriptFunction::bindToV8Function() { -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() DCHECK(!m_bindToV8FunctionAlreadyCalled); m_bindToV8FunctionAlreadyCalled = true; #endif
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptFunction.h b/third_party/WebKit/Source/bindings/core/v8/ScriptFunction.h index 6a7f96e1..3a4b150 100644 --- a/third_party/WebKit/Source/bindings/core/v8/ScriptFunction.h +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptFunction.h
@@ -59,10 +59,6 @@ protected: explicit ScriptFunction(ScriptState* scriptState) : m_scriptState(scriptState) -#if ENABLE(ASSERT) - , - m_bindToV8FunctionAlreadyCalled(false) -#endif { } @@ -75,9 +71,9 @@ static void callCallback(const v8::FunctionCallbackInfo<v8::Value>&); RefPtr<ScriptState> m_scriptState; -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() // bindToV8Function must not be called twice. - bool m_bindToV8FunctionAlreadyCalled; + bool m_bindToV8FunctionAlreadyCalled = false; #endif };
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptPromiseResolver.cpp b/third_party/WebKit/Source/bindings/core/v8/ScriptPromiseResolver.cpp index 37d6ee3..f38e7163 100644 --- a/third_party/WebKit/Source/bindings/core/v8/ScriptPromiseResolver.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptPromiseResolver.cpp
@@ -17,10 +17,6 @@ this, &ScriptPromiseResolver::onTimerFired), m_resolver(scriptState) -#if ENABLE(ASSERT) - , - m_isPromiseCalled(false) -#endif { if (getExecutionContext()->isContextDestroyed()) { m_state = Detached;
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptPromiseResolver.h b/third_party/WebKit/Source/bindings/core/v8/ScriptPromiseResolver.h index 3a62b45..0258371a 100644 --- a/third_party/WebKit/Source/bindings/core/v8/ScriptPromiseResolver.h +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptPromiseResolver.h
@@ -41,7 +41,7 @@ return resolver; } -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() // Eagerly finalized so as to ensure valid access to getExecutionContext() // from the destructor's assert. EAGERLY_FINALIZE(); @@ -78,7 +78,7 @@ // Note that an empty ScriptPromise will be returned after resolve or // reject is called. ScriptPromise promise() { -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() m_isPromiseCalled = true; #endif return m_resolver.promise(); @@ -161,9 +161,9 @@ // alive while in that state. SelfKeepAlive<ScriptPromiseResolver> m_keepAlive; -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() // True if promise() is called. - bool m_isPromiseCalled; + bool m_isPromiseCalled = false; #endif };
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptState.cpp b/third_party/WebKit/Source/bindings/core/v8/ScriptState.cpp index c16c328b..8f84ae2 100644 --- a/third_party/WebKit/Source/bindings/core/v8/ScriptState.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptState.cpp
@@ -36,10 +36,6 @@ m_context(m_isolate, context), m_world(world), m_perContextData(V8PerContextData::create(context)) -#if ENABLE(ASSERT) - , - m_globalObjectDetached(false) -#endif { DCHECK(m_world); m_context.setWeak(this, &weakCallback); @@ -54,7 +50,7 @@ void ScriptState::detachGlobalObject() { ASSERT(!m_context.isEmpty()); context()->DetachGlobal(); -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() m_globalObjectDetached = true; #endif }
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptState.h b/third_party/WebKit/Source/bindings/core/v8/ScriptState.h index 65b6f73..4d8d0fe 100644 --- a/third_party/WebKit/Source/bindings/core/v8/ScriptState.h +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptState.h
@@ -155,7 +155,7 @@ } void detachGlobalObject(); void clearContext() { return m_context.clear(); } -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() bool isGlobalObjectDetached() const { return m_globalObjectDetached; } #endif @@ -184,8 +184,8 @@ // Otherwise, the v8::Context will leak. std::unique_ptr<V8PerContextData> m_perContextData; -#if ENABLE(ASSERT) - bool m_globalObjectDetached; +#if DCHECK_IS_ON() + bool m_globalObjectDetached = false; #endif };
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptValueSerializer.cpp b/third_party/WebKit/Source/bindings/core/v8/ScriptValueSerializer.cpp index fd18123..38145b01 100644 --- a/third_party/WebKit/Source/bindings/core/v8/ScriptValueSerializer.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptValueSerializer.cpp
@@ -263,7 +263,7 @@ void SerializedScriptValueWriter::writeArrayBufferView( const DOMArrayBufferView& arrayBufferView) { append(ArrayBufferViewTag); -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() ASSERT(static_cast<const uint8_t*>(arrayBufferView.bufferBase()->data()) + arrayBufferView.byteOffset() == static_cast<const uint8_t*>(arrayBufferView.baseAddress()));
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp b/third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp index 0e8ed5a..30e49da 100644 --- a/third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp
@@ -365,7 +365,7 @@ } // namespace static void adjustAmountOfExternalAllocatedMemory(int64_t diff) { -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() DEFINE_THREAD_SAFE_STATIC_LOCAL(int64_t, processTotal, new int64_t(0)); DEFINE_THREAD_SAFE_STATIC_LOCAL(Mutex, mutex, new Mutex); {
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8StringResource.h b/third_party/WebKit/Source/bindings/core/v8/V8StringResource.h index c01715d4..b6009b8 100644 --- a/third_party/WebKit/Source/bindings/core/v8/V8StringResource.h +++ b/third_party/WebKit/Source/bindings/core/v8/V8StringResource.h
@@ -44,7 +44,7 @@ public: explicit WebCoreStringResourceBase(const String& string) : m_plainString(string) { -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() m_threadId = WTF::currentThread(); #endif ASSERT(!string.isNull()); @@ -54,7 +54,7 @@ explicit WebCoreStringResourceBase(const AtomicString& string) : m_plainString(string.getString()), m_atomicString(string) { -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() m_threadId = WTF::currentThread(); #endif ASSERT(!string.isNull()); @@ -63,7 +63,7 @@ } virtual ~WebCoreStringResourceBase() { -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() ASSERT(m_threadId == WTF::currentThread()); #endif int64_t reducedExternalMemory = m_plainString.charactersSizeInBytes(); @@ -77,7 +77,7 @@ const String& webcoreString() { return m_plainString; } const AtomicString& getAtomicString() { -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() ASSERT(m_threadId == WTF::currentThread()); #endif if (m_atomicString.isNull()) { @@ -102,7 +102,7 @@ AtomicString m_atomicString; private: -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() WTF::ThreadIdentifier m_threadId; #endif };
diff --git a/third_party/WebKit/Source/bindings/core/v8/custom/V8CSSStyleDeclarationCustom.cpp b/third_party/WebKit/Source/bindings/core/v8/custom/V8CSSStyleDeclarationCustom.cpp index 14e7e7f1..35aa980 100644 --- a/third_party/WebKit/Source/bindings/core/v8/custom/V8CSSStyleDeclarationCustom.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/custom/V8CSSStyleDeclarationCustom.cpp
@@ -61,7 +61,7 @@ // The prefix within the property name must be followed by a capital letter. static bool hasCSSPropertyNamePrefix(const String& propertyName, const char* prefix) { -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() ASSERT(*prefix); for (const char* p = prefix; *p; ++p) ASSERT(isASCIILower(*p));
diff --git a/third_party/WebKit/Source/bindings/modules/v8/V8BindingForModules.cpp b/third_party/WebKit/Source/bindings/modules/v8/V8BindingForModules.cpp index 60c44f6..7f2bdfc 100644 --- a/third_party/WebKit/Source/bindings/modules/v8/V8BindingForModules.cpp +++ b/third_party/WebKit/Source/bindings/modules/v8/V8BindingForModules.cpp
@@ -594,7 +594,7 @@ return V8IDBKeyRange::toImplWithTypeCheck(isolate, value); } -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() // This assertion is used when a value has been retrieved from an object store // with implicit keys (i.e. a key path). It verifies that either the value // contains an implicit key matching the primary key (so it was correctly
diff --git a/third_party/WebKit/Source/bindings/modules/v8/V8BindingForModules.h b/third_party/WebKit/Source/bindings/modules/v8/V8BindingForModules.h index 6ae8cbc..522f1983 100644 --- a/third_party/WebKit/Source/bindings/modules/v8/V8BindingForModules.h +++ b/third_party/WebKit/Source/bindings/modules/v8/V8BindingForModules.h
@@ -32,7 +32,7 @@ SerializedScriptValue*, const Vector<WebBlobInfo>*); -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() void assertPrimaryKeyValidOrInjectable(ScriptState*, const IDBValue*); #endif
diff --git a/third_party/WebKit/Source/core/clipboard/DataObject.cpp b/third_party/WebKit/Source/core/clipboard/DataObject.cpp index ea267e8..fcbbe51 100644 --- a/third_party/WebKit/Source/core/clipboard/DataObject.cpp +++ b/third_party/WebKit/Source/core/clipboard/DataObject.cpp
@@ -43,7 +43,7 @@ DataObject* DataObject::createFromPasteboard(PasteMode pasteMode) { DataObject* dataObject = create(); -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() HashSet<String> typesSeen; #endif WebClipboard::Buffer buffer = Pasteboard::generalPasteboard()->buffer(); @@ -133,7 +133,7 @@ Vector<String> DataObject::types() const { Vector<String> results; -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() HashSet<String> typesSeen; #endif bool containsFiles = false;
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp index 5f1e6c6..2a35689 100644 --- a/third_party/WebKit/Source/core/dom/Document.cpp +++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -4945,34 +4945,27 @@ } KURL Document::completeURL(const String& url) const { - String trimmed = url.stripWhiteSpace(); KURL completed = completeURLWithOverride(url, m_baseURL); - bool newline = trimmed.contains('\n') || trimmed.contains('\r'); - bool lessThan = trimmed.contains('<'); - if ((newline || lessThan) && completed.protocolIsInHTTPFamily()) { - if (newline) { + if (completed.whitespaceRemoved()) { + if (completed.protocolIsInHTTPFamily()) { UseCounter::count(*this, UseCounter::DocumentCompleteURLHTTPContainingNewline); - } - if (lessThan) { - UseCounter::count(*this, - UseCounter::DocumentCompleteURLHTTPContainingLessThan); - } - if (newline && lessThan) { - UseCounter::count( - *this, - UseCounter::DocumentCompleteURLHTTPContainingNewlineAndLessThan); + bool lessThan = url.contains('<'); + if (lessThan) { + UseCounter::count( + *this, + UseCounter::DocumentCompleteURLHTTPContainingNewlineAndLessThan); - if (RuntimeEnabledFeatures::restrictCompleteURLCharacterSetEnabled()) - return KURL(); + if (RuntimeEnabledFeatures::restrictCompleteURLCharacterSetEnabled()) + return KURL(); + } + } else { + UseCounter::count( + *this, UseCounter::DocumentCompleteURLNonHTTPContainingNewline); } - } else if (newline || lessThan) { - UseCounter::count( - *this, - UseCounter::DocumentCompleteURLNonHTTPContainingNewlineOrLessThan); } - return completeURLWithOverride(url, m_baseURL); + return completed; } KURL Document::completeURLWithOverride(const String& url,
diff --git a/third_party/WebKit/Source/core/fileapi/File.h b/third_party/WebKit/Source/core/fileapi/File.h index 4dc77f63..481fc1e 100644 --- a/third_party/WebKit/Source/core/fileapi/File.h +++ b/third_party/WebKit/Source/core/fileapi/File.h
@@ -216,7 +216,7 @@ // If the modification time isn't known, the current time is returned. double lastModifiedMS() const; -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() // Instances backed by a file must have an empty file system URL. bool hasValidFileSystemURL() const { return !hasBackingFile() || m_fileSystemURL.isEmpty();
diff --git a/third_party/WebKit/Source/core/frame/EventHandlerRegistry.cpp b/third_party/WebKit/Source/core/frame/EventHandlerRegistry.cpp index c02a63b..ce6dc461 100644 --- a/third_party/WebKit/Source/core/frame/EventHandlerRegistry.cpp +++ b/third_party/WebKit/Source/core/frame/EventHandlerRegistry.cpp
@@ -59,7 +59,7 @@ // the pointer events never block scrolling and the compositor // only needs to know about the touch listeners. *result = TouchStartOrMoveEventPassive; -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() } else if (eventType == EventTypeNames::load || eventType == EventTypeNames::mousemove || eventType == EventTypeNames::touchstart) { @@ -224,7 +224,7 @@ hasEventHandlers(TouchEndOrCancelEventBlocking), hasEventHandlers(TouchEndOrCancelEventPassive))); break; -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() case EventsForTesting: break; #endif @@ -297,7 +297,7 @@ } void EventHandlerRegistry::checkConsistency() const { -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() for (size_t i = 0; i < EventHandlerClassCount; ++i) { EventHandlerClass handlerClass = static_cast<EventHandlerClass>(i); const EventTargetSet* targets = &m_targets[handlerClass]; @@ -316,7 +316,7 @@ } } } -#endif // ENABLE(ASSERT) +#endif // DCHECK_IS_ON() } } // namespace blink
diff --git a/third_party/WebKit/Source/core/frame/EventHandlerRegistry.h b/third_party/WebKit/Source/core/frame/EventHandlerRegistry.h index 94cd9ab..fd23b1a 100644 --- a/third_party/WebKit/Source/core/frame/EventHandlerRegistry.h +++ b/third_party/WebKit/Source/core/frame/EventHandlerRegistry.h
@@ -36,7 +36,7 @@ TouchStartOrMoveEventPassive, TouchEndOrCancelEventBlocking, TouchEndOrCancelEventPassive, -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() // Additional event categories for verifying handler tracking logic. EventsForTesting, #endif
diff --git a/third_party/WebKit/Source/core/frame/FrameHost.cpp b/third_party/WebKit/Source/core/frame/FrameHost.cpp index 9ca7e6d..ac2dae81 100644 --- a/third_party/WebKit/Source/core/frame/FrameHost.cpp +++ b/third_party/WebKit/Source/core/frame/FrameHost.cpp
@@ -173,7 +173,7 @@ visitor->trace(m_globalRootScrollerController); } -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() void checkFrameCountConsistency(int expectedFrameCount, Frame* frame) { ASSERT(expectedFrameCount >= 0); @@ -186,7 +186,7 @@ #endif int FrameHost::subframeCount() const { -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() checkFrameCountConsistency(m_subframeCount + 1, m_page->mainFrame()); #endif return m_subframeCount;
diff --git a/third_party/WebKit/Source/core/frame/FrameView.cpp b/third_party/WebKit/Source/core/frame/FrameView.cpp index 9985fcf..440e4e3 100644 --- a/third_party/WebKit/Source/core/frame/FrameView.cpp +++ b/third_party/WebKit/Source/core/frame/FrameView.cpp
@@ -178,9 +178,6 @@ m_layoutSizeFixedToFrameSize(true), m_didScrollTimer(this, &FrameView::didScrollTimerFired), m_needsUpdateWidgetGeometries(false), -#if ENABLE(ASSERT) - m_hasBeenDisposed(false), -#endif m_horizontalScrollbarMode(ScrollbarAuto), m_verticalScrollbarMode(ScrollbarAuto), m_horizontalScrollbarLock(false), @@ -369,7 +366,7 @@ if (ownerElement && ownerElement->ownedWidget() == this) ownerElement->setWidget(nullptr); -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() m_hasBeenDisposed = true; #endif }
diff --git a/third_party/WebKit/Source/core/frame/FrameView.h b/third_party/WebKit/Source/core/frame/FrameView.h index 983b3282..0dcff6e5 100644 --- a/third_party/WebKit/Source/core/frame/FrameView.h +++ b/third_party/WebKit/Source/core/frame/FrameView.h
@@ -1091,9 +1091,9 @@ bool m_needsUpdateWidgetGeometries; -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() // Verified when finalizing. - bool m_hasBeenDisposed; + bool m_hasBeenDisposed = false; #endif ScrollbarMode m_horizontalScrollbarMode;
diff --git a/third_party/WebKit/Source/core/frame/LocalFrame.cpp b/third_party/WebKit/Source/core/frame/LocalFrame.cpp index 1d711cb..8cff473 100644 --- a/third_party/WebKit/Source/core/frame/LocalFrame.cpp +++ b/third_party/WebKit/Source/core/frame/LocalFrame.cpp
@@ -179,7 +179,7 @@ DraggedNodeImageBuilder(const LocalFrame& localFrame, Node& node) : m_localFrame(&localFrame), m_node(&node) -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() , m_domTreeVersion(node.document().domTreeVersion()) #endif @@ -189,7 +189,7 @@ } ~DraggedNodeImageBuilder() { -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() DCHECK_EQ(m_domTreeVersion, m_node->document().domTreeVersion()); #endif for (Node& descendant : NodeTraversal::inclusiveDescendantsOf(*m_node)) @@ -197,7 +197,7 @@ } std::unique_ptr<DragImage> createImage() { -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() DCHECK_EQ(m_domTreeVersion, m_node->document().domTreeVersion()); #endif // Construct layout object for |m_node| with pseudo class "-webkit-drag" @@ -236,7 +236,7 @@ private: const Member<const LocalFrame> m_localFrame; const Member<Node> m_node; -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() const uint64_t m_domTreeVersion; #endif };
diff --git a/third_party/WebKit/Source/core/frame/SuspendableTimer.cpp b/third_party/WebKit/Source/core/frame/SuspendableTimer.cpp index 595a0726..31bf39f 100644 --- a/third_party/WebKit/Source/core/frame/SuspendableTimer.cpp +++ b/third_party/WebKit/Source/core/frame/SuspendableTimer.cpp
@@ -40,10 +40,6 @@ SuspendableObject(context), m_nextFireInterval(kNextFireIntervalInvalid), m_repeatInterval(0) -#if ENABLE(ASSERT) - , - m_suspended(false) -#endif { DCHECK(context); } @@ -60,7 +56,7 @@ } void SuspendableTimer::suspend() { -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() ASSERT(!m_suspended); m_suspended = true; #endif @@ -73,7 +69,7 @@ } void SuspendableTimer::resume() { -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() ASSERT(m_suspended); m_suspended = false; #endif
diff --git a/third_party/WebKit/Source/core/frame/SuspendableTimer.h b/third_party/WebKit/Source/core/frame/SuspendableTimer.h index b2803f4..d33a876 100644 --- a/third_party/WebKit/Source/core/frame/SuspendableTimer.h +++ b/third_party/WebKit/Source/core/frame/SuspendableTimer.h
@@ -51,8 +51,8 @@ double m_nextFireInterval; double m_repeatInterval; -#if ENABLE(ASSERT) - bool m_suspended; +#if DCHECK_IS_ON() + bool m_suspended = false; #endif };
diff --git a/third_party/WebKit/Source/core/frame/UseCounter.h b/third_party/WebKit/Source/core/frame/UseCounter.h index 2d1a149..1d02024 100644 --- a/third_party/WebKit/Source/core/frame/UseCounter.h +++ b/third_party/WebKit/Source/core/frame/UseCounter.h
@@ -1427,9 +1427,8 @@ V8PromiseConstructorReturnedUndefined = 1766, FormSubmittedWithUnclosedFormControl = 1767, DocumentCompleteURLHTTPContainingNewline = 1768, - DocumentCompleteURLHTTPContainingLessThan = 1769, DocumentCompleteURLHTTPContainingNewlineAndLessThan = 1770, - DocumentCompleteURLNonHTTPContainingNewlineOrLessThan = 1771, + DocumentCompleteURLNonHTTPContainingNewline = 1771, CSSSelectorInternalMediaControlsTextTrackList = 1772, CSSSelectorInternalMediaControlsTextTrackListItem = 1773, CSSSelectorInternalMediaControlsTextTrackListItemInput = 1774,
diff --git a/third_party/WebKit/Source/core/html/parser/BackgroundHTMLInputStream.h b/third_party/WebKit/Source/core/html/parser/BackgroundHTMLInputStream.h index 520c240..7749f61aa 100644 --- a/third_party/WebKit/Source/core/html/parser/BackgroundHTMLInputStream.h +++ b/third_party/WebKit/Source/core/html/parser/BackgroundHTMLInputStream.h
@@ -69,7 +69,7 @@ size_t numberOfSegmentsAlreadyAppended; size_t tokensExtractedSincePreviousCheckpoint; -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() bool isNull() const { return input.isEmpty() && !numberOfSegmentsAlreadyAppended; }
diff --git a/third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.cpp b/third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.cpp index 2c9759f..fd08697 100644 --- a/third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.cpp +++ b/third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.cpp
@@ -64,7 +64,7 @@ using namespace HTMLNames; -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() static void checkThatTokensAreSafeToSendToAnotherThread( const CompactHTMLTokenStream* tokens) { @@ -319,7 +319,7 @@ if (m_pendingTokens->isEmpty()) return false; -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() checkThatTokensAreSafeToSendToAnotherThread(m_pendingTokens.get()); checkThatPreloadsAreSafeToSendToAnotherThread(m_pendingPreloads); checkThatXSSInfosAreSafeToSendToAnotherThread(m_pendingXSSInfos);
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLToken.h b/third_party/WebKit/Source/core/html/parser/HTMLToken.h index 907b1fd3..10e70ed 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLToken.h +++ b/third_party/WebKit/Source/core/html/parser/HTMLToken.h
@@ -86,7 +86,7 @@ static constexpr int kInvalidOffset = -1; inline void clear() { -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() start = kInvalidOffset; end = kInvalidOffset; #endif
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLTreeBuilder.cpp b/third_party/WebKit/Source/core/html/parser/HTMLTreeBuilder.cpp index b7cec906..ce80c79 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLTreeBuilder.cpp +++ b/third_party/WebKit/Source/core/html/parser/HTMLTreeBuilder.cpp
@@ -220,9 +220,6 @@ ParserContentPolicy parserContentPolicy, const HTMLParserOptions& options) : m_framesetOk(true), -#if ENABLE(ASSERT) - m_isAttached(true), -#endif m_tree(parser->reentryPermit(), document, parserContentPolicy), m_insertionMode(InitialMode), m_originalInsertionMode(InitialMode), @@ -283,7 +280,7 @@ } void HTMLTreeBuilder::detach() { -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() // This call makes little sense in fragment mode, but for consistency // DocumentParser expects detach() to always be called before it's destroyed. m_isAttached = false;
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLTreeBuilder.h b/third_party/WebKit/Source/core/html/parser/HTMLTreeBuilder.h index 216416f..14efa78 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLTreeBuilder.h +++ b/third_party/WebKit/Source/core/html/parser/HTMLTreeBuilder.h
@@ -245,8 +245,8 @@ // https://html.spec.whatwg.org/#frameset-ok-flag bool m_framesetOk; -#if ENABLE(ASSERT) - bool m_isAttached; +#if DCHECK_IS_ON() + bool m_isAttached = true; #endif FragmentParsingContext m_fragmentContext; HTMLConstructionSite m_tree;
diff --git a/third_party/WebKit/Source/core/layout/FloatingObjects.cpp b/third_party/WebKit/Source/core/layout/FloatingObjects.cpp index 096621c..fa37c00 100644 --- a/third_party/WebKit/Source/core/layout/FloatingObjects.cpp +++ b/third_party/WebKit/Source/core/layout/FloatingObjects.cpp
@@ -527,7 +527,7 @@ if (m_placedFloatsTree.isInitialized()) m_placedFloatsTree.add(intervalForFloatingObject(floatingObject)); -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() floatingObject.setIsInPlacedTree(true); #endif markLowestFloatLogicalBottomCacheAsDirty(); @@ -543,7 +543,7 @@ } floatingObject.setIsPlaced(false); -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() floatingObject.setIsInPlacedTree(false); #endif markLowestFloatLogicalBottomCacheAsDirty();
diff --git a/third_party/WebKit/Source/core/layout/FloatingObjects.h b/third_party/WebKit/Source/core/layout/FloatingObjects.h index 7b213ee..c838dd1 100644 --- a/third_party/WebKit/Source/core/layout/FloatingObjects.h +++ b/third_party/WebKit/Source/core/layout/FloatingObjects.h
@@ -108,7 +108,7 @@ return m_frameRect; } -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() bool isInPlacedTree() const { return m_isInPlacedTree; } void setIsInPlacedTree(bool value) { m_isInPlacedTree = value; } #endif @@ -150,7 +150,7 @@ unsigned m_isDescendant : 1; unsigned m_isPlaced : 1; unsigned m_isLowestNonOverhangingFloatInChild : 1; -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() unsigned m_isInPlacedTree : 1; #endif };
diff --git a/third_party/WebKit/Source/core/layout/LayoutBlock.cpp b/third_party/WebKit/Source/core/layout/LayoutBlock.cpp index 9228cfb..2f64fed7 100644 --- a/third_party/WebKit/Source/core/layout/LayoutBlock.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
@@ -2116,7 +2116,7 @@ return true; } -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() void LayoutBlock::checkPositionedObjectsNeedLayout() { if (!gPositionedDescendantsMap) return;
diff --git a/third_party/WebKit/Source/core/layout/LayoutBlock.h b/third_party/WebKit/Source/core/layout/LayoutBlock.h index 82a3d60..99ff0167 100644 --- a/third_party/WebKit/Source/core/layout/LayoutBlock.h +++ b/third_party/WebKit/Source/core/layout/LayoutBlock.h
@@ -313,7 +313,7 @@ virtual LayoutUnit logicalRightSelectionOffset(const LayoutBlock* rootBlock, LayoutUnit position) const; -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() void checkPositionedObjectsNeedLayout(); #endif
diff --git a/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp b/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp index 0f6faf1..49d25e0 100644 --- a/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp
@@ -3356,7 +3356,7 @@ moveChildrenTo(block, inlineRunStart, child); } -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() for (LayoutObject* c = firstChild(); c; c = c->nextSibling()) ASSERT(!c->isInline()); #endif @@ -3576,7 +3576,7 @@ this)); floatingObject.originatingLine()->markDirty(); } -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() floatingObject.setOriginatingLine(nullptr); #endif }
diff --git a/third_party/WebKit/Source/core/layout/LayoutBox.cpp b/third_party/WebKit/Source/core/layout/LayoutBox.cpp index 9ef610e..882eadf 100644 --- a/third_party/WebKit/Source/core/layout/LayoutBox.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutBox.cpp
@@ -2444,7 +2444,7 @@ } static float getMaxWidthListMarker(const LayoutBox* layoutObject) { -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() ASSERT(layoutObject); Node* parentNode = layoutObject->generatingNode(); ASSERT(parentNode);
diff --git a/third_party/WebKit/Source/core/layout/LayoutGeometryMap.cpp b/third_party/WebKit/Source/core/layout/LayoutGeometryMap.cpp index ee0f643b..6c02660 100644 --- a/third_party/WebKit/Source/core/layout/LayoutGeometryMap.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutGeometryMap.cpp
@@ -62,7 +62,7 @@ } bool inFixed = false; -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() bool foundAncestor = !ancestor || (m_mapping.size() && m_mapping[0].m_layoutObject == ancestor); #endif @@ -73,7 +73,7 @@ // If container is the root LayoutView (step 0) we want to apply its fixed // position offset. if (i > 0 && currentStep.m_layoutObject == ancestor) { -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() foundAncestor = true; #endif break; @@ -153,7 +153,7 @@ result = transformState.lastPlanarQuad(); } -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() if (m_mapping.size() > 0) { const LayoutObject* lastLayoutObject = m_mapping.back().m_layoutObject; @@ -364,7 +364,7 @@ } } -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() bool LayoutGeometryMap::isTopmostLayoutView( const LayoutObject* layoutObject) const { if (!layoutObject->isLayoutView())
diff --git a/third_party/WebKit/Source/core/layout/LayoutGeometryMap.h b/third_party/WebKit/Source/core/layout/LayoutGeometryMap.h index d95e00c..17cc9b75 100644 --- a/third_party/WebKit/Source/core/layout/LayoutGeometryMap.h +++ b/third_party/WebKit/Source/core/layout/LayoutGeometryMap.h
@@ -105,7 +105,7 @@ void dumpSteps() const; #endif -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() bool isTopmostLayoutView(const LayoutObject*) const; #endif
diff --git a/third_party/WebKit/Source/core/layout/LayoutGrid.cpp b/third_party/WebKit/Source/core/layout/LayoutGrid.cpp index bd8979a..7a9dd5b0 100644 --- a/third_party/WebKit/Source/core/layout/LayoutGrid.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutGrid.cpp
@@ -105,7 +105,7 @@ m_gridItemsIndexesMap.set(&item, order); } -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() bool LayoutGrid::Grid::hasAnyGridItemPaintOrder() const { return !m_gridItemsIndexesMap.isEmpty(); } @@ -836,7 +836,7 @@ minIntrinsicSize += totalGuttersSize; maxIntrinsicSize += totalGuttersSize; -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() DCHECK(tracksAreWiderThanMinTrackBreadth(direction, sizingData)); #endif } @@ -1922,7 +1922,7 @@ : std::max(track->plannedSize(), track->sizeDuringDistribution())); } -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() bool LayoutGrid::tracksAreWiderThanMinTrackBreadth( GridTrackSizingDirection direction, GridSizingData& sizingData) const { @@ -2100,7 +2100,7 @@ Vector<LayoutBox*> autoMajorAxisAutoGridItems; Vector<LayoutBox*> specifiedMajorAxisAutoGridItems; -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() DCHECK(!grid.hasAnyGridItemPaintOrder()); #endif DCHECK(!grid.hasAnyOrthogonalGridItem()); @@ -2136,7 +2136,7 @@ } grid.setHasAnyOrthogonalGridItem(hasAnyOrthogonalGridItem); -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() if (grid.hasGridItems()) { DCHECK_GE(grid.numTracks(ForRows), GridPositionsResolver::explicitGridRowCount( @@ -2157,7 +2157,7 @@ grid.setNeedsItemsPlacement(false); -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() for (LayoutBox* child = grid.orderIterator().first(); child; child = grid.orderIterator().next()) { if (child->isOutOfFlowPositioned()) @@ -2564,7 +2564,7 @@ updateAutoMarginsInRowAxisIfNeeded(*child); const GridArea& area = sizingData.grid().gridItemArea(*child); -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() ASSERT(area.columns.startLine() < sizingData.columnTracks.size()); ASSERT(area.rows.startLine() < sizingData.rowTracks.size()); #endif
diff --git a/third_party/WebKit/Source/core/layout/LayoutGrid.h b/third_party/WebKit/Source/core/layout/LayoutGrid.h index d491a58..8edfa093 100644 --- a/third_party/WebKit/Source/core/layout/LayoutGrid.h +++ b/third_party/WebKit/Source/core/layout/LayoutGrid.h
@@ -320,7 +320,7 @@ int inlineBlockBaseline(LineDirectionMode) const override; bool isInlineBaselineAlignedChild(const LayoutBox* child) const; -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() bool tracksAreWiderThanMinTrackBreadth(GridTrackSizingDirection, GridSizingData&) const; #endif @@ -398,7 +398,7 @@ void setNeedsItemsPlacement(bool); bool needsItemsPlacement() const { return m_needsItemsPlacement; }; -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() bool hasAnyGridItemPaintOrder() const; #endif
diff --git a/third_party/WebKit/Source/core/layout/LayoutMedia.cpp b/third_party/WebKit/Source/core/layout/LayoutMedia.cpp index 2382c008..0c884a8 100644 --- a/third_party/WebKit/Source/core/layout/LayoutMedia.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutMedia.cpp
@@ -60,12 +60,12 @@ // out before the text track container. This is to ensure that the text // track rendering has an up-to-date position of the media controls for // overlap checking, see LayoutVTTCue. -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() bool seenTextTrackContainer = false; #endif for (LayoutObject* child = m_children.lastChild(); child; child = child->previousSibling()) { -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() if (child->node()->isMediaControls()) ASSERT(!seenTextTrackContainer); else if (child->node()->isTextTrackContainer())
diff --git a/third_party/WebKit/Source/core/layout/LayoutMultiColumnFlowThread.cpp b/third_party/WebKit/Source/core/layout/LayoutMultiColumnFlowThread.cpp index 8466376..434e957 100644 --- a/third_party/WebKit/Source/core/layout/LayoutMultiColumnFlowThread.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutMultiColumnFlowThread.cpp
@@ -139,7 +139,7 @@ } if (!object) return nullptr; -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() // Make sure that we didn't stumble into an inner multicol container. for (LayoutObject* walker = object->parent(); walker && walker != flowThread; walker = walker->parent()) @@ -188,7 +188,7 @@ } if (!object || object == flowThread) return nullptr; -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() // Make sure that we didn't stumble into an inner multicol container. for (LayoutObject* walker = object->parent(); walker && walker != flowThread; walker = walker->parent())
diff --git a/third_party/WebKit/Source/core/layout/LayoutTableCell.h b/third_party/WebKit/Source/core/layout/LayoutTableCell.h index 984f98fc..e3d500a 100644 --- a/third_party/WebKit/Source/core/layout/LayoutTableCell.h +++ b/third_party/WebKit/Source/core/layout/LayoutTableCell.h
@@ -278,7 +278,7 @@ return style()->borderEnd(); } -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() bool isFirstOrLastCellInRow() const { return !table()->cellAfter(this) || !table()->cellBefore(this); }
diff --git a/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp b/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp index 9bf28ba..e7e3bd17 100644 --- a/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp
@@ -1267,7 +1267,7 @@ m_overflow.reset(); m_overflowingCells.clear(); m_forceSlowPaintPathWithOverflowingCell = false; -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() bool hasOverflowingCell = false; #endif // Now that our height has been determined, add in overflow from cells. @@ -1280,7 +1280,7 @@ if (r < totalRows - 1 && cell == primaryCellAt(r + 1, c)) continue; addOverflowFromChild(cell); -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() hasOverflowingCell |= cell->hasVisualOverflow(); #endif if (cell->hasVisualOverflow() &&
diff --git a/third_party/WebKit/Source/core/layout/LayoutText.cpp b/third_party/WebKit/Source/core/layout/LayoutText.cpp index 0aae54a30..8920eab 100644 --- a/third_party/WebKit/Source/core/layout/LayoutText.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutText.cpp
@@ -174,7 +174,7 @@ view()->frameView()->incrementVisuallyNonEmptyCharacterCount(m_text.length()); } -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() LayoutText::~LayoutText() { ASSERT(!m_firstTextBox); @@ -1949,7 +1949,7 @@ return len; } -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() void LayoutText::checkConsistency() const { #ifdef CHECK_CONSISTENCY
diff --git a/third_party/WebKit/Source/core/layout/LayoutText.h b/third_party/WebKit/Source/core/layout/LayoutText.h index 7b9184c..6c10d9e 100644 --- a/third_party/WebKit/Source/core/layout/LayoutText.h +++ b/third_party/WebKit/Source/core/layout/LayoutText.h
@@ -72,7 +72,7 @@ // not the content of the Text node, updating text-transform property // doesn't re-transform the string. LayoutText(Node*, PassRefPtr<StringImpl>); -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() ~LayoutText() override; #endif @@ -343,7 +343,7 @@ DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutText, isText()); -#if !ENABLE(ASSERT) +#if !DCHECK_IS_ON() inline void LayoutText::checkConsistency() const {} #endif
diff --git a/third_party/WebKit/Source/core/layout/LayoutView.cpp b/third_party/WebKit/Source/core/layout/LayoutView.cpp index a5f630b1..d550901f 100644 --- a/third_party/WebKit/Source/core/layout/LayoutView.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutView.cpp
@@ -192,12 +192,12 @@ LayoutBlockFlow::layout(); -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() checkLayoutState(); #endif } -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() void LayoutView::checkLayoutState() { ASSERT(!m_layoutState->next()); } @@ -294,7 +294,7 @@ } } -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() checkLayoutState(); #endif clearNeedsLayout();
diff --git a/third_party/WebKit/Source/core/layout/LayoutView.h b/third_party/WebKit/Source/core/layout/LayoutView.h index 4faa7b0..0317ac1 100644 --- a/third_party/WebKit/Source/core/layout/LayoutView.h +++ b/third_party/WebKit/Source/core/layout/LayoutView.h
@@ -257,7 +257,7 @@ const LayoutPoint& layerOffset) const override; void layoutContent(); -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() void checkLayoutState(); #endif
diff --git a/third_party/WebKit/Source/core/layout/PaintInvalidationState.cpp b/third_party/WebKit/Source/core/layout/PaintInvalidationState.cpp index bbf3b8a..4e53b171 100644 --- a/third_party/WebKit/Source/core/layout/PaintInvalidationState.cpp +++ b/third_party/WebKit/Source/core/layout/PaintInvalidationState.cpp
@@ -48,10 +48,6 @@ m_containerForAbsolutePosition(layoutView), m_pendingDelayedPaintInvalidations(pendingDelayedPaintInvalidations), m_paintingLayer(*layoutView.layer()) -#if ENABLE(ASSERT) - , - m_didUpdateForChildren(false) -#endif #ifdef CHECK_FAST_PATH_SLOW_PATH_EQUALITY , m_canCheckFastPathSlowPathEquality(layoutView == @@ -99,10 +95,6 @@ m_pendingDelayedPaintInvalidations( parentState.m_pendingDelayedPaintInvalidations), m_paintingLayer(parentState.childPaintingLayer(currentObject)) -#if ENABLE(ASSERT) - , - m_didUpdateForChildren(false) -#endif #ifdef CHECK_FAST_PATH_SLOW_PATH_EQUALITY , m_canCheckFastPathSlowPathEquality( @@ -118,13 +110,13 @@ // LayoutBlock::invalidatePaintOfSubtreesIfNeeded()). // TODO(wangxianzhu): Avoid this for // RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled(). -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() m_didUpdateForChildren = parentState.m_didUpdateForChildren; #endif return; } -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() DCHECK(parentState.m_didUpdateForChildren); #endif @@ -313,7 +305,7 @@ } void PaintInvalidationState::updateForChildren(PaintInvalidationReason reason) { -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() DCHECK(!m_didUpdateForChildren); m_didUpdateForChildren = true; #endif @@ -426,7 +418,7 @@ LayoutPoint PaintInvalidationState::computeLocationInBacking( const LayoutPoint& visualRectLocation) const { -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() DCHECK(!m_didUpdateForChildren); #endif @@ -459,7 +451,7 @@ } LayoutRect PaintInvalidationState::computeVisualRectInBacking() const { -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() DCHECK(!m_didUpdateForChildren); #endif @@ -519,7 +511,7 @@ void PaintInvalidationState::mapLocalRectToPaintInvalidationContainer( LayoutRect& rect) const { -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() DCHECK(!m_didUpdateForChildren); #endif
diff --git a/third_party/WebKit/Source/core/layout/PaintInvalidationState.h b/third_party/WebKit/Source/core/layout/PaintInvalidationState.h index c887b12..46b3be9 100644 --- a/third_party/WebKit/Source/core/layout/PaintInvalidationState.h +++ b/third_party/WebKit/Source/core/layout/PaintInvalidationState.h
@@ -170,11 +170,11 @@ PaintLayer& m_paintingLayer; -#if ENABLE(ASSERT) - bool m_didUpdateForChildren; +#if DCHECK_IS_ON() + bool m_didUpdateForChildren = false; #endif -#if ENABLE(ASSERT) && !defined(NDEBUG) +#if DCHECK_IS_ON() && !defined(NDEBUG) // #define CHECK_FAST_PATH_SLOW_PATH_EQUALITY #endif
diff --git a/third_party/WebKit/Source/core/layout/TextAutosizer.cpp b/third_party/WebKit/Source/core/layout/TextAutosizer.cpp index 48a65aec..361403e 100644 --- a/third_party/WebKit/Source/core/layout/TextAutosizer.cpp +++ b/third_party/WebKit/Source/core/layout/TextAutosizer.cpp
@@ -301,7 +301,7 @@ TextAutosizer::TextAutosizer(const Document* document) : m_document(document), m_firstBlockToBeginLayout(nullptr), -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() m_blocksThatHaveBegunLayout(), #endif m_clusterStack(), @@ -360,7 +360,7 @@ TextAutosizer::BeginLayoutBehavior TextAutosizer::prepareForLayout( LayoutBlock* block) { -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() m_blocksThatHaveBegunLayout.add(block); #endif @@ -385,7 +385,7 @@ if (layoutObject->isLayoutBlock()) { LayoutBlock* block = toLayoutBlock(layoutObject); -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() m_blocksThatHaveBegunLayout.add(block); #endif if (Cluster* cluster = maybeCreateCluster(block)) @@ -452,7 +452,7 @@ m_firstBlockToBeginLayout = nullptr; m_clusterStack.clear(); m_stylesRetainedDuringLayout.clear(); -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() m_blocksThatHaveBegunLayout.clear(); #endif // Tables can create two layout scopes for the same block so the isEmpty @@ -1240,7 +1240,7 @@ m_hasTableAncestor(root->isTableCell() || (m_parent && m_parent->m_hasTableAncestor)) {} -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() void TextAutosizer::FingerprintMapper::assertMapsAreConsistent() { // For each fingerprint -> block mapping in m_blocksForFingerprint we should // have an associated map from block -> fingerprint in m_fingerprints. @@ -1264,7 +1264,7 @@ remove(layoutObject); m_fingerprints.set(layoutObject, fingerprint); -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() assertMapsAreConsistent(); #endif } @@ -1279,7 +1279,7 @@ if (addResult.isNewEntry) addResult.storedValue->value = WTF::wrapUnique(new BlockSet); addResult.storedValue->value->add(block); -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() assertMapsAreConsistent(); #endif } @@ -1308,7 +1308,7 @@ m_superclusters.remove(superclusterIter); } } -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() assertMapsAreConsistent(); #endif return true;
diff --git a/third_party/WebKit/Source/core/layout/TextAutosizer.h b/third_party/WebKit/Source/core/layout/TextAutosizer.h index c3fb67e..0c59502 100644 --- a/third_party/WebKit/Source/core/layout/TextAutosizer.h +++ b/third_party/WebKit/Source/core/layout/TextAutosizer.h
@@ -253,7 +253,7 @@ // Superclusters that need to be checked for consistency at the start of the // next layout. HashSet<Supercluster*> m_potentiallyInconsistentSuperclusters; -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() void assertMapsAreConsistent(); #endif }; @@ -347,7 +347,7 @@ Member<const Document> m_document; const LayoutBlock* m_firstBlockToBeginLayout; -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() // Used to ensure we don't compute properties of a block before beginLayout() // is called on it. ConstBlockSet m_blocksThatHaveBegunLayout;
diff --git a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp index c8847b8e..8a87af32 100644 --- a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp +++ b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
@@ -2471,7 +2471,7 @@ // FIXME: We shouldn't be called with a stale z-order lists. See bug 85512. parent->stackingNode()->updateLayerListsIfNeeded(); -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() LayerListMutationDetector mutationChecker(parent->stackingNode()); #endif @@ -3119,7 +3119,7 @@ // ContentLayerDelegate::paintContents) try to paint throttled content. DocumentLifecycle::AllowThrottlingScope allowThrottling( m_owningLayer.layoutObject()->document().lifecycle()); -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() // FIXME: once the state machine is ready, this can be removed and we can // refer to that instead. if (Page* page = layoutObject()->frame()->page()) @@ -3197,7 +3197,7 @@ InspectorInstrumentation::didPaint(m_owningLayer.layoutObject()->frame(), graphicsLayer, context, LayoutRect(interestRect)); -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() if (Page* page = layoutObject()->frame()->page()) page->setIsPainting(false); #endif @@ -3258,7 +3258,7 @@ return client ? client->isTrackingRasterInvalidations() : false; } -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() void CompositedLayerMapping::verifyNotPainting() { ASSERT(!layoutObject()->frame()->page() || !layoutObject()->frame()->page()->isPainting()); @@ -3365,7 +3365,7 @@ m_squashedLayers.remove(layerIndex); } -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() bool CompositedLayerMapping::verifyLayerInSquashingVector( const PaintLayer* layer) { for (size_t layerIndex = 0; layerIndex < m_squashedLayers.size();
diff --git a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.h b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.h index 1431b5d..312c9fa9 100644 --- a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.h +++ b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.h
@@ -191,7 +191,7 @@ bool updateSquashingLayerAssignment(PaintLayer* squashedLayer, size_t nextSquashedLayerIndex); void removeLayerFromSquashingGraphicsLayer(const PaintLayer*); -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() bool verifyLayerInSquashingVector(const PaintLayer*); #endif @@ -216,7 +216,7 @@ bool isTrackingRasterInvalidations() const override; -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() void verifyNotPainting() override; #endif @@ -266,7 +266,7 @@ GraphicsLayerUpdater::UpdateType updateTypeForChildren( GraphicsLayerUpdater::UpdateType) const; -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() void assertNeedsToUpdateGraphicsLayerBitsCleared() { ASSERT(m_pendingUpdateScope == GraphicsLayerUpdateNone); }
diff --git a/third_party/WebKit/Source/core/layout/compositing/CompositingInputsUpdater.cpp b/third_party/WebKit/Source/core/layout/compositing/CompositingInputsUpdater.cpp index 28324a3..2c1b53b 100644 --- a/third_party/WebKit/Source/core/layout/compositing/CompositingInputsUpdater.cpp +++ b/third_party/WebKit/Source/core/layout/compositing/CompositingInputsUpdater.cpp
@@ -249,7 +249,7 @@ m_geometryMap.popMappingsToAncestor(layer->parent()); } -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() void CompositingInputsUpdater::assertNeedsCompositingInputsUpdateBitsCleared( PaintLayer* layer) {
diff --git a/third_party/WebKit/Source/core/layout/compositing/CompositingInputsUpdater.h b/third_party/WebKit/Source/core/layout/compositing/CompositingInputsUpdater.h index cf67d3a..5a0f189 100644 --- a/third_party/WebKit/Source/core/layout/compositing/CompositingInputsUpdater.h +++ b/third_party/WebKit/Source/core/layout/compositing/CompositingInputsUpdater.h
@@ -21,7 +21,7 @@ void update(); -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() static void assertNeedsCompositingInputsUpdateBitsCleared(PaintLayer*); #endif
diff --git a/third_party/WebKit/Source/core/layout/compositing/CompositingRequirementsUpdater.cpp b/third_party/WebKit/Source/core/layout/compositing/CompositingRequirementsUpdater.cpp index ffc437e5..69a2df2 100644 --- a/third_party/WebKit/Source/core/layout/compositing/CompositingRequirementsUpdater.cpp +++ b/third_party/WebKit/Source/core/layout/compositing/CompositingRequirementsUpdater.cpp
@@ -157,7 +157,7 @@ }; static bool requiresCompositingOrSquashing(CompositingReasons reasons) { -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() bool fastAnswer = reasons != CompositingReasonNone; bool slowAnswer = requiresCompositing(reasons) || requiresSquashing(reasons); DCHECK_EQ(slowAnswer, fastAnswer); @@ -379,7 +379,7 @@ childRecursionData.m_testingOverlap = true; } -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() LayerListMutationDetector mutationChecker(layer->stackingNode()); #endif
diff --git a/third_party/WebKit/Source/core/layout/compositing/GraphicsLayerTreeBuilder.cpp b/third_party/WebKit/Source/core/layout/compositing/GraphicsLayerTreeBuilder.cpp index cf28249..1fd04dc 100644 --- a/third_party/WebKit/Source/core/layout/compositing/GraphicsLayerTreeBuilder.cpp +++ b/third_party/WebKit/Source/core/layout/compositing/GraphicsLayerTreeBuilder.cpp
@@ -71,7 +71,7 @@ infoForChildren.enclosingCompositedLayer = &layer; } -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() LayerListMutationDetector mutationChecker(layer.stackingNode()); #endif
diff --git a/third_party/WebKit/Source/core/layout/compositing/GraphicsLayerUpdater.cpp b/third_party/WebKit/Source/core/layout/compositing/GraphicsLayerUpdater.cpp index 001c0fb..b9951cb 100644 --- a/third_party/WebKit/Source/core/layout/compositing/GraphicsLayerUpdater.cpp +++ b/third_party/WebKit/Source/core/layout/compositing/GraphicsLayerUpdater.cpp
@@ -120,7 +120,7 @@ layersNeedingPaintInvalidation); } -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() void GraphicsLayerUpdater::assertNeedsToUpdateGraphicsLayerBitsCleared( PaintLayer& layer) {
diff --git a/third_party/WebKit/Source/core/layout/compositing/GraphicsLayerUpdater.h b/third_party/WebKit/Source/core/layout/compositing/GraphicsLayerUpdater.h index 1a3aaa0a..69122d8 100644 --- a/third_party/WebKit/Source/core/layout/compositing/GraphicsLayerUpdater.h +++ b/third_party/WebKit/Source/core/layout/compositing/GraphicsLayerUpdater.h
@@ -50,7 +50,7 @@ bool needsRebuildTree() const { return m_needsRebuildTree; } -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() static void assertNeedsToUpdateGraphicsLayerBitsCleared(PaintLayer&); #endif
diff --git a/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.cpp b/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.cpp index 0938032..d649037 100644 --- a/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.cpp +++ b/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.cpp
@@ -234,7 +234,7 @@ scrollableArea->updateCompositorScrollAnimations(); } -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() ASSERT(lifecycle().state() == DocumentLifecycle::CompositingClean); assertNoUnresolvedDirtyBits(); for (Frame* child = m_layoutView.frameView()->frame().tree().firstChild(); @@ -271,7 +271,7 @@ rootLayer()->setNeedsCompositingInputsUpdate(); } -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() void PaintLayerCompositor::assertNoUnresolvedDirtyBits() { ASSERT(m_pendingUpdateType == CompositingUpdateNone); @@ -325,7 +325,7 @@ if (updateType >= CompositingUpdateAfterCompositingInputChange) CompositingInputsUpdater(rootLayer()).update(); -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() CompositingInputsUpdater::assertNeedsCompositingInputsUpdateBitsCleared( rootLayer()); #endif @@ -366,7 +366,7 @@ if (updateType >= CompositingUpdateAfterCompositingInputChange) { CompositingInputsUpdater(updateRoot).update(); -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() // FIXME: Move this check to the end of the compositing update. CompositingInputsUpdater::assertNeedsCompositingInputsUpdateBitsCleared( updateRoot); @@ -423,7 +423,7 @@ if (updater.needsRebuildTree()) updateType = std::max(updateType, CompositingUpdateRebuildTree); -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() // FIXME: Move this check to the end of the compositing update. GraphicsLayerUpdater::assertNeedsToUpdateGraphicsLayerBitsCleared( *updateRoot); @@ -1003,7 +1003,7 @@ void PaintLayerCompositor::setTracksRasterInvalidations( bool tracksRasterInvalidations) { -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() FrameView* view = m_layoutView.frameView(); ASSERT(lifecycle().state() == DocumentLifecycle::PaintClean || (view && view->shouldThrottleRendering()));
diff --git a/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.h b/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.h index 3061461..2b311e82 100644 --- a/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.h +++ b/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.h
@@ -194,7 +194,7 @@ bool inOverlayFullscreenVideo() const { return m_inOverlayFullscreenVideo; } private: -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() void assertNoUnresolvedDirtyBits(); #endif
diff --git a/third_party/WebKit/Source/core/layout/line/InlineBox.cpp b/third_party/WebKit/Source/core/layout/line/InlineBox.cpp index ba2aa25..97ae552 100644 --- a/third_party/WebKit/Source/core/layout/line/InlineBox.cpp +++ b/third_party/WebKit/Source/core/layout/line/InlineBox.cpp
@@ -43,7 +43,7 @@ void* a[4]; LayoutPoint b; LayoutUnit c; -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() bool f; #endif }; @@ -51,13 +51,11 @@ static_assert(sizeof(InlineBox) == sizeof(SameSizeAsInlineBox), "InlineBox should stay small"); -#if ENABLE(ASSERT) - +#if DCHECK_IS_ON() InlineBox::~InlineBox() { if (!m_hasBadParent && m_parent) m_parent->setHasBadChildList(); } - #endif DISABLE_CFI_PERF
diff --git a/third_party/WebKit/Source/core/layout/line/InlineBox.h b/third_party/WebKit/Source/core/layout/line/InlineBox.h index 244049e..16a2ed28 100644 --- a/third_party/WebKit/Source/core/layout/line/InlineBox.h +++ b/third_party/WebKit/Source/core/layout/line/InlineBox.h
@@ -51,10 +51,6 @@ m_parent(nullptr), m_lineLayoutItem(obj), m_logicalWidth() -#if ENABLE(ASSERT) - , - m_hasBadParent(false) -#endif { } @@ -76,10 +72,6 @@ m_lineLayoutItem(item), m_location(topLeft), m_logicalWidth(logicalWidth) -#if ENABLE(ASSERT) - , - m_hasBadParent(false) -#endif { } @@ -333,7 +325,7 @@ LayoutUnit& truncatedWidth, bool&); -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() void setHasBadParent(); #endif @@ -549,16 +541,16 @@ LayoutUnit m_logicalWidth; private: -#if ENABLE(ASSERT) - bool m_hasBadParent; +#if DCHECK_IS_ON() + bool m_hasBadParent = false; #endif }; -#if !ENABLE(ASSERT) +#if !DCHECK_IS_ON() inline InlineBox::~InlineBox() {} #endif -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() inline void InlineBox::setHasBadParent() { m_hasBadParent = true; }
diff --git a/third_party/WebKit/Source/core/layout/line/InlineFlowBox.cpp b/third_party/WebKit/Source/core/layout/line/InlineFlowBox.cpp index 0bb27d46..a3e77bf 100644 --- a/third_party/WebKit/Source/core/layout/line/InlineFlowBox.cpp +++ b/third_party/WebKit/Source/core/layout/line/InlineFlowBox.cpp
@@ -51,14 +51,12 @@ static_assert(sizeof(InlineFlowBox) == sizeof(SameSizeAsInlineFlowBox), "InlineFlowBox should stay small"); -#if ENABLE(ASSERT) - +#if DCHECK_IS_ON() InlineFlowBox::~InlineFlowBox() { if (!m_hasBadChildList) for (InlineBox* child = firstChild(); child; child = child->nextOnLine()) child->setHasBadParent(); } - #endif LayoutUnit InlineFlowBox::getFlowSpacingLogicalWidth() { @@ -227,13 +225,13 @@ while (child) { ASSERT(this == child->parent()); next = child->nextOnLine(); -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() child->setParent(nullptr); #endif child->deleteLine(); child = next; } -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() m_firstChild = nullptr; m_lastChild = nullptr; #endif @@ -1637,7 +1635,7 @@ #endif -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() void InlineFlowBox::checkConsistency() const { #ifdef CHECK_CONSISTENCY ASSERT(!m_hasBadChildList);
diff --git a/third_party/WebKit/Source/core/layout/line/InlineFlowBox.h b/third_party/WebKit/Source/core/layout/line/InlineFlowBox.h index 3c65757..acf143bc 100644 --- a/third_party/WebKit/Source/core/layout/line/InlineFlowBox.h +++ b/third_party/WebKit/Source/core/layout/line/InlineFlowBox.h
@@ -59,7 +59,7 @@ m_lineBreakBidiStatusLastStrong(WTF::Unicode::LeftToRight), m_lineBreakBidiStatusLast(WTF::Unicode::LeftToRight), m_isFirstAfterPageBreak(false) -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() , m_hasBadChildList(false) #endif @@ -77,7 +77,7 @@ m_hasTextDescendants = m_hasTextChildren; } -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() ~InlineFlowBox() override; #endif @@ -474,7 +474,7 @@ // End of RootInlineBox-specific members. -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() private: unsigned m_hasBadChildList : 1; #endif @@ -482,12 +482,12 @@ DEFINE_INLINE_BOX_TYPE_CASTS(InlineFlowBox); -#if !ENABLE(ASSERT) +#if !DCHECK_IS_ON() inline void InlineFlowBox::checkConsistency() const {} #endif inline void InlineFlowBox::setHasBadChildList() { -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() m_hasBadChildList = true; #endif }
diff --git a/third_party/WebKit/Source/core/layout/line/LineBoxList.cpp b/third_party/WebKit/Source/core/layout/line/LineBoxList.cpp index 7938afb..77b3069d 100644 --- a/third_party/WebKit/Source/core/layout/line/LineBoxList.cpp +++ b/third_party/WebKit/Source/core/layout/line/LineBoxList.cpp
@@ -40,7 +40,7 @@ namespace blink { -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() LineBoxList::~LineBoxList() { ASSERT(!m_firstLineBox); ASSERT(!m_lastLineBox); @@ -364,7 +364,7 @@ } } -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() void LineBoxList::checkConsistency() const { #ifdef CHECK_CONSISTENCY const InlineFlowBox* prev = nullptr;
diff --git a/third_party/WebKit/Source/core/layout/line/LineBoxList.h b/third_party/WebKit/Source/core/layout/line/LineBoxList.h index 788bb5cf..4ab8259f 100644 --- a/third_party/WebKit/Source/core/layout/line/LineBoxList.h +++ b/third_party/WebKit/Source/core/layout/line/LineBoxList.h
@@ -50,7 +50,7 @@ public: LineBoxList() : m_firstLineBox(nullptr), m_lastLineBox(nullptr) {} -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() ~LineBoxList(); #endif @@ -100,7 +100,7 @@ InlineFlowBox* m_lastLineBox; }; -#if !ENABLE(ASSERT) +#if !DCHECK_IS_ON() inline void LineBoxList::checkConsistency() const {} #endif
diff --git a/third_party/WebKit/Source/core/layout/svg/LayoutSVGText.cpp b/third_party/WebKit/Source/core/layout/svg/LayoutSVGText.cpp index f732e1d8..ec616f6 100644 --- a/third_party/WebKit/Source/core/layout/svg/LayoutSVGText.cpp +++ b/third_party/WebKit/Source/core/layout/svg/LayoutSVGText.cpp
@@ -166,7 +166,7 @@ static inline void checkDescendantTextNodeConsistency( LayoutSVGText& text, Vector<LayoutSVGInlineText*>& expectedDescendantTextNodes) { -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() Vector<LayoutSVGInlineText*> newDescendantTextNodes; collectDescendantTextNodes(text, newDescendantTextNodes); ASSERT(newDescendantTextNodes == expectedDescendantTextNodes);
diff --git a/third_party/WebKit/Source/core/page/Page.cpp b/third_party/WebKit/Source/core/page/Page.cpp index 50684c3..671df37 100644 --- a/third_party/WebKit/Source/core/page/Page.cpp +++ b/third_party/WebKit/Source/core/page/Page.cpp
@@ -135,9 +135,6 @@ m_deviceScaleFactor(1), m_visibilityState(PageVisibilityStateVisible), m_isCursorVisible(true), -#if ENABLE(ASSERT) - m_isPainting(false), -#endif m_frameHost(FrameHost::create(*this)) { ASSERT(m_editorClient);
diff --git a/third_party/WebKit/Source/core/page/Page.h b/third_party/WebKit/Source/core/page/Page.h index 918050f7..133260a 100644 --- a/third_party/WebKit/Source/core/page/Page.h +++ b/third_party/WebKit/Source/core/page/Page.h
@@ -213,7 +213,7 @@ bool isCursorVisible() const; void setIsCursorVisible(bool isVisible) { m_isCursorVisible = isVisible; } -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() void setIsPainting(bool painting) { m_isPainting = painting; } bool isPainting() const { return m_isPainting; } #endif @@ -295,8 +295,8 @@ bool m_isCursorVisible; -#if ENABLE(ASSERT) - bool m_isPainting; +#if DCHECK_IS_ON() + bool m_isPainting = false; #endif // A pointer to all the interfaces provided to in-process Frames for this
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp b/third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp index b2f4800..5063ae6 100644 --- a/third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp +++ b/third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp
@@ -813,7 +813,7 @@ if (!m_paintLayer.hasSelfPaintingLayerDescendant()) return result; -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() LayerListMutationDetector mutationChecker(m_paintLayer.stackingNode()); #endif
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.h b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.h index 5fdb0e3..dd91069 100644 --- a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.h +++ b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.h
@@ -592,7 +592,7 @@ // MainThreadScrollingReason due to the properties of the LayoutObject uint32_t m_reasons; -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() bool m_hasBeenDisposed; #endif };
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerStackingNode.cpp b/third_party/WebKit/Source/core/paint/PaintLayerStackingNode.cpp index a026998..55b1015 100644 --- a/third_party/WebKit/Source/core/paint/PaintLayerStackingNode.cpp +++ b/third_party/WebKit/Source/core/paint/PaintLayerStackingNode.cpp
@@ -74,7 +74,7 @@ } PaintLayerStackingNode::~PaintLayerStackingNode() { -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() if (!layoutObject()->documentBeingDestroyed()) { DCHECK(!isInStackingParentZOrderLists()); @@ -100,7 +100,7 @@ #endif DCHECK(isStackingContext()); -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() updateStackingParentForZOrderLists(0); #endif @@ -167,7 +167,7 @@ } } -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() updateStackingParentForZOrderLists(this); #endif @@ -195,7 +195,7 @@ } } -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() bool PaintLayerStackingNode::isInStackingParentZOrderLists() const { if (!m_stackingParent || m_stackingParent->zOrderListsDirty()) return false;
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerStackingNode.h b/third_party/WebKit/Source/core/paint/PaintLayerStackingNode.h index 3eb66f98..05c043b 100644 --- a/third_party/WebKit/Source/core/paint/PaintLayerStackingNode.h +++ b/third_party/WebKit/Source/core/paint/PaintLayerStackingNode.h
@@ -132,7 +132,7 @@ PaintLayer* layer() const { return m_layer; } -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() bool layerListMutationAllowed() const { return m_layerListMutationAllowed; } void setLayerListMutationAllowed(bool flag) { m_layerListMutationAllowed = flag; @@ -161,7 +161,7 @@ std::unique_ptr<Vector<PaintLayerStackingNode*>>& posZOrderList, std::unique_ptr<Vector<PaintLayerStackingNode*>>& negZOrderList); -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() bool isInStackingParentZOrderLists() const; void updateStackingParentForZOrderLists( PaintLayerStackingNode* stackingParent); @@ -199,7 +199,7 @@ // to style change. bool m_isStacked : 1; -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() bool m_layerListMutationAllowed : 1; PaintLayerStackingNode* m_stackingParent; #endif @@ -208,7 +208,7 @@ inline void PaintLayerStackingNode::clearZOrderLists() { DCHECK(!isStackingContext()); -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() updateStackingParentForZOrderLists(0); #endif @@ -229,7 +229,7 @@ rebuildZOrderLists(); } -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() class LayerListMutationDetector { public: explicit LayerListMutationDetector(PaintLayerStackingNode* stackingNode)
diff --git a/third_party/WebKit/Source/core/paint/SVGPaintContext.cpp b/third_party/WebKit/Source/core/paint/SVGPaintContext.cpp index 9e9dc8a..1f2dc166 100644 --- a/third_party/WebKit/Source/core/paint/SVGPaintContext.cpp +++ b/third_party/WebKit/Source/core/paint/SVGPaintContext.cpp
@@ -57,7 +57,7 @@ } bool SVGPaintContext::applyClipMaskAndFilterIfNecessary() { -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() DCHECK(!m_applyClipMaskAndFilterIfNecessaryCalled); m_applyClipMaskAndFilterIfNecessaryCalled = true; #endif
diff --git a/third_party/WebKit/Source/core/paint/SVGPaintContext.h b/third_party/WebKit/Source/core/paint/SVGPaintContext.h index 45f80cb7..1420fc9 100644 --- a/third_party/WebKit/Source/core/paint/SVGPaintContext.h +++ b/third_party/WebKit/Source/core/paint/SVGPaintContext.h
@@ -104,10 +104,6 @@ m_paintInfo(paintInfo), m_filter(nullptr), m_masker(nullptr) -#if ENABLE(ASSERT) - , - m_applyClipMaskAndFilterIfNecessaryCalled(false) -#endif { } @@ -157,8 +153,8 @@ Optional<ClipPathClipper> m_clipPathClipper; std::unique_ptr<SVGFilterRecordingContext> m_filterRecordingContext; Optional<ScopedPaintChunkProperties> m_scopedPaintChunkProperties; -#if ENABLE(ASSERT) - bool m_applyClipMaskAndFilterIfNecessaryCalled; +#if DCHECK_IS_ON() + bool m_applyClipMaskAndFilterIfNecessaryCalled = false; #endif };
diff --git a/third_party/WebKit/Source/core/style/GridArea.h b/third_party/WebKit/Source/core/style/GridArea.h index 538bd0f..bbc1f97e 100644 --- a/third_party/WebKit/Source/core/style/GridArea.h +++ b/third_party/WebKit/Source/core/style/GridArea.h
@@ -133,7 +133,7 @@ enum GridSpanType { UntranslatedDefinite, TranslatedDefinite, Indefinite }; GridSpan(int startLine, int endLine, GridSpanType type) : m_type(type) { -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() ASSERT(startLine < endLine); if (type == TranslatedDefinite) { ASSERT(startLine >= 0);
diff --git a/third_party/WebKit/Source/core/svg/SVGDocumentExtensions.cpp b/third_party/WebKit/Source/core/svg/SVGDocumentExtensions.cpp index d6b7b67..2314a27 100644 --- a/third_party/WebKit/Source/core/svg/SVGDocumentExtensions.cpp +++ b/third_party/WebKit/Source/core/svg/SVGDocumentExtensions.cpp
@@ -33,10 +33,6 @@ SVGDocumentExtensions::SVGDocumentExtensions(Document* document) : m_document(document) -#if ENABLE(ASSERT) - , - m_inRelativeLengthSVGRootsInvalidation(false) -#endif { } @@ -259,7 +255,7 @@ void SVGDocumentExtensions::invalidateSVGRootsWithRelativeLengthDescendents( SubtreeLayoutScope* scope) { ASSERT(!m_inRelativeLengthSVGRootsInvalidation); -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() AutoReset<bool> inRelativeLengthSVGRootsChange( &m_inRelativeLengthSVGRootsInvalidation, true); #endif
diff --git a/third_party/WebKit/Source/core/svg/SVGDocumentExtensions.h b/third_party/WebKit/Source/core/svg/SVGDocumentExtensions.h index 482f8d7..7a4bce9 100644 --- a/third_party/WebKit/Source/core/svg/SVGDocumentExtensions.h +++ b/third_party/WebKit/Source/core/svg/SVGDocumentExtensions.h
@@ -95,8 +95,8 @@ // Root SVG elements with relative length descendants. HeapHashSet<Member<SVGSVGElement>> m_relativeLengthSVGRoots; FloatPoint m_translate; -#if ENABLE(ASSERT) - bool m_inRelativeLengthSVGRootsInvalidation; +#if DCHECK_IS_ON() + bool m_inRelativeLengthSVGRootsInvalidation = false; #endif public:
diff --git a/third_party/WebKit/Source/core/svg/SVGElement.cpp b/third_party/WebKit/Source/core/svg/SVGElement.cpp index ca28a2c6..5ebdd6f1b 100644 --- a/third_party/WebKit/Source/core/svg/SVGElement.cpp +++ b/third_party/WebKit/Source/core/svg/SVGElement.cpp
@@ -62,9 +62,6 @@ Document& document, ConstructionType constructionType) : Element(tagName, &document, constructionType), -#if ENABLE(ASSERT) - m_inRelativeLengthClientsInvalidation(false), -#endif m_SVGRareData(nullptr), m_className(SVGAnimatedString::create(this, HTMLNames::classAttr)) { addToPropertyMap(m_className); @@ -554,7 +551,7 @@ return; ASSERT(!m_inRelativeLengthClientsInvalidation); -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() AutoReset<bool> inRelativeLengthClientsInvalidationChange( &m_inRelativeLengthClientsInvalidation, true); #endif
diff --git a/third_party/WebKit/Source/core/svg/SVGElement.h b/third_party/WebKit/Source/core/svg/SVGElement.h index 9edb14d3..e274cefb 100644 --- a/third_party/WebKit/Source/core/svg/SVGElement.h +++ b/third_party/WebKit/Source/core/svg/SVGElement.h
@@ -269,8 +269,8 @@ AttributeToPropertyMap; AttributeToPropertyMap m_attributeToPropertyMap; -#if ENABLE(ASSERT) - bool m_inRelativeLengthClientsInvalidation; +#if DCHECK_IS_ON() + bool m_inRelativeLengthClientsInvalidation = false; #endif Member<SVGElementRareData> m_SVGRareData;
diff --git a/third_party/WebKit/Source/core/svg/SVGUseElement.cpp b/third_party/WebKit/Source/core/svg/SVGUseElement.cpp index 8e70439..ce93141f 100644 --- a/third_party/WebKit/Source/core/svg/SVGUseElement.cpp +++ b/third_party/WebKit/Source/core/svg/SVGUseElement.cpp
@@ -103,7 +103,7 @@ DocumentResourceClient::trace(visitor); } -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() static inline bool isWellFormedDocument(Document* document) { if (document->isXMLDocument()) return static_cast<XMLDocumentParser*>(document->parser())->wellFormed();
diff --git a/third_party/WebKit/Source/core/svg/animation/SMILTimeContainer.cpp b/third_party/WebKit/Source/core/svg/animation/SMILTimeContainer.cpp index a9b1b9a..871201b 100644 --- a/third_party/WebKit/Source/core/svg/animation/SMILTimeContainer.cpp +++ b/third_party/WebKit/Source/core/svg/animation/SMILTimeContainer.cpp
@@ -52,10 +52,6 @@ m_animationPolicyOnceTimer(this, &SMILTimeContainer::animationPolicyTimerFired), m_ownerSVGElement(&owner) -#if ENABLE(ASSERT) - , - m_preventScheduledAnimationsChanges(false) -#endif { } @@ -63,7 +59,7 @@ cancelAnimationFrame(); cancelAnimationPolicyTimer(); ASSERT(!m_wakeupTimer.isActive()); -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() ASSERT(!m_preventScheduledAnimationsChanges); #endif } @@ -75,7 +71,7 @@ DCHECK(target); DCHECK(animation->hasValidTarget()); -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() ASSERT(!m_preventScheduledAnimationsChanges); #endif @@ -97,7 +93,7 @@ const QualifiedName& attributeName) { ASSERT(animation->timeContainer() == this); -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() ASSERT(!m_preventScheduledAnimationsChanges); #endif @@ -233,7 +229,7 @@ if (!isPaused()) synchronizeToDocumentTimeline(); -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() m_preventScheduledAnimationsChanges = true; #endif for (const auto& entry : m_scheduledAnimations) { @@ -244,7 +240,7 @@ for (SVGSMILElement* element : *scheduled) element->reset(); } -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() m_preventScheduledAnimationsChanges = false; #endif @@ -423,7 +419,7 @@ ASSERT(document().isActive()); SMILTime earliestFireTime = SMILTime::unresolved(); -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() // This boolean will catch any attempts to schedule/unschedule // scheduledAnimations during this critical section. Similarly, any elements // removed will unschedule themselves, so this will catch modification of @@ -491,7 +487,7 @@ m_scheduledAnimations.removeAll(invalidKeys); if (animationsToApply.isEmpty()) { -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() m_preventScheduledAnimationsChanges = false; #endif return earliestFireTime; @@ -506,7 +502,7 @@ for (const auto& timedElement : animationsToApply) timedElement->applyResultsToTarget(); -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() m_preventScheduledAnimationsChanges = false; #endif
diff --git a/third_party/WebKit/Source/core/svg/animation/SMILTimeContainer.h b/third_party/WebKit/Source/core/svg/animation/SMILTimeContainer.h index 1b302767..dd8fb53 100644 --- a/third_party/WebKit/Source/core/svg/animation/SMILTimeContainer.h +++ b/third_party/WebKit/Source/core/svg/animation/SMILTimeContainer.h
@@ -143,8 +143,8 @@ Member<SVGSVGElement> m_ownerSVGElement; -#if ENABLE(ASSERT) - bool m_preventScheduledAnimationsChanges; +#if DCHECK_IS_ON() + bool m_preventScheduledAnimationsChanges = false; #endif }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/workers/InProcessWorkerMessagingProxy.cpp b/third_party/WebKit/Source/core/workers/InProcessWorkerMessagingProxy.cpp index 576c9f6e5..9c8b717b6 100644 --- a/third_party/WebKit/Source/core/workers/InProcessWorkerMessagingProxy.cpp +++ b/third_party/WebKit/Source/core/workers/InProcessWorkerMessagingProxy.cpp
@@ -49,30 +49,6 @@ namespace blink { -namespace { - -void processUnhandledExceptionOnWorkerGlobalScope( - int exceptionId, - ExecutionContext* scriptContext) { - WorkerGlobalScope* globalScope = toWorkerGlobalScope(scriptContext); - globalScope->exceptionUnhandled(exceptionId); -} - -void processMessageOnWorkerGlobalScope( - PassRefPtr<SerializedScriptValue> message, - std::unique_ptr<MessagePortChannelArray> channels, - InProcessWorkerObjectProxy* workerObjectProxy, - ExecutionContext* scriptContext) { - WorkerGlobalScope* globalScope = toWorkerGlobalScope(scriptContext); - MessagePortArray* ports = - MessagePort::entanglePorts(*scriptContext, std::move(channels)); - globalScope->dispatchEvent(MessageEvent::create(ports, std::move(message))); - workerObjectProxy->confirmMessageFromWorkerObject(); - workerObjectProxy->startPendingActivityTimer(); -} - -} // namespace - InProcessWorkerMessagingProxy::InProcessWorkerMessagingProxy( InProcessWorkerBase* workerObject, WorkerClients* workerClients) @@ -161,17 +137,19 @@ if (askedToTerminate()) return; - std::unique_ptr<ExecutionContextTask> task = createCrossThreadTask( - &processMessageOnWorkerGlobalScope, std::move(message), - WTF::passed(std::move(channels)), - crossThreadUnretained(&workerObjectProxy())); if (workerThread()) { // A message event is an activity and may initiate another activity. m_workerGlobalScopeHasPendingActivity = true; ++m_unconfirmedMessageCount; + std::unique_ptr<ExecutionContextTask> task = createCrossThreadTask( + &InProcessWorkerObjectProxy::processMessageFromWorkerObject, + crossThreadUnretained(&workerObjectProxy()), std::move(message), + WTF::passed(std::move(channels)), + crossThreadUnretained(workerThread())); workerThread()->postTask(BLINK_FROM_HERE, std::move(task)); } else { - m_queuedEarlyTasks.push_back(std::move(task)); + m_queuedEarlyTasks.push_back( + WTF::makeUnique<QueuedTask>(std::move(message), std::move(channels))); } } @@ -191,11 +169,15 @@ ErrorEvent* event = ErrorEvent::create(errorMessage, location->clone(), nullptr); - if (m_workerObject->dispatchEvent(event) == DispatchEventResult::NotCanceled) - postTaskToWorkerGlobalScope( - BLINK_FROM_HERE, - createCrossThreadTask(&processUnhandledExceptionOnWorkerGlobalScope, - exceptionId)); + if (m_workerObject->dispatchEvent(event) != DispatchEventResult::NotCanceled) + return; + + postTaskToWorkerGlobalScope( + BLINK_FROM_HERE, + createCrossThreadTask( + &InProcessWorkerObjectProxy::processUnhandledException, + crossThreadUnretained(m_workerObjectProxy.get()), exceptionId, + crossThreadUnretained(workerThread()))); } void InProcessWorkerMessagingProxy::workerThreadCreated() { @@ -207,8 +189,15 @@ DCHECK_EQ(0u, m_unconfirmedMessageCount); m_unconfirmedMessageCount = m_queuedEarlyTasks.size(); - for (auto& earlyTask : m_queuedEarlyTasks) - workerThread()->postTask(BLINK_FROM_HERE, std::move(earlyTask)); + for (auto& queuedTask : m_queuedEarlyTasks) { + std::unique_ptr<ExecutionContextTask> task = createCrossThreadTask( + &InProcessWorkerObjectProxy::processMessageFromWorkerObject, + crossThreadUnretained(&workerObjectProxy()), + queuedTask->message.release(), + WTF::passed(std::move(queuedTask->channels)), + crossThreadUnretained(workerThread())); + workerThread()->postTask(BLINK_FROM_HERE, std::move(task)); + } m_queuedEarlyTasks.clear(); } @@ -250,4 +239,11 @@ return m_workerGlobalScopeHasPendingActivity; } +InProcessWorkerMessagingProxy::QueuedTask::QueuedTask( + RefPtr<SerializedScriptValue> message, + std::unique_ptr<MessagePortChannelArray> channels) + : message(std::move(message)), channels(std::move(channels)) {} + +InProcessWorkerMessagingProxy::QueuedTask::~QueuedTask() = default; + } // namespace blink
diff --git a/third_party/WebKit/Source/core/workers/InProcessWorkerMessagingProxy.h b/third_party/WebKit/Source/core/workers/InProcessWorkerMessagingProxy.h index ac66080..26941b7 100644 --- a/third_party/WebKit/Source/core/workers/InProcessWorkerMessagingProxy.h +++ b/third_party/WebKit/Source/core/workers/InProcessWorkerMessagingProxy.h
@@ -98,8 +98,17 @@ WeakPersistent<InProcessWorkerBase> m_workerObject; Persistent<WorkerClients> m_workerClients; + struct QueuedTask { + RefPtr<SerializedScriptValue> message; + std::unique_ptr<MessagePortChannelArray> channels; + + QueuedTask(RefPtr<SerializedScriptValue> message, + std::unique_ptr<MessagePortChannelArray> channels); + ~QueuedTask(); + }; + // Tasks are queued here until there's a thread object created. - Vector<std::unique_ptr<ExecutionContextTask>> m_queuedEarlyTasks; + Vector<std::unique_ptr<QueuedTask>> m_queuedEarlyTasks; // Unconfirmed messages from the parent context thread to the worker thread. // When this is greater than 0, |m_workerGlobalScopeHasPendingActivity| should
diff --git a/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.cpp b/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.cpp index 338d02a..3394a64 100644 --- a/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.cpp +++ b/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.cpp
@@ -36,6 +36,7 @@ #include "core/dom/Document.h" #include "core/dom/ExecutionContext.h" #include "core/dom/ExecutionContextTask.h" +#include "core/events/MessageEvent.h" #include "core/inspector/ConsoleMessage.h" #include "core/workers/InProcessWorkerMessagingProxy.h" #include "core/workers/ParentFrameTaskRunners.h" @@ -43,6 +44,7 @@ #include "core/workers/WorkerThread.h" #include "platform/CrossThreadFunctional.h" #include "platform/WebTaskRunner.h" +#include "public/platform/Platform.h" #include "wtf/Functional.h" #include "wtf/PtrUtil.h" #include <memory> @@ -74,7 +76,16 @@ WTF::passed(std::move(channels)))); } -void InProcessWorkerObjectProxy::confirmMessageFromWorkerObject() { +void InProcessWorkerObjectProxy::processMessageFromWorkerObject( + PassRefPtr<SerializedScriptValue> message, + std::unique_ptr<MessagePortChannelArray> channels, + WorkerThread* workerThread) { + WorkerGlobalScope* globalScope = + toWorkerGlobalScope(workerThread->globalScope()); + MessagePortArray* ports = + MessagePort::entanglePorts(*globalScope, std::move(channels)); + globalScope->dispatchEvent(MessageEvent::create(ports, std::move(message))); + getParentFrameTaskRunners() ->get(TaskType::UnspecedTimer) ->postTask( @@ -82,18 +93,16 @@ crossThreadBind( &InProcessWorkerMessagingProxy::confirmMessageFromWorkerObject, m_messagingProxyWeakPtr)); + + startPendingActivityTimer(); } -void InProcessWorkerObjectProxy::startPendingActivityTimer() { - if (m_timer->isActive()) { - // Reset the next interval duration to check new activity state timely. - // For example, a long-running activity can be cancelled by a message - // event. - m_nextIntervalInSec = kDefaultIntervalInSec; - return; - } - m_timer->startOneShot(m_nextIntervalInSec, BLINK_FROM_HERE); - m_nextIntervalInSec = std::min(m_nextIntervalInSec * 1.5, m_maxIntervalInSec); +void InProcessWorkerObjectProxy::processUnhandledException( + int exceptionId, + WorkerThread* workerThread) { + WorkerGlobalScope* globalScope = + toWorkerGlobalScope(workerThread->globalScope()); + globalScope->exceptionUnhandled(exceptionId); } void InProcessWorkerObjectProxy::reportException( @@ -113,8 +122,9 @@ WorkerOrWorkletGlobalScope* globalScope) { DCHECK(!m_workerGlobalScope); m_workerGlobalScope = toWorkerGlobalScope(globalScope); - m_timer = WTF::wrapUnique(new Timer<InProcessWorkerObjectProxy>( - this, &InProcessWorkerObjectProxy::checkPendingActivity)); + m_timer = WTF::makeUnique<TaskRunnerTimer<InProcessWorkerObjectProxy>>( + Platform::current()->currentThread()->getWebTaskRunner(), this, + &InProcessWorkerObjectProxy::checkPendingActivity); } void InProcessWorkerObjectProxy::didEvaluateWorkerScript(bool) { @@ -135,6 +145,18 @@ m_nextIntervalInSec(kDefaultIntervalInSec), m_maxIntervalInSec(kMaxIntervalInSec) {} +void InProcessWorkerObjectProxy::startPendingActivityTimer() { + if (m_timer->isActive()) { + // Reset the next interval duration to check new activity state timely. + // For example, a long-running activity can be cancelled by a message + // event. + m_nextIntervalInSec = kDefaultIntervalInSec; + return; + } + m_timer->startOneShot(m_nextIntervalInSec, BLINK_FROM_HERE); + m_nextIntervalInSec = std::min(m_nextIntervalInSec * 1.5, m_maxIntervalInSec); +} + void InProcessWorkerObjectProxy::checkPendingActivity(TimerBase*) { bool hasPendingActivity = V8GCController::hasPendingActivity( m_workerGlobalScope->thread()->isolate(), m_workerGlobalScope);
diff --git a/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.h b/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.h index 5bb45db3..4ae67c8 100644 --- a/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.h +++ b/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.h
@@ -48,6 +48,7 @@ class ThreadedMessagingProxyBase; class WorkerGlobalScope; class WorkerOrWorkletGlobalScope; +class WorkerThread; // A proxy to talk to the parent worker object. See class comments on // ThreadedObjectProxyBase.h for lifetime of this class etc. @@ -66,8 +67,11 @@ void postMessageToWorkerObject(PassRefPtr<SerializedScriptValue>, std::unique_ptr<MessagePortChannelArray>); - void confirmMessageFromWorkerObject(); - void startPendingActivityTimer(); + void processUnhandledException(int exceptionId, WorkerThread*); + void processMessageFromWorkerObject( + PassRefPtr<SerializedScriptValue> message, + std::unique_ptr<MessagePortChannelArray> channels, + WorkerThread*); // ThreadedMessagingProxyBase overrides. void reportException(const String& errorMessage, @@ -86,6 +90,7 @@ private: friend class InProcessWorkerMessagingProxyForTest; + void startPendingActivityTimer(); void checkPendingActivity(TimerBase*); // No guarantees about the lifetimes of tasks posted by this proxy wrt the @@ -95,7 +100,7 @@ // Used for checking pending activities on the worker global scope. This is // cancelled when the worker global scope is destroyed. - std::unique_ptr<Timer<InProcessWorkerObjectProxy>> m_timer; + std::unique_ptr<TaskRunnerTimer<InProcessWorkerObjectProxy>> m_timer; // The default interval duration of the timer. This is usually // kDefaultIntervalInSec but made as a member variable for testing.
diff --git a/third_party/WebKit/Source/core/workers/ThreadedWorkletMessagingProxy.cpp b/third_party/WebKit/Source/core/workers/ThreadedWorkletMessagingProxy.cpp index 25bbae9f..e70ec8f2 100644 --- a/third_party/WebKit/Source/core/workers/ThreadedWorkletMessagingProxy.cpp +++ b/third_party/WebKit/Source/core/workers/ThreadedWorkletMessagingProxy.cpp
@@ -5,7 +5,6 @@ #include "core/workers/ThreadedWorkletMessagingProxy.h" #include "bindings/core/v8/ScriptSourceCode.h" -#include "bindings/core/v8/WorkerOrWorkletScriptController.h" #include "core/dom/Document.h" #include "core/dom/ExecutionContextTask.h" #include "core/dom/SecurityContext.h" @@ -19,18 +18,6 @@ namespace blink { -namespace { - -void evaluateScriptOnWorkletGlobalScope(const String& source, - const KURL& scriptURL, - ExecutionContext* executionContext) { - WorkletGlobalScope* globalScope = toWorkletGlobalScope(executionContext); - globalScope->scriptController()->evaluate( - ScriptSourceCode(source, scriptURL)); -} - -} // namespace - ThreadedWorkletMessagingProxy::ThreadedWorkletMessagingProxy( ExecutionContext* executionContext) : ThreadedMessagingProxyBase(executionContext), m_weakPtrFactory(this) { @@ -73,8 +60,10 @@ const ScriptSourceCode& scriptSourceCode) { postTaskToWorkerGlobalScope( BLINK_FROM_HERE, - createCrossThreadTask(&evaluateScriptOnWorkletGlobalScope, - scriptSourceCode.source(), scriptSourceCode.url())); + createCrossThreadTask(&ThreadedWorkletObjectProxy::evaluateScript, + crossThreadUnretained(m_workletObjectProxy.get()), + scriptSourceCode.source(), scriptSourceCode.url(), + crossThreadUnretained(workerThread()))); } void ThreadedWorkletMessagingProxy::terminateWorkletGlobalScope() {
diff --git a/third_party/WebKit/Source/core/workers/ThreadedWorkletObjectProxy.cpp b/third_party/WebKit/Source/core/workers/ThreadedWorkletObjectProxy.cpp index 95af302..6fa7b14 100644 --- a/third_party/WebKit/Source/core/workers/ThreadedWorkletObjectProxy.cpp +++ b/third_party/WebKit/Source/core/workers/ThreadedWorkletObjectProxy.cpp
@@ -4,7 +4,11 @@ #include "core/workers/ThreadedWorkletObjectProxy.h" +#include "bindings/core/v8/ScriptSourceCode.h" +#include "bindings/core/v8/WorkerOrWorkletScriptController.h" +#include "core/workers/ThreadedWorkletGlobalScope.h" #include "core/workers/ThreadedWorkletMessagingProxy.h" +#include "core/workers/WorkerThread.h" #include "wtf/PtrUtil.h" #include <memory> @@ -20,6 +24,15 @@ ThreadedWorkletObjectProxy::~ThreadedWorkletObjectProxy() {} +void ThreadedWorkletObjectProxy::evaluateScript(const String& source, + const KURL& scriptURL, + WorkerThread* workerThread) { + ThreadedWorkletGlobalScope* globalScope = + toThreadedWorkletGlobalScope(workerThread->globalScope()); + globalScope->scriptController()->evaluate( + ScriptSourceCode(source, scriptURL)); +} + ThreadedWorkletObjectProxy::ThreadedWorkletObjectProxy( const WeakPtr<ThreadedWorkletMessagingProxy>& messagingProxyWeakPtr, ParentFrameTaskRunners* parentFrameTaskRunners)
diff --git a/third_party/WebKit/Source/core/workers/ThreadedWorkletObjectProxy.h b/third_party/WebKit/Source/core/workers/ThreadedWorkletObjectProxy.h index 78bbe629..78d6304 100644 --- a/third_party/WebKit/Source/core/workers/ThreadedWorkletObjectProxy.h +++ b/third_party/WebKit/Source/core/workers/ThreadedWorkletObjectProxy.h
@@ -14,6 +14,7 @@ namespace blink { class ThreadedWorkletMessagingProxy; +class WorkerThread; // A proxy to talk to the parent worker object. See class comments on // ThreadedObjectProxyBase.h for lifetime of this class etc. @@ -27,7 +28,9 @@ ParentFrameTaskRunners*); ~ThreadedWorkletObjectProxy() override; - void reportPendingActivity(bool hasPendingActivity); + void evaluateScript(const String& source, + const KURL& scriptURL, + WorkerThread*); // ThreadedObjectProxyBase overrides. void reportException(const String& errorMessage,
diff --git a/third_party/WebKit/Source/core/workers/WorkerThread.cpp b/third_party/WebKit/Source/core/workers/WorkerThread.cpp index 6b9fdb8..56fd9be0 100644 --- a/third_party/WebKit/Source/core/workers/WorkerThread.cpp +++ b/third_party/WebKit/Source/core/workers/WorkerThread.cpp
@@ -636,8 +636,8 @@ } bool WorkerThread::isThreadStateMutexLocked(const MutexLocker& /* unused */) { -#if ENABLE(ASSERT) - // Mutex::locked() is available only if ENABLE(ASSERT) is true. +#if DCHECK_IS_ON() + // Mutex::locked() is available only if DCHECK_IS_ON() is true. return m_threadStateMutex.locked(); #else // Otherwise, believe the given MutexLocker holds |m_threadStateMutex|.
diff --git a/third_party/WebKit/Source/modules/accessibility/AXLayoutObject.cpp b/third_party/WebKit/Source/modules/accessibility/AXLayoutObject.cpp index 13a11e8..e090fc6 100644 --- a/third_party/WebKit/Source/modules/accessibility/AXLayoutObject.cpp +++ b/third_party/WebKit/Source/modules/accessibility/AXLayoutObject.cpp
@@ -504,7 +504,7 @@ bool AXLayoutObject::computeAccessibilityIsIgnored( IgnoredReasons* ignoredReasons) const { -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() ASSERT(m_initialized); #endif
diff --git a/third_party/WebKit/Source/modules/accessibility/AXNodeObject.cpp b/third_party/WebKit/Source/modules/accessibility/AXNodeObject.cpp index 58b6cd3..8f25c79 100644 --- a/third_party/WebKit/Source/modules/accessibility/AXNodeObject.cpp +++ b/third_party/WebKit/Source/modules/accessibility/AXNodeObject.cpp
@@ -74,9 +74,6 @@ : AXObject(axObjectCache), m_ariaRole(UnknownRole), m_childrenDirty(false), -#if ENABLE(ASSERT) - m_initialized(false), -#endif m_node(node) { } @@ -124,7 +121,7 @@ bool AXNodeObject::computeAccessibilityIsIgnored( IgnoredReasons* ignoredReasons) const { -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() // Double-check that an AXObject is never accessed before // it's been initialized. ASSERT(m_initialized); @@ -741,7 +738,7 @@ } void AXNodeObject::init() { -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() ASSERT(!m_initialized); m_initialized = true; #endif
diff --git a/third_party/WebKit/Source/modules/accessibility/AXNodeObject.h b/third_party/WebKit/Source/modules/accessibility/AXNodeObject.h index 327773d..80759028 100644 --- a/third_party/WebKit/Source/modules/accessibility/AXNodeObject.h +++ b/third_party/WebKit/Source/modules/accessibility/AXNodeObject.h
@@ -55,8 +55,8 @@ // Protected data. AccessibilityRole m_ariaRole; bool m_childrenDirty; -#if ENABLE(ASSERT) - bool m_initialized; +#if DCHECK_IS_ON() + bool m_initialized = false; #endif bool computeAccessibilityIsIgnored(IgnoredReasons* = nullptr) const override;
diff --git a/third_party/WebKit/Source/modules/accessibility/AXObjectCacheImpl.cpp b/third_party/WebKit/Source/modules/accessibility/AXObjectCacheImpl.cpp index 6de9215..7215255 100644 --- a/third_party/WebKit/Source/modules/accessibility/AXObjectCacheImpl.cpp +++ b/third_party/WebKit/Source/modules/accessibility/AXObjectCacheImpl.cpp
@@ -93,9 +93,6 @@ AXObjectCacheImpl::AXObjectCacheImpl(Document& document) : m_document(document), m_modificationCount(0), -#if ENABLE(ASSERT) - m_hasBeenDisposed(false), -#endif m_notificationPostTimer(this, &AXObjectCacheImpl::notificationPostTimerFired) { } @@ -113,7 +110,7 @@ removeAXID(obj); } -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() m_hasBeenDisposed = true; #endif } @@ -640,7 +637,7 @@ if (obj->isDetached()) continue; -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() // Make sure none of the layout views are in the process of being layed out. // Notifications should only be sent after the layoutObject has finished if (obj->isAXLayoutObject()) {
diff --git a/third_party/WebKit/Source/modules/accessibility/AXObjectCacheImpl.h b/third_party/WebKit/Source/modules/accessibility/AXObjectCacheImpl.h index 8cf8413..2f6632b 100644 --- a/third_party/WebKit/Source/modules/accessibility/AXObjectCacheImpl.h +++ b/third_party/WebKit/Source/modules/accessibility/AXObjectCacheImpl.h
@@ -208,9 +208,9 @@ HashSet<AXID> m_idsInUse; -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() // Verified when finalizing. - bool m_hasBeenDisposed; + bool m_hasBeenDisposed = false; #endif //
diff --git a/third_party/WebKit/Source/modules/crypto/NormalizeAlgorithm.cpp b/third_party/WebKit/Source/modules/crypto/NormalizeAlgorithm.cpp index e918899..b21a2c3 100644 --- a/third_party/WebKit/Source/modules/crypto/NormalizeAlgorithm.cpp +++ b/third_party/WebKit/Source/modules/crypto/NormalizeAlgorithm.cpp
@@ -59,7 +59,7 @@ unsigned char algorithmNameLength; WebCryptoAlgorithmId algorithmId; -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() bool operator<(const AlgorithmNameMapping&) const; #endif }; @@ -91,7 +91,7 @@ WTF_ARRAY_LENGTH(algorithmNameMappings), "algorithmNameMappings needs to be updated"); -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() // Essentially std::is_sorted() (however that function is new to C++11). template <typename Iterator>
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBKeyPath.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBKeyPath.cpp index d27ea037..8f5e88b 100644 --- a/third_party/WebKit/Source/modules/indexeddb/IDBKeyPath.cpp +++ b/third_party/WebKit/Source/modules/indexeddb/IDBKeyPath.cpp
@@ -106,7 +106,7 @@ IDBKeyPath::IDBKeyPath(const Vector<String>& array) : m_type(ArrayType), m_array(array) { -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() for (size_t i = 0; i < m_array.size(); ++i) ASSERT(!m_array[i].isNull()); #endif @@ -123,7 +123,7 @@ ASSERT(keyPath.isStringSequence()); m_type = ArrayType; m_array = keyPath.getAsStringSequence(); -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() for (size_t i = 0; i < m_array.size(); ++i) ASSERT(!m_array[i].isNull()); #endif
diff --git a/third_party/WebKit/Source/modules/serviceworkers/WaitUntilObserver.cpp b/third_party/WebKit/Source/modules/serviceworkers/WaitUntilObserver.cpp index e4839a17..f57dfb8 100644 --- a/third_party/WebKit/Source/modules/serviceworkers/WaitUntilObserver.cpp +++ b/third_party/WebKit/Source/modules/serviceworkers/WaitUntilObserver.cpp
@@ -12,6 +12,7 @@ #include "core/dom/ExecutionContext.h" #include "modules/serviceworkers/ServiceWorkerGlobalScope.h" #include "platform/LayoutTestSupport.h" +#include "public/platform/Platform.h" #include "public/platform/modules/serviceworker/WebServiceWorkerEventResult.h" #include "wtf/Assertions.h" #include <v8.h> @@ -137,6 +138,7 @@ m_type(type), m_eventID(eventID), m_consumeWindowInteractionTimer( + Platform::current()->currentThread()->getWebTaskRunner(), this, &WaitUntilObserver::consumeWindowInteraction) {}
diff --git a/third_party/WebKit/Source/modules/serviceworkers/WaitUntilObserver.h b/third_party/WebKit/Source/modules/serviceworkers/WaitUntilObserver.h index 6d5b415..910007b 100644 --- a/third_party/WebKit/Source/modules/serviceworkers/WaitUntilObserver.h +++ b/third_party/WebKit/Source/modules/serviceworkers/WaitUntilObserver.h
@@ -71,7 +71,7 @@ bool m_hasError = false; bool m_eventDispatched = false; double m_eventDispatchTime = 0; - Timer<WaitUntilObserver> m_consumeWindowInteractionTimer; + TaskRunnerTimer<WaitUntilObserver> m_consumeWindowInteractionTimer; }; } // namespace blink
diff --git a/third_party/WebKit/Source/modules/webaudio/BaseAudioContext.h b/third_party/WebKit/Source/modules/webaudio/BaseAudioContext.h index df15848..afdf59e0 100644 --- a/third_party/WebKit/Source/modules/webaudio/BaseAudioContext.h +++ b/third_party/WebKit/Source/modules/webaudio/BaseAudioContext.h
@@ -273,7 +273,7 @@ void lock() { deferredTaskHandler().lock(); } bool tryLock() { return deferredTaskHandler().tryLock(); } void unlock() { deferredTaskHandler().unlock(); } -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() // Returns true if this thread owns the context's lock. bool isGraphOwner() { return deferredTaskHandler().isGraphOwner(); } #endif
diff --git a/third_party/WebKit/Source/modules/webaudio/DeferredTaskHandler.cpp b/third_party/WebKit/Source/modules/webaudio/DeferredTaskHandler.cpp index 17a07a7..4522c2e6 100644 --- a/third_party/WebKit/Source/modules/webaudio/DeferredTaskHandler.cpp +++ b/third_party/WebKit/Source/modules/webaudio/DeferredTaskHandler.cpp
@@ -65,7 +65,7 @@ m_contextGraphMutex.lock(); } -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() bool DeferredTaskHandler::isGraphOwner() { return m_contextGraphMutex.locked(); }
diff --git a/third_party/WebKit/Source/modules/webaudio/DeferredTaskHandler.h b/third_party/WebKit/Source/modules/webaudio/DeferredTaskHandler.h index 2de1cbf..4cd4909 100644 --- a/third_party/WebKit/Source/modules/webaudio/DeferredTaskHandler.h +++ b/third_party/WebKit/Source/modules/webaudio/DeferredTaskHandler.h
@@ -128,7 +128,7 @@ // MUST NOT be used in the real-time audio context. void offlineLock(); -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() // Returns true if this thread owns the context's lock. bool isGraphOwner(); #endif
diff --git a/third_party/WebKit/Source/modules/webdatabase/Database.cpp b/third_party/WebKit/Source/modules/webdatabase/Database.cpp index 97b4c6f7..afe9e49f 100644 --- a/third_party/WebKit/Source/modules/webdatabase/Database.cpp +++ b/third_party/WebKit/Source/modules/webdatabase/Database.cpp
@@ -860,7 +860,7 @@ // sometimes firing it ourselves, this code should probably be pushed down // into Database so that we only create the SQLTransaction if we're // actually going to run it. -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() SQLTransactionErrorCallback* originalErrorCallback = errorCallback; #endif SQLTransaction* transaction = SQLTransaction::create(
diff --git a/third_party/WebKit/Source/modules/webdatabase/DatabaseManager.cpp b/third_party/WebKit/Source/modules/webdatabase/DatabaseManager.cpp index d019b7d..abab2e2 100644 --- a/third_party/WebKit/Source/modules/webdatabase/DatabaseManager.cpp +++ b/third_party/WebKit/Source/modules/webdatabase/DatabaseManager.cpp
@@ -64,10 +64,6 @@ } DatabaseManager::DatabaseManager() -#if ENABLE(ASSERT) - : m_databaseContextRegisteredCount(0), - m_databaseContextInstanceCount(0) -#endif { } @@ -98,7 +94,7 @@ DatabaseContext* databaseContext) { ExecutionContext* context = databaseContext->getExecutionContext(); m_contextMap.set(context, databaseContext); -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() m_databaseContextRegisteredCount++; #endif } @@ -107,13 +103,13 @@ DatabaseContext* databaseContext) { ExecutionContext* context = databaseContext->getExecutionContext(); ASSERT(m_contextMap.get(context)); -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() m_databaseContextRegisteredCount--; #endif m_contextMap.remove(context); } -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() void DatabaseManager::didConstructDatabaseContext() { m_databaseContextInstanceCount++; }
diff --git a/third_party/WebKit/Source/modules/webdatabase/DatabaseManager.h b/third_party/WebKit/Source/modules/webdatabase/DatabaseManager.h index 165d4617..65ee92b5 100644 --- a/third_party/WebKit/Source/modules/webdatabase/DatabaseManager.h +++ b/third_party/WebKit/Source/modules/webdatabase/DatabaseManager.h
@@ -55,7 +55,7 @@ void registerDatabaseContext(DatabaseContext*); void unregisterDatabaseContext(DatabaseContext*); -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() void didConstructDatabaseContext(); void didDestructDatabaseContext(); #else @@ -109,9 +109,9 @@ Member<DatabaseContext>> ContextMap; ContextMap m_contextMap; -#if ENABLE(ASSERT) - int m_databaseContextRegisteredCount; - int m_databaseContextInstanceCount; +#if DCHECK_IS_ON() + int m_databaseContextRegisteredCount = 0; + int m_databaseContextInstanceCount = 0; #endif };
diff --git a/third_party/WebKit/Source/modules/webdatabase/DatabaseThread.cpp b/third_party/WebKit/Source/modules/webdatabase/DatabaseThread.cpp index ab29b40..c928b635 100644 --- a/third_party/WebKit/Source/modules/webdatabase/DatabaseThread.cpp +++ b/third_party/WebKit/Source/modules/webdatabase/DatabaseThread.cpp
@@ -138,7 +138,7 @@ void DatabaseThread::recordDatabaseClosed(Database* database) { ASSERT(isDatabaseThread()); ASSERT(database); -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() { MutexLocker lock(m_terminationRequestedMutex); ASSERT(m_terminationRequested || m_openDatabaseSet.contains(database)); @@ -162,7 +162,7 @@ void DatabaseThread::scheduleTask(std::unique_ptr<DatabaseTask> task) { ASSERT(m_thread); -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() { MutexLocker lock(m_terminationRequestedMutex); ASSERT(!m_terminationRequested);
diff --git a/third_party/WebKit/Source/modules/webdatabase/SQLTransactionStateMachine.h b/third_party/WebKit/Source/modules/webdatabase/SQLTransactionStateMachine.h index 77f2cfd8..e383739f 100644 --- a/third_party/WebKit/Source/modules/webdatabase/SQLTransactionStateMachine.h +++ b/third_party/WebKit/Source/modules/webdatabase/SQLTransactionStateMachine.h
@@ -48,13 +48,13 @@ SQLTransactionState m_nextState; SQLTransactionState m_requestedState; -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() // The state audit trail (i.e. bread crumbs) keeps track of up to the last // s_sizeOfStateAuditTrail states that the state machine enters. The audit // trail is updated before entering each state. This is for debugging use // only. static const int s_sizeOfStateAuditTrail = 20; - int m_nextStateAuditEntry; + int m_nextStateAuditEntry = 0; SQLTransactionState m_stateAuditTrail[s_sizeOfStateAuditTrail]; #endif }; @@ -67,12 +67,8 @@ SQLTransactionStateMachine<T>::SQLTransactionStateMachine() : m_nextState(SQLTransactionState::Idle), m_requestedState(SQLTransactionState::Idle) -#if ENABLE(ASSERT) - , - m_nextStateAuditEntry(0) -#endif { -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() for (int i = 0; i < s_sizeOfStateAuditTrail; i++) m_stateAuditTrail[i] = SQLTransactionState::NumberOfStates; #endif @@ -94,7 +90,7 @@ StateFunction stateFunction = stateFunctionFor(m_nextState); ASSERT(stateFunction); -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() m_stateAuditTrail[m_nextStateAuditEntry] = m_nextState; m_nextStateAuditEntry = (m_nextStateAuditEntry + 1) % s_sizeOfStateAuditTrail;
diff --git a/third_party/WebKit/Source/modules/webdatabase/sqlite/SQLiteStatement.cpp b/third_party/WebKit/Source/modules/webdatabase/sqlite/SQLiteStatement.cpp index b7e2c33..b2ad120 100644 --- a/third_party/WebKit/Source/modules/webdatabase/sqlite/SQLiteStatement.cpp +++ b/third_party/WebKit/Source/modules/webdatabase/sqlite/SQLiteStatement.cpp
@@ -82,10 +82,6 @@ : m_database(db), m_query(sql), m_statement(0) -#if ENABLE(ASSERT) - , - m_isPrepared(false) -#endif { } @@ -127,7 +123,7 @@ else if (*tail && **tail) error = SQLITE_ERROR; -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() m_isPrepared = error == SQLITE_OK; #endif return restrictError(error); @@ -156,7 +152,7 @@ } int SQLiteStatement::finalize() { -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() m_isPrepared = false; #endif if (!m_statement)
diff --git a/third_party/WebKit/Source/modules/webdatabase/sqlite/SQLiteStatement.h b/third_party/WebKit/Source/modules/webdatabase/sqlite/SQLiteStatement.h index 6ae764a..77305eb 100644 --- a/third_party/WebKit/Source/modules/webdatabase/sqlite/SQLiteStatement.h +++ b/third_party/WebKit/Source/modules/webdatabase/sqlite/SQLiteStatement.h
@@ -77,8 +77,8 @@ SQLiteDatabase& m_database; String m_query; sqlite3_stmt* m_statement; -#if ENABLE(ASSERT) - bool m_isPrepared; +#if DCHECK_IS_ON() + bool m_isPrepared = false; #endif };
diff --git a/third_party/WebKit/Source/platform/audio/android/FFTFrameOpenMAXDLAndroid.cpp b/third_party/WebKit/Source/platform/audio/android/FFTFrameOpenMAXDLAndroid.cpp index 36f9f78..c36dd50 100644 --- a/third_party/WebKit/Source/platform/audio/android/FFTFrameOpenMAXDLAndroid.cpp +++ b/third_party/WebKit/Source/platform/audio/android/FFTFrameOpenMAXDLAndroid.cpp
@@ -35,7 +35,7 @@ namespace blink { -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() const unsigned kMaxFFTPow2Size = 15; #endif
diff --git a/third_party/WebKit/Source/platform/audio/ffmpeg/FFTFrameFFMPEG.cpp b/third_party/WebKit/Source/platform/audio/ffmpeg/FFTFrameFFMPEG.cpp index 22175ec..64b9248a 100644 --- a/third_party/WebKit/Source/platform/audio/ffmpeg/FFTFrameFFMPEG.cpp +++ b/third_party/WebKit/Source/platform/audio/ffmpeg/FFTFrameFFMPEG.cpp
@@ -42,7 +42,7 @@ namespace blink { -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() // Max FFT size for FFMPEG. WebAudio currently only uses FFTs up to size 15 // (2^15 points). const int kMaxFFTPow2Size = 16;
diff --git a/third_party/WebKit/Source/platform/fonts/FontCache.cpp b/third_party/WebKit/Source/platform/fonts/FontCache.cpp index 64be67e..9ef8d237 100644 --- a/third_party/WebKit/Source/platform/fonts/FontCache.cpp +++ b/third_party/WebKit/Source/platform/fonts/FontCache.cpp
@@ -285,7 +285,7 @@ if (!gFontDataCache) gFontDataCache = new FontDataCache; -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() if (shouldRetain == DoNotRetain) ASSERT(m_purgePreventCount); #endif
diff --git a/third_party/WebKit/Source/platform/geometry/FloatRect.cpp b/third_party/WebKit/Source/platform/geometry/FloatRect.cpp index fe35f38..f276d2e 100644 --- a/third_party/WebKit/Source/platform/geometry/FloatRect.cpp +++ b/third_party/WebKit/Source/platform/geometry/FloatRect.cpp
@@ -60,7 +60,7 @@ clampTo<float>(height)); } -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() bool FloatRect::mayNotHaveExactIntRectRepresentation() const { static const float maxExactlyExpressible = 1 << FLT_MANT_DIG; return fabs(x()) > maxExactlyExpressible ||
diff --git a/third_party/WebKit/Source/platform/geometry/FloatRect.h b/third_party/WebKit/Source/platform/geometry/FloatRect.h index 00de1b83..779193d5 100644 --- a/third_party/WebKit/Source/platform/geometry/FloatRect.h +++ b/third_party/WebKit/Source/platform/geometry/FloatRect.h
@@ -201,7 +201,7 @@ } operator gfx::RectF() const; -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() bool mayNotHaveExactIntRectRepresentation() const; #endif
diff --git a/third_party/WebKit/Source/platform/graphics/GraphicsContext.cpp b/third_party/WebKit/Source/platform/graphics/GraphicsContext.cpp index dcb2f75..b7f8fa6 100644 --- a/third_party/WebKit/Source/platform/graphics/GraphicsContext.cpp +++ b/third_party/WebKit/Source/platform/graphics/GraphicsContext.cpp
@@ -127,7 +127,7 @@ m_canvas->restore(); } -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() unsigned GraphicsContext::saveCount() const { // Each m_paintStateStack entry implies an additional save op // (on top of its own saveCount), except for the first frame.
diff --git a/third_party/WebKit/Source/platform/graphics/GraphicsContext.h b/third_party/WebKit/Source/platform/graphics/GraphicsContext.h index f99ef5b7..03c57c8 100644 --- a/third_party/WebKit/Source/platform/graphics/GraphicsContext.h +++ b/third_party/WebKit/Source/platform/graphics/GraphicsContext.h
@@ -91,7 +91,7 @@ void save(); void restore(); -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() unsigned saveCount() const; #endif
diff --git a/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp b/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp index dfe1e0da..ce29c2d 100644 --- a/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp +++ b/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp
@@ -112,7 +112,7 @@ m_renderingContext3d(0), m_colorBehavior(ColorBehavior::transformToGlobalTarget()), m_hasPreferredRasterBounds(false) { -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() if (m_client) m_client->verifyNotPainting(); #endif @@ -134,7 +134,7 @@ m_linkHighlights[i]->clearCurrentGraphicsLayer(); m_linkHighlights.clear(); -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() if (m_client) m_client->verifyNotPainting(); #endif
diff --git a/third_party/WebKit/Source/platform/graphics/GraphicsLayerClient.h b/third_party/WebKit/Source/platform/graphics/GraphicsLayerClient.h index 1a9f4ae..2e48204 100644 --- a/third_party/WebKit/Source/platform/graphics/GraphicsLayerClient.h +++ b/third_party/WebKit/Source/platform/graphics/GraphicsLayerClient.h
@@ -89,7 +89,7 @@ virtual String debugName(const GraphicsLayer*) const = 0; -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() // CompositedLayerMapping overrides this to verify that it is not // currently painting contents. An ASSERT fails, if it is. // This is executed in GraphicsLayer construction and destruction
diff --git a/third_party/WebKit/Source/platform/graphics/ImageDecodingStore.cpp b/third_party/WebKit/Source/platform/graphics/ImageDecodingStore.cpp index 17a2e11..61aa435 100644 --- a/third_party/WebKit/Source/platform/graphics/ImageDecodingStore.cpp +++ b/third_party/WebKit/Source/platform/graphics/ImageDecodingStore.cpp
@@ -43,7 +43,7 @@ m_heapMemoryUsageInBytes(0) {} ImageDecodingStore::~ImageDecodingStore() { -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() setCacheLimitInBytes(0); ASSERT(!m_decoderCacheMap.size()); ASSERT(!m_orderedCacheList.size());
diff --git a/third_party/WebKit/Source/platform/graphics/Path.cpp b/third_party/WebKit/Source/platform/graphics/Path.cpp index dd890089b..cf5baae2 100644 --- a/third_party/WebKit/Source/platform/graphics/Path.cpp +++ b/third_party/WebKit/Source/platform/graphics/Path.cpp
@@ -549,7 +549,7 @@ return Op(m_path, other.m_path, kIntersect_SkPathOp, &m_path); } -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() bool ellipseIsRenderable(float startAngle, float endAngle) { return (std::abs(endAngle - startAngle) < twoPiFloat) || WebCoreFloatNearlyEqual(std::abs(endAngle - startAngle), twoPiFloat);
diff --git a/third_party/WebKit/Source/platform/graphics/Path.h b/third_party/WebKit/Source/platform/graphics/Path.h index d7bcc52..69429c1 100644 --- a/third_party/WebKit/Source/platform/graphics/Path.h +++ b/third_party/WebKit/Source/platform/graphics/Path.h
@@ -202,7 +202,7 @@ SkPath m_path; }; -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() PLATFORM_EXPORT bool ellipseIsRenderable(float startAngle, float endAngle); #endif
diff --git a/third_party/WebKit/Source/platform/graphics/paint/DisplayItemClientTest.cpp b/third_party/WebKit/Source/platform/graphics/paint/DisplayItemClientTest.cpp index 462e5a2..59189e4d 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/DisplayItemClientTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/paint/DisplayItemClientTest.cpp
@@ -10,7 +10,7 @@ namespace blink { namespace { -#if ENABLE(ASSERT) && !defined(UNDEFINED_SANITIZER) +#if DCHECK_IS_ON() && !defined(UNDEFINED_SANITIZER) TEST(DisplayItemClientTest, IsAlive) { EXPECT_FALSE(reinterpret_cast<DisplayItemClient*>(0x12345678)->isAlive()); @@ -20,7 +20,7 @@ EXPECT_FALSE(testClient->isAlive()); } -#endif // ENABLE(ASSERT) +#endif } // namespace } // namespace blink
diff --git a/third_party/WebKit/Source/platform/heap/CallbackStack.cpp b/third_party/WebKit/Source/platform/heap/CallbackStack.cpp index 93a1232..affa37b 100644 --- a/third_party/WebKit/Source/platform/heap/CallbackStack.cpp +++ b/third_party/WebKit/Source/platform/heap/CallbackStack.cpp
@@ -67,7 +67,7 @@ CallbackStack::Block::Block(Block* next) { m_buffer = CallbackStackMemoryPool::instance().allocate(); -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() clear(); #endif @@ -84,7 +84,7 @@ m_next = nullptr; } -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() void CallbackStack::Block::clear() { for (size_t i = 0; i < CallbackStackMemoryPool::kBlockSize; i++) m_buffer[i] = Item(0, 0); @@ -100,7 +100,7 @@ } } -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() bool CallbackStack::Block::hasCallbackForObject(const void* object) { for (unsigned i = 0; m_buffer + i < m_current; i++) { Item* item = &m_buffer[i]; @@ -159,7 +159,7 @@ for (;;) { Block* next = m_first->next(); if (!next) { -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() m_first->clear(); #endif return nullptr; @@ -204,7 +204,7 @@ return !m_first->next(); } -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() bool CallbackStack::hasCallbackForObject(const void* object) { for (Block* current = m_first; current; current = current->next()) { if (current->hasCallbackForObject(object))
diff --git a/third_party/WebKit/Source/platform/heap/CallbackStack.h b/third_party/WebKit/Source/platform/heap/CallbackStack.h index 377c6214..b4dfd3a 100644 --- a/third_party/WebKit/Source/platform/heap/CallbackStack.h +++ b/third_party/WebKit/Source/platform/heap/CallbackStack.h
@@ -52,7 +52,7 @@ void invokeEphemeronCallbacks(Visitor*); -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() bool hasCallbackForObject(const void*); #endif bool hasJustOneBlock() const; @@ -68,7 +68,7 @@ explicit Block(Block* next); ~Block(); -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() void clear(); #endif Block* next() const { return m_next; } @@ -92,7 +92,7 @@ void invokeEphemeronCallbacks(Visitor*); -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() bool hasCallbackForObject(const void*); #endif
diff --git a/third_party/WebKit/Source/platform/heap/GCInfo.cpp b/third_party/WebKit/Source/platform/heap/GCInfo.cpp index 9092f7ec..7d2d1105c 100644 --- a/third_party/WebKit/Source/platform/heap/GCInfo.cpp +++ b/third_party/WebKit/Source/platform/heap/GCInfo.cpp
@@ -67,7 +67,7 @@ s_gcInfoTable = nullptr; } -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() void assertObjectHasGCInfo(const void* payload, size_t gcInfoIndex) { ASSERT(HeapObjectHeader::fromPayload(payload)->checkHeader()); #if !defined(COMPONENT_BUILD)
diff --git a/third_party/WebKit/Source/platform/heap/GCInfo.h b/third_party/WebKit/Source/platform/heap/GCInfo.h index d68f968..1d441817 100644 --- a/third_party/WebKit/Source/platform/heap/GCInfo.h +++ b/third_party/WebKit/Source/platform/heap/GCInfo.h
@@ -156,7 +156,7 @@ // object header keeps its index into this table. extern PLATFORM_EXPORT GCInfo const** s_gcInfoTable; -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() PLATFORM_EXPORT void assertObjectHasGCInfo(const void*, size_t gcInfoIndex); #endif
diff --git a/third_party/WebKit/Source/platform/heap/Heap.cpp b/third_party/WebKit/Source/platform/heap/Heap.cpp index 7e94c56..22e5ef818 100644 --- a/third_party/WebKit/Source/platform/heap/Heap.cpp +++ b/third_party/WebKit/Source/platform/heap/Heap.cpp
@@ -270,7 +270,7 @@ m_safePointBarrier->resumeOthers(); } -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() BasePage* ThreadHeap::findPageFromAddress(Address address) { MutexLocker locker(m_threadAttachMutex); for (ThreadState* state : m_threads) { @@ -293,7 +293,7 @@ Address ThreadHeap::checkAndMarkPointer(Visitor* visitor, Address address) { ASSERT(ThreadState::current()->isInGC()); -#if !ENABLE(ASSERT) +#if !DCHECK_IS_ON() if (m_heapDoesNotContainCache->lookup(address)) return nullptr; #endif @@ -307,7 +307,7 @@ return address; } -#if !ENABLE(ASSERT) +#if !DCHECK_IS_ON() m_heapDoesNotContainCache->addEntry(address); #else if (!m_heapDoesNotContainCache->lookup(address)) @@ -393,7 +393,7 @@ pushPostMarkingCallback(table, iterationDoneCallback); } -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() bool ThreadHeap::weakTableRegistered(const void* table) { ASSERT(m_ephemeronStack); return m_ephemeronStack->hasCallbackForObject(table);
diff --git a/third_party/WebKit/Source/platform/heap/Heap.h b/third_party/WebKit/Source/platform/heap/Heap.h index 846f71a0..c494896d1 100644 --- a/third_party/WebKit/Source/platform/heap/Heap.h +++ b/third_party/WebKit/Source/platform/heap/Heap.h
@@ -234,7 +234,7 @@ bool isMainThreadHeap() { return this == ThreadHeap::mainThreadHeap(); } static ThreadHeap* mainThreadHeap() { return s_mainThreadHeap; } -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() bool isAtSafePoint(); BasePage* findPageFromAddress(Address); #endif @@ -378,7 +378,7 @@ void registerWeakTable(void* containerObject, EphemeronCallback, EphemeronCallback); -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() bool weakTableRegistered(const void*); #endif @@ -590,7 +590,7 @@ #define IS_EAGERLY_FINALIZED() \ (pageFromObject(this)->arena()->arenaIndex() == BlinkGC::EagerSweepArenaIndex) -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() class VerifyEagerFinalization { DISALLOW_NEW();
diff --git a/third_party/WebKit/Source/platform/heap/HeapAllocator.h b/third_party/WebKit/Source/platform/heap/HeapAllocator.h index 649135b..ec391a1 100644 --- a/third_party/WebKit/Source/platform/heap/HeapAllocator.h +++ b/third_party/WebKit/Source/platform/heap/HeapAllocator.h
@@ -180,7 +180,7 @@ iterationDoneCallback); } -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() template <typename VisitorDispatcher> static bool weakTableRegistered(VisitorDispatcher visitor, const void* closure) {
diff --git a/third_party/WebKit/Source/platform/heap/HeapCompact.cpp b/third_party/WebKit/Source/platform/heap/HeapCompact.cpp index 591caef56..76b9ed8 100644 --- a/third_party/WebKit/Source/platform/heap/HeapCompact.cpp +++ b/third_party/WebKit/Source/platform/heap/HeapCompact.cpp
@@ -87,7 +87,7 @@ blinkPageAddress(slotAddress) + blinkGuardPageSize); if (LIKELY(!m_relocatablePages.contains(slotPage))) return; -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() DCHECK(slotPage->contains(slotAddress)); #endif // Unlikely case, the slot resides on a compacting arena's page.
diff --git a/third_party/WebKit/Source/platform/heap/HeapPage.cpp b/third_party/WebKit/Source/platform/heap/HeapPage.cpp index ad097d4..cb8f77ef 100644 --- a/third_party/WebKit/Source/platform/heap/HeapPage.cpp +++ b/third_party/WebKit/Source/platform/heap/HeapPage.cpp
@@ -89,7 +89,7 @@ namespace blink { -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() NO_SANITIZE_ADDRESS void HeapObjectHeader::zapMagic() { ASSERT(checkHeader()); @@ -158,7 +158,7 @@ allocatorDump->AddScalar("free_count", "objects", heapInfo.freeCount); } -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() BasePage* BaseArena::findPageFromAddress(Address address) { for (BasePage* page = m_firstPage; page; page = page->next()) { if (page->contains(address)) @@ -562,7 +562,7 @@ freedPageCount++; BasePage* nextPage; availablePages->unlink(&nextPage); -#if !(ENABLE(ASSERT) || defined(LEAK_SANITIZER) || \ +#if !(DCHECK_IS_ON() || defined(LEAK_SANITIZER) || \ defined(ADDRESS_SANITIZER) || defined(MEMORY_SANITIZER)) // Clear out the page before adding it to the free page pool, which // decommits it. Recommitting the page must find a zeroed page later. @@ -583,7 +583,7 @@ heap.compaction()->finishedArenaCompaction(this, freedPageCount, freedSize); } -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() bool NormalPageArena::isConsistentForGC() { // A thread heap is consistent for sweeping if none of the pages to be swept // contain a freelist block or the current allocation point. @@ -662,7 +662,7 @@ page->link(&m_firstPage); getThreadState()->heap().heapStats().increaseAllocatedSpace(page->size()); -#if ENABLE(ASSERT) || defined(LEAK_SANITIZER) || defined(ADDRESS_SANITIZER) +#if DCHECK_IS_ON() || defined(LEAK_SANITIZER) || defined(ADDRESS_SANITIZER) // Allow the following addToFreeList() to add the newly allocated memory // to the free list. ASAN_UNPOISON_MEMORY_REGION(page->payload(), page->payloadSize()); @@ -900,7 +900,7 @@ } void NormalPageArena::setAllocationPoint(Address point, size_t size) { -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() if (point) { ASSERT(size); BasePage* page = pageFromObject(point); @@ -1035,7 +1035,7 @@ Address largeObjectAddress = pageMemory->writableStart(); Address headerAddress = largeObjectAddress + LargeObjectPage::pageHeaderSize(); -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() // Verify that the allocated PageMemory is expectedly zeroed. for (size_t i = 0; i < largeObjectSize; ++i) ASSERT(!largeObjectAddress[i]); @@ -1148,7 +1148,7 @@ } entry = new (NotNull, address) FreeListEntry(size); -#if ENABLE(ASSERT) || defined(LEAK_SANITIZER) || defined(ADDRESS_SANITIZER) +#if DCHECK_IS_ON() || defined(LEAK_SANITIZER) || defined(ADDRESS_SANITIZER) // The following logic delays reusing free lists for (at least) one GC // cycle or coalescing. This is helpful to detect use-after-free errors // that could be caused by lazy sweeping etc. @@ -1198,7 +1198,7 @@ m_biggestFreeListIndex = index; } -#if ENABLE(ASSERT) || defined(LEAK_SANITIZER) || defined(ADDRESS_SANITIZER) || \ +#if DCHECK_IS_ON() || defined(LEAK_SANITIZER) || defined(ADDRESS_SANITIZER) || \ defined(MEMORY_SANITIZER) NO_SANITIZE_ADDRESS NO_SANITIZE_MEMORY @@ -1339,7 +1339,7 @@ arenaForNormalPage()->freePage(this); } -#if !ENABLE(ASSERT) && !defined(LEAK_SANITIZER) && !defined(ADDRESS_SANITIZER) +#if !DCHECK_IS_ON() && !defined(LEAK_SANITIZER) && !defined(ADDRESS_SANITIZER) static void discardPages(Address begin, Address end) { uintptr_t beginAddress = WTF::RoundUpToSystemPage(reinterpret_cast<uintptr_t>(begin)); @@ -1395,7 +1395,7 @@ } if (startOfGap != headerAddress) { pageArena->addToFreeList(startOfGap, headerAddress - startOfGap); -#if !ENABLE(ASSERT) && !defined(LEAK_SANITIZER) && !defined(ADDRESS_SANITIZER) +#if !DCHECK_IS_ON() && !defined(LEAK_SANITIZER) && !defined(ADDRESS_SANITIZER) // Discarding pages increases page faults and may regress performance. // So we enable this only on low-RAM devices. if (MemoryCoordinator::isLowEndDevice()) @@ -1409,7 +1409,7 @@ } if (startOfGap != payloadEnd()) { pageArena->addToFreeList(startOfGap, payloadEnd() - startOfGap); -#if !ENABLE(ASSERT) && !defined(LEAK_SANITIZER) && !defined(ADDRESS_SANITIZER) +#if !DCHECK_IS_ON() && !defined(LEAK_SANITIZER) && !defined(ADDRESS_SANITIZER) if (MemoryCoordinator::isLowEndDevice()) discardPages(startOfGap + sizeof(FreeListEntry), payloadEnd()); #endif @@ -1459,7 +1459,7 @@ // As compaction is under way, leave the freed memory accessible // while compacting the rest of the page. We just zap the payload // to catch out other finalizers trying to access it. -#if ENABLE(ASSERT) || defined(LEAK_SANITIZER) || defined(ADDRESS_SANITIZER) || \ +#if DCHECK_IS_ON() || defined(LEAK_SANITIZER) || defined(ADDRESS_SANITIZER) || \ defined(MEMORY_SANITIZER) FreeList::zapFreedMemory(payload, payloadSize); #endif @@ -1514,7 +1514,7 @@ if (markedObjectSize) pageArena->getThreadState()->increaseMarkedObjectSize(markedObjectSize); -#if ENABLE(ASSERT) || defined(LEAK_SANITIZER) || defined(ADDRESS_SANITIZER) || \ +#if DCHECK_IS_ON() || defined(LEAK_SANITIZER) || defined(ADDRESS_SANITIZER) || \ defined(MEMORY_SANITIZER) // Zap the unused portion, until it is either compacted into or freed. if (currentPage != this) { @@ -1665,7 +1665,7 @@ return header; } -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() static bool isUninitializedMemory(void* objectPointer, size_t objectSize) { // Scan through the object's fields and check that they are all zero. Address* objectFields = reinterpret_cast<Address*>(objectPointer); @@ -1763,7 +1763,7 @@ heapInfo.freeCount += freeCount; } -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() bool NormalPage::contains(Address addr) { Address blinkPageStart = roundToBlinkPageStart(getAddress()); // Page is at aligned address plus guard page size. @@ -1870,7 +1870,7 @@ pageDump->AddScalar("dead_size", "bytes", deadSize); } -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() bool LargeObjectPage::contains(Address object) { return roundToBlinkPageStart(getAddress()) <= object && object < roundToBlinkPageEnd(getAddress() + size());
diff --git a/third_party/WebKit/Source/platform/heap/HeapPage.h b/third_party/WebKit/Source/platform/heap/HeapPage.h index 8fbc94a..c401c9ef 100644 --- a/third_party/WebKit/Source/platform/heap/HeapPage.h +++ b/third_party/WebKit/Source/platform/heap/HeapPage.h
@@ -103,7 +103,7 @@ ASAN_UNPOISON_MEMORY_REGION(address, size); \ FreeList::checkFreedMemoryIsZapped(address, size); \ ASAN_POISON_MEMORY_REGION(address, size) -#elif ENABLE(ASSERT) || defined(LEAK_SANITIZER) || defined(ADDRESS_SANITIZER) +#elif DCHECK_IS_ON() || defined(LEAK_SANITIZER) || defined(ADDRESS_SANITIZER) #define SET_MEMORY_INACCESSIBLE(address, size) \ FreeList::zapFreedMemory(address, size); \ ASAN_POISON_MEMORY_REGION(address, size) @@ -124,7 +124,7 @@ } while (false) #endif -#if !ENABLE(ASSERT) && CPU(64BIT) +#if !DCHECK_IS_ON() && CPU(64BIT) #define USE_4BYTE_HEADER_PADDING 1 #else #define USE_4BYTE_HEADER_PADDING 0 @@ -183,7 +183,7 @@ // If gcInfoIndex is 0, this header is interpreted as a free list header. NO_SANITIZE_ADDRESS HeapObjectHeader(size_t size, size_t gcInfoIndex) { -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() m_magic = magic; #endif // sizeof(HeapObjectHeader) must be equal to or smaller than @@ -239,7 +239,7 @@ size_t payloadSize(); Address payloadEnd(); -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() bool checkHeader() const; // Zap magic number with a new magic number that means there was once an // object allocated here, but it was freed because nobody marked it during @@ -255,7 +255,7 @@ private: uint32_t m_encoded; -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() uint16_t m_magic; #endif @@ -284,7 +284,7 @@ NO_SANITIZE_ADDRESS explicit FreeListEntry(size_t size) : HeapObjectHeader(size, gcInfoIndexForFreeListHeader), m_next(nullptr) { -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() ASSERT(size >= sizeof(HeapObjectHeader)); zapMagic(); #endif @@ -346,7 +346,7 @@ return !!(*reinterpret_cast<Address*>(objectPointer)); } -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() // Sanity check for a page header address: the address of the page // header should be OS page size away from being Blink page size // aligned. @@ -421,7 +421,7 @@ virtual void takeSnapshot(base::trace_event::MemoryAllocatorDump*, ThreadState::GCSnapshotInfo&, HeapSnapshotInfo&) = 0; -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() virtual bool contains(Address) = 0; #endif virtual size_t size() = 0; @@ -494,7 +494,7 @@ void takeSnapshot(base::trace_event::MemoryAllocatorDump*, ThreadState::GCSnapshotInfo&, HeapSnapshotInfo&) override; -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() // Returns true for the whole blinkPageSize page that the page is on, even // for the header, and the unmapped guard page at the start. That ensures // the result can be used to populate the negative page cache. @@ -572,7 +572,7 @@ void takeSnapshot(base::trace_event::MemoryAllocatorDump*, ThreadState::GCSnapshotInfo&, HeapSnapshotInfo&) override; -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() // Returns true for any address that is on one of the pages that this // large object uses. That ensures that we can use a negative result to // populate the negative page cache. @@ -673,7 +673,7 @@ // Returns true if the freelist snapshot is captured. bool takeSnapshot(const String& dumpBaseName); -#if ENABLE(ASSERT) || defined(LEAK_SANITIZER) || defined(ADDRESS_SANITIZER) || \ +#if DCHECK_IS_ON() || defined(LEAK_SANITIZER) || defined(ADDRESS_SANITIZER) || \ defined(MEMORY_SANITIZER) static void zapFreedMemory(Address, size_t); static void checkFreedMemoryIsZapped(Address, size_t); @@ -707,14 +707,14 @@ void cleanupPages(); void takeSnapshot(const String& dumpBaseName, ThreadState::GCSnapshotInfo&); -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() BasePage* findPageFromAddress(Address); #endif virtual void takeFreelistSnapshot(const String& dumpBaseName) {} virtual void clearFreeLists() {} void makeConsistentForGC(); void makeConsistentForMutator(); -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() virtual bool isConsistentForGC() = 0; #endif size_t objectPayloadSizeForTesting(); @@ -760,7 +760,7 @@ m_freeList.addToFreeList(address, size); } void clearFreeLists() override; -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() bool isConsistentForGC() override; bool pagesToBeSweptContains(Address); #endif @@ -822,7 +822,7 @@ LargeObjectArena(ThreadState*, int); Address allocateLargeObjectPage(size_t, size_t gcInfoIndex); void freeLargeObjectPage(LargeObjectPage*); -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() bool isConsistentForGC() override { return true; } #endif private: @@ -852,7 +852,7 @@ return result; } -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() NO_SANITIZE_ADDRESS inline bool HeapObjectHeader::checkHeader() const { return !pageFromObject(this)->orphaned() && m_magic == magic; }
diff --git a/third_party/WebKit/Source/platform/heap/HeapTest.cpp b/third_party/WebKit/Source/platform/heap/HeapTest.cpp index a9c6d49..ffef74e5 100644 --- a/third_party/WebKit/Source/platform/heap/HeapTest.cpp +++ b/third_party/WebKit/Source/platform/heap/HeapTest.cpp
@@ -337,7 +337,7 @@ void registerWeakTable(const void*, EphemeronCallback, EphemeronCallback) override {} -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() bool weakTableRegistered(const void*) override { return false; } #endif void registerWeakCellWithCallback(void**, WeakCallback) override {} @@ -1832,7 +1832,7 @@ EXPECT_EQ(1, SimpleFinalizedObject::s_destructorCalls); } -#if ENABLE(ASSERT) || defined(LEAK_SANITIZER) || defined(ADDRESS_SANITIZER) +#if DCHECK_IS_ON() || defined(LEAK_SANITIZER) || defined(ADDRESS_SANITIZER) TEST(HeapTest, FreelistReuse) { clearOutOldGarbage(); @@ -5906,7 +5906,7 @@ // The allocation & GC overhead is considerable for this test, // straining debug builds and lower-end targets too much to be // worth running. -#if !ENABLE(ASSERT) && !OS(ANDROID) +#if !DCHECK_IS_ON() && !OS(ANDROID) DeepEagerly* obj = nullptr; for (int i = 0; i < 10000000; i++) obj = new DeepEagerly(obj);
diff --git a/third_party/WebKit/Source/platform/heap/InlinedGlobalMarkingVisitor.h b/third_party/WebKit/Source/platform/heap/InlinedGlobalMarkingVisitor.h index 5c88bc1a..ec8d5dbc 100644 --- a/third_party/WebKit/Source/platform/heap/InlinedGlobalMarkingVisitor.h +++ b/third_party/WebKit/Source/platform/heap/InlinedGlobalMarkingVisitor.h
@@ -33,7 +33,7 @@ using Impl::registerDelayedMarkNoTracing; using Impl::registerWeakTable; using Impl::registerWeakMembers; -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() using Impl::weakTableRegistered; #endif
diff --git a/third_party/WebKit/Source/platform/heap/MarkingVisitor.h b/third_party/WebKit/Source/platform/heap/MarkingVisitor.h index 63ca64d..926f4e0 100644 --- a/third_party/WebKit/Source/platform/heap/MarkingVisitor.h +++ b/third_party/WebKit/Source/platform/heap/MarkingVisitor.h
@@ -41,7 +41,7 @@ Impl::registerWeakTable(closure, iterationCallback, iterationDoneCallback); } -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() virtual bool weakTableRegistered(const void* closure) { return Impl::weakTableRegistered(closure); }
diff --git a/third_party/WebKit/Source/platform/heap/MarkingVisitorImpl.h b/third_party/WebKit/Source/platform/heap/MarkingVisitorImpl.h index 4b2f565..bd58304 100644 --- a/third_party/WebKit/Source/platform/heap/MarkingVisitorImpl.h +++ b/third_party/WebKit/Source/platform/heap/MarkingVisitorImpl.h
@@ -80,7 +80,7 @@ const_cast<void*>(closure), iterationCallback, iterationDoneCallback); } -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() inline bool weakTableRegistered(const void* closure) { return toDerived()->heap().weakTableRegistered(closure); } @@ -110,7 +110,7 @@ HeapObjectHeader* header = HeapObjectHeader::fromPayload(objectPointer); if (header->isMarked()) return false; -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() toDerived()->markNoTracing(objectPointer); #else // Inline what the above markNoTracing() call expands to,
diff --git a/third_party/WebKit/Source/platform/heap/PagePool.cpp b/third_party/WebKit/Source/platform/heap/PagePool.cpp index 97845c0..20e10ff0 100644 --- a/third_party/WebKit/Source/platform/heap/PagePool.cpp +++ b/third_party/WebKit/Source/platform/heap/PagePool.cpp
@@ -126,7 +126,7 @@ asanDisabledMemset(memory->writableStart(), 0, blinkPagePayloadSize()); } -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() bool OrphanedPagePool::contains(void* object) { for (int index = 0; index < BlinkGC::NumberOfArenas; ++index) { for (PoolEntry* entry = m_pool[index]; entry; entry = entry->next) {
diff --git a/third_party/WebKit/Source/platform/heap/PagePool.h b/third_party/WebKit/Source/platform/heap/PagePool.h index 8a0e637..0d6515ce 100644 --- a/third_party/WebKit/Source/platform/heap/PagePool.h +++ b/third_party/WebKit/Source/platform/heap/PagePool.h
@@ -64,7 +64,7 @@ ~OrphanedPagePool(); void addOrphanedPage(int, BasePage*); void decommitOrphanedPages(); -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() bool contains(void*); #endif
diff --git a/third_party/WebKit/Source/platform/heap/Persistent.h b/third_party/WebKit/Source/platform/heap/Persistent.h index 794753c9..3fe022c 100644 --- a/third_party/WebKit/Source/platform/heap/Persistent.h +++ b/third_party/WebKit/Source/platform/heap/Persistent.h
@@ -225,7 +225,7 @@ ASSERT(state->checkThread()); m_persistentNode = state->getPersistentRegion()->allocatePersistentNode( this, traceCallback); -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() m_state = state; #endif } @@ -314,10 +314,8 @@ // m_raw is accessed most, so put it at the first field. T* m_raw; PersistentNode* m_persistentNode = nullptr; -#if ENABLE(ASSERT) - ThreadState* m_state = nullptr; -#endif #if DCHECK_IS_ON() + ThreadState* m_state = nullptr; const ThreadState* m_creationThreadState; #endif }; @@ -617,7 +615,7 @@ TraceMethodDelegate<PersistentHeapCollectionBase<Collection>, &PersistentHeapCollectionBase< Collection>::tracePersistent>::trampoline); -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() m_state = state; #endif } @@ -634,7 +632,7 @@ } PersistentNode* m_persistentNode; -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() ThreadState* m_state; #endif };
diff --git a/third_party/WebKit/Source/platform/heap/PersistentNode.h b/third_party/WebKit/Source/platform/heap/PersistentNode.h index 6fbc02a..ee72628 100644 --- a/third_party/WebKit/Source/platform/heap/PersistentNode.h +++ b/third_party/WebKit/Source/platform/heap/PersistentNode.h
@@ -23,7 +23,7 @@ public: PersistentNode() : m_self(nullptr), m_trace(nullptr) { ASSERT(isUnused()); } -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() ~PersistentNode() { // If you hit this assert, it means that the thread finished // without clearing persistent handles that the thread created. @@ -214,7 +214,7 @@ void tracePersistentNodes(Visitor* visitor) { // If this assert triggers, you're tracing without being in a LockScope. -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() DCHECK(m_mutex.locked()); #endif m_persistentRegion->tracePersistentNodes(
diff --git a/third_party/WebKit/Source/platform/heap/ThreadState.cpp b/third_party/WebKit/Source/platform/heap/ThreadState.cpp index 00a5d0ef..d9cf18fc 100644 --- a/third_party/WebKit/Source/platform/heap/ThreadState.cpp +++ b/third_party/WebKit/Source/platform/heap/ThreadState.cpp
@@ -1242,7 +1242,7 @@ m_arenas[i]->prepareHeapForTermination(); } -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() BasePage* ThreadState::findPageFromAddress(Address address) { for (int i = 0; i < BlinkGC::NumberOfArenas; ++i) { if (BasePage* page = m_arenas[i]->findPageFromAddress(address))
diff --git a/third_party/WebKit/Source/platform/heap/ThreadState.h b/third_party/WebKit/Source/platform/heap/ThreadState.h index 622d0c2..8769d2b 100644 --- a/third_party/WebKit/Source/platform/heap/ThreadState.h +++ b/third_party/WebKit/Source/platform/heap/ThreadState.h
@@ -191,7 +191,7 @@ static ThreadState* fromObject(const void*); bool isMainThread() const { return this == mainThreadState(); } -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() bool checkThread() const { return m_thread == currentThread(); } #endif @@ -354,7 +354,7 @@ return m_arenas[arenaIndex]; } -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() // Infrastructure to determine if an address is within one of the // address ranges for the Blink heap. If the address is in the Blink // heap the containing heap page is returned. @@ -528,7 +528,7 @@ static_assert(sizeof(&T::invokePreFinalizer) > 0, "USING_PRE_FINALIZER(T) must be defined."); ThreadState* state = ThreadState::current(); -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() DCHECK(state->checkThread()); #endif DCHECK(!state->sweepForbidden());
diff --git a/third_party/WebKit/Source/platform/heap/TraceTraits.h b/third_party/WebKit/Source/platform/heap/TraceTraits.h index 49f5b51..11d4d8c 100644 --- a/third_party/WebKit/Source/platform/heap/TraceTraits.h +++ b/third_party/WebKit/Source/platform/heap/TraceTraits.h
@@ -49,7 +49,7 @@ public: template <typename VisitorDispatcher> static void mark(VisitorDispatcher visitor, const T* t) { -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() assertObjectHasGCInfo(const_cast<T*>(t), GCInfoTrait<T>::index()); #endif // Default mark method of the trait just calls the two-argument mark
diff --git a/third_party/WebKit/Source/platform/heap/Visitor.cpp b/third_party/WebKit/Source/platform/heap/Visitor.cpp index ed32a71e..9187501d 100644 --- a/third_party/WebKit/Source/platform/heap/Visitor.cpp +++ b/third_party/WebKit/Source/platform/heap/Visitor.cpp
@@ -22,7 +22,7 @@ // See ThreadState::runScheduledGC() why we need to already be in a // GCForbiddenScope before any safe point is entered. DCHECK(state->isGCForbidden()); -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() DCHECK(state->checkThread()); #endif }
diff --git a/third_party/WebKit/Source/platform/heap/Visitor.h b/third_party/WebKit/Source/platform/heap/Visitor.h index 7006d97..3e4b441 100644 --- a/third_party/WebKit/Source/platform/heap/Visitor.h +++ b/third_party/WebKit/Source/platform/heap/Visitor.h
@@ -379,7 +379,7 @@ virtual void registerWeakTable(const void*, EphemeronCallback, EphemeronCallback) = 0; -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() virtual bool weakTableRegistered(const void*) = 0; #endif
diff --git a/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.cc b/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.cc index 949a51a..c402dd0 100644 --- a/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.cc +++ b/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.cc
@@ -154,8 +154,11 @@ TimeDomain* time_domain) : task_queue_manager(task_queue_manager), time_domain(time_domain), - delayed_work_queue(new WorkQueue(task_queue, "delayed")), - immediate_work_queue(new WorkQueue(task_queue, "immediate")), + delayed_work_queue( + new WorkQueue(task_queue, "delayed", WorkQueue::QueueType::DELAYED)), + immediate_work_queue(new WorkQueue(task_queue, + "immediate", + WorkQueue::QueueType::IMMEDIATE)), set_index(0), is_enabled_refcount(0), voter_refcount(0), @@ -325,7 +328,7 @@ EnqueueOrder sequence_number, bool nestable) { if (any_thread().immediate_incoming_queue.empty()) - any_thread().time_domain->RegisterAsUpdatableTaskQueue(this); + any_thread().time_domain->OnQueueHasIncomingImmediateWork(this); // If the |immediate_incoming_queue| is empty we need a DoWork posted to make // it run. if (any_thread().immediate_incoming_queue.empty()) { @@ -346,6 +349,20 @@ TraceQueueSize(true); } +void TaskQueueImpl::ReloadImmediateWorkQueueIfEmpty() { + if (!main_thread_only().immediate_work_queue->Empty()) + return; + + main_thread_only().immediate_work_queue->ReloadEmptyImmediateQueue(); +} + +WTF::Deque<TaskQueueImpl::Task> TaskQueueImpl::TakeImmediateIncomingQueue() { + base::AutoLock lock(any_thread_lock_); + WTF::Deque<TaskQueueImpl::Task> queue; + queue.swap(any_thread().immediate_incoming_queue); + return queue; +} + bool TaskQueueImpl::IsEmpty() const { if (!main_thread_only().delayed_work_queue->Empty() || !main_thread_only().delayed_incoming_queue.empty() || @@ -421,20 +438,6 @@ } } -bool TaskQueueImpl::MaybeUpdateImmediateWorkQueues() { - if (!main_thread_only().task_queue_manager) - return false; - - if (!main_thread_only().immediate_work_queue->Empty()) - return true; - - base::AutoLock lock(any_thread_lock_); - main_thread_only().immediate_work_queue->SwapLocked( - any_thread().immediate_incoming_queue); - // |immediate_work_queue| is now empty so updates are no longer required. - return false; -} - void TaskQueueImpl::TraceQueueSize(bool is_locked) const { bool is_tracing; TRACE_EVENT_CATEGORY_GROUP_ENABLED(disabled_by_default_tracing_category_, @@ -576,7 +579,7 @@ any_thread().time_domain = time_domain; } // We rely here on TimeDomain::MigrateQueue being thread-safe to use with - // TimeDomain::Register/UnregisterAsUpdatableTaskQueue. + // TimeDomain::Register. main_thread_only().time_domain->MigrateQueue(this, time_domain); main_thread_only().time_domain = time_domain; } @@ -798,8 +801,8 @@ return; if (enable) { - // Note it's the job of the selector to tell the TaskQueueManager if - // a DoWork needs posting. + // Note the selector calls TaskQueueManager::OnTaskQueueEnabled which posts + // a DoWork if needed. main_thread_only().task_queue_manager->selector_.EnableQueue(this); } else { main_thread_only().task_queue_manager->selector_.DisableQueue(this); @@ -835,6 +838,12 @@ main_thread_only().delayed_incoming_queue = std::move(remaining_tasks); } +void TaskQueueImpl::PushImmediateIncomingTaskForTest( + TaskQueueImpl::Task&& task) { + base::AutoLock lock(any_thread_lock_); + any_thread().immediate_incoming_queue.push_back(std::move(task)); +} + } // namespace internal } // namespace scheduler } // namespace blink
diff --git a/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.h b/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.h index 6f85115..8c31e12 100644 --- a/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.h +++ b/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.h
@@ -140,9 +140,8 @@ const char* GetName() const override; QueueType GetQueueType() const override; - // If this returns false then future updates for this queue are not needed - // unless requested. - bool MaybeUpdateImmediateWorkQueues(); + // Must only be called from the thread this task queue was created on. + void ReloadImmediateWorkQueueIfEmpty(); void AsValueInto(base::trace_event::TracedValue* state) const; @@ -193,6 +192,7 @@ main_thread_only().heap_handle = heap_handle; } + void PushImmediateIncomingTaskForTest(TaskQueueImpl::Task&& task); EnqueueOrder GetFenceForTest() const; class QueueEnabledVoterImpl : public QueueEnabledVoter { @@ -294,6 +294,10 @@ EnqueueOrder sequence_number, bool nestable); + // Extracts all the tasks from the immediate incoming queue and clears it. + // Can be called from any thread. + WTF::Deque<TaskQueueImpl::Task> TakeImmediateIncomingQueue(); + // As BlockedByFence but safe to be called while locked. bool BlockedByFenceLocked() const; @@ -323,9 +327,9 @@ } const QueueType type_; - const char* name_; - const char* disabled_by_default_tracing_category_; - const char* disabled_by_default_verbose_tracing_category_; + const char* const name_; + const char* const disabled_by_default_tracing_category_; + const char* const disabled_by_default_verbose_tracing_category_; base::ThreadChecker main_thread_checker_; MainThreadOnly main_thread_only_;
diff --git a/third_party/WebKit/Source/platform/scheduler/base/time_domain.cc b/third_party/WebKit/Source/platform/scheduler/base/time_domain.cc index 59e3e34..25d0caf 100644 --- a/third_party/WebKit/Source/platform/scheduler/base/time_domain.cc +++ b/third_party/WebKit/Source/platform/scheduler/base/time_domain.cc
@@ -27,7 +27,11 @@ void TimeDomain::UnregisterQueue(internal::TaskQueueImpl* queue) { DCHECK(main_thread_checker_.CalledOnValidThread()); DCHECK_EQ(queue->GetTimeDomain(), this); - UnregisterAsUpdatableTaskQueue(queue); + + { + base::AutoLock lock(has_incoming_immediate_work_lock_); + has_incoming_immediate_work_.erase(queue); + } // If no wakeup has been requested then bail out. if (!queue->heap_handle().IsValid()) @@ -47,8 +51,16 @@ // Make sure we remember to update |queue| if it's got incoming immediate // work. - if (UnregisterAsUpdatableTaskQueue(queue)) - destination_time_domain->updatable_queue_set_.insert(queue); + bool has_incoming_immediate_work; + { + base::AutoLock lock(has_incoming_immediate_work_lock_); + has_incoming_immediate_work = has_incoming_immediate_work_.erase(queue); + } + if (has_incoming_immediate_work) { + base::AutoLock lock( + destination_time_domain->has_incoming_immediate_work_lock_); + destination_time_domain->has_incoming_immediate_work_.insert(queue); + } // If no wakeup has been requested then bail out. if (!queue->heap_handle().IsValid()) @@ -94,64 +106,32 @@ observer_->OnTimeDomainHasDelayedWork(queue); } -void TimeDomain::RegisterAsUpdatableTaskQueue(internal::TaskQueueImpl* queue) { +void TimeDomain::OnQueueHasIncomingImmediateWork( + internal::TaskQueueImpl* queue) { { - base::AutoLock lock(newly_updatable_lock_); - newly_updatable_.push_back(queue); + base::AutoLock lock(has_incoming_immediate_work_lock_); + has_incoming_immediate_work_.insert(queue); } + if (observer_) observer_->OnTimeDomainHasImmediateWork(queue); } -bool TimeDomain::UnregisterAsUpdatableTaskQueue( - internal::TaskQueueImpl* queue) { - DCHECK(main_thread_checker_.CalledOnValidThread()); - - bool was_updatable = updatable_queue_set_.erase(queue) != 0; - - base::AutoLock lock(newly_updatable_lock_); - // Remove all copies of |queue| from |newly_updatable_|. - for (size_t i = 0; i < newly_updatable_.size();) { - if (newly_updatable_[i] == queue) { - // Move last element into slot #i and then compact. - newly_updatable_[i] = newly_updatable_.back(); - newly_updatable_.pop_back(); - was_updatable = true; - } else { - i++; - } - } - return was_updatable; -} - void TimeDomain::UpdateWorkQueues(LazyNow lazy_now) { DCHECK(main_thread_checker_.CalledOnValidThread()); // Move any ready delayed tasks into the Incoming queues. WakeupReadyDelayedQueues(&lazy_now); - MoveNewlyUpdatableQueuesIntoUpdatableQueueSet(); + std::set<internal::TaskQueueImpl*> queues_to_reload_if_empty; - std::set<internal::TaskQueueImpl*>::iterator iter = - updatable_queue_set_.begin(); - while (iter != updatable_queue_set_.end()) { - std::set<internal::TaskQueueImpl*>::iterator queue_it = iter++; - internal::TaskQueueImpl* queue = *queue_it; - - // Update the queue and remove from the set if subsequent updates are not - // required. - if (!queue->MaybeUpdateImmediateWorkQueues()) - updatable_queue_set_.erase(queue_it); + { + base::AutoLock lock(has_incoming_immediate_work_lock_); + std::swap(queues_to_reload_if_empty, has_incoming_immediate_work_); } -} -void TimeDomain::MoveNewlyUpdatableQueuesIntoUpdatableQueueSet() { - DCHECK(main_thread_checker_.CalledOnValidThread()); - base::AutoLock lock(newly_updatable_lock_); - while (!newly_updatable_.empty()) { - updatable_queue_set_.insert(newly_updatable_.back()); - newly_updatable_.pop_back(); - } + for (internal::TaskQueueImpl* queue : queues_to_reload_if_empty) + queue->ReloadImmediateWorkQueueIfEmpty(); } void TimeDomain::WakeupReadyDelayedQueues(LazyNow* lazy_now) { @@ -190,10 +170,13 @@ void TimeDomain::AsValueInto(base::trace_event::TracedValue* state) const { state->BeginDictionary(); state->SetString("name", GetName()); - state->BeginArray("updatable_queue_set"); - for (auto* queue : updatable_queue_set_) - state->AppendString(queue->GetName()); - state->EndArray(); + { + base::AutoLock lock(has_incoming_immediate_work_lock_); + state->BeginArray("has_incoming_immediate_work"); + for (internal::TaskQueueImpl* queue : has_incoming_immediate_work_) + state->AppendString(queue->GetName()); + state->EndArray(); + } state->SetInteger("registered_delay_count", delayed_wakeup_queue_.size()); if (!delayed_wakeup_queue_.empty()) { base::TimeDelta delay = delayed_wakeup_queue_.min().time - Now();
diff --git a/third_party/WebKit/Source/platform/scheduler/base/time_domain.h b/third_party/WebKit/Source/platform/scheduler/base/time_domain.h index 639d174..f7f31b0 100644 --- a/third_party/WebKit/Source/platform/scheduler/base/time_domain.h +++ b/third_party/WebKit/Source/platform/scheduler/base/time_domain.h
@@ -88,9 +88,11 @@ // the next task was posted to and it returns true. Returns false otherwise. bool NextScheduledTaskQueue(TaskQueue** out_task_queue) const; - // Adds |queue| to the set of task queues that UpdateWorkQueues calls - // UpdateWorkQueue on. - void RegisterAsUpdatableTaskQueue(internal::TaskQueueImpl* queue); + // Adds |queue| to |has_incoming_immediate_work_| which causes + // UpdateWorkQueues to reload the immediate work queue if empty. Can be + // called from any thread. + // TODO(alexclarke): Move this to the TaskQueueManager. + void OnQueueHasIncomingImmediateWork(internal::TaskQueueImpl* queue); // Schedules a call to TaskQueueImpl::WakeUpForDelayedWork when this // TimeDomain reaches |delayed_run_time|. This supersedes any previously @@ -102,10 +104,6 @@ // Registers the |queue|. void RegisterQueue(internal::TaskQueueImpl* queue); - // Removes |queue| from the set of task queues that UpdateWorkQueues calls - // UpdateWorkQueue on. Returns true if |queue| was updatable. - bool UnregisterAsUpdatableTaskQueue(internal::TaskQueueImpl* queue); - // Removes |queue| from all internal data structures. void UnregisterQueue(internal::TaskQueueImpl* queue); @@ -136,8 +134,6 @@ } private: - void MoveNewlyUpdatableQueuesIntoUpdatableQueueSet(); - struct DelayedWakeup { base::TimeTicks time; internal::TaskQueueImpl* queue; @@ -164,14 +160,13 @@ IntrusiveHeap<DelayedWakeup> delayed_wakeup_queue_; - // This lock guards only |newly_updatable_|. It's not expected to be heavily - // contended. - base::Lock newly_updatable_lock_; - std::vector<internal::TaskQueueImpl*> newly_updatable_; + // This lock guards only |has_incoming_immediate_work_|. It's not expected to + // be heavily contended. + mutable base::Lock has_incoming_immediate_work_lock_; - // Set of task queues with avaliable work on the incoming queue. This should - // only be accessed from the main thread. - std::set<internal::TaskQueueImpl*> updatable_queue_set_; + // Set of task queues with newly available work on the incoming queue. + // TODO(alexclarke): Move this to the TaskQueueManager. + std::set<internal::TaskQueueImpl*> has_incoming_immediate_work_; Observer* observer_; // NOT OWNED.
diff --git a/third_party/WebKit/Source/platform/scheduler/base/time_domain_unittest.cc b/third_party/WebKit/Source/platform/scheduler/base/time_domain_unittest.cc index 69224757..7a5e35e 100644 --- a/third_party/WebKit/Source/platform/scheduler/base/time_domain_unittest.cc +++ b/third_party/WebKit/Source/platform/scheduler/base/time_domain_unittest.cc
@@ -35,7 +35,7 @@ using TimeDomain::ScheduleDelayedWork; using TimeDomain::UnregisterQueue; using TimeDomain::UpdateWorkQueues; - using TimeDomain::RegisterAsUpdatableTaskQueue; + using TimeDomain::OnQueueHasIncomingImmediateWork; // TimeSource implementation: LazyNow CreateLazyNow() const override { return LazyNow(now_); } @@ -235,7 +235,7 @@ TEST_F(TimeDomainWithObserverTest, OnTimeDomainHasImmediateWork) { EXPECT_CALL(*observer_, OnTimeDomainHasImmediateWork(task_queue_.get())); - time_domain_->RegisterAsUpdatableTaskQueue(task_queue_.get()); + time_domain_->OnQueueHasIncomingImmediateWork(task_queue_.get()); } TEST_F(TimeDomainWithObserverTest, OnTimeDomainHasDelayedWork) {
diff --git a/third_party/WebKit/Source/platform/scheduler/base/work_queue.cc b/third_party/WebKit/Source/platform/scheduler/base/work_queue.cc index 0b7d0cd..64cf33a 100644 --- a/third_party/WebKit/Source/platform/scheduler/base/work_queue.cc +++ b/third_party/WebKit/Source/platform/scheduler/base/work_queue.cc
@@ -10,12 +10,15 @@ namespace scheduler { namespace internal { -WorkQueue::WorkQueue(TaskQueueImpl* task_queue, const char* name) +WorkQueue::WorkQueue(TaskQueueImpl* task_queue, + const char* name, + QueueType queue_type) : work_queue_sets_(nullptr), task_queue_(task_queue), work_queue_set_index_(0), name_(name), - fence_(0) {} + fence_(0), + queue_type_(queue_type) {} void WorkQueue::AsValueInto(base::trace_event::TracedValue* state) const { for (const TaskQueueImpl::Task& task : work_queue_) { @@ -76,7 +79,7 @@ // If we hit the fence, pretend to WorkQueueSets that we're empty. if (work_queue_sets_ && !BlockedByFence()) - work_queue_sets_->OnPushQueue(this); + work_queue_sets_->OnTaskPushedToEmptyQueue(this); } void WorkQueue::PopTaskForTest() { @@ -85,14 +88,16 @@ work_queue_.pop_front(); } -void WorkQueue::SwapLocked(WTF::Deque<TaskQueueImpl::Task>& incoming_queue) { +void WorkQueue::ReloadEmptyImmediateQueue() { DCHECK(work_queue_.empty()); - work_queue_.swap(incoming_queue); + + work_queue_ = task_queue_->TakeImmediateIncomingQueue(); if (work_queue_.empty()) return; + // If we hit the fence, pretend to WorkQueueSets that we're empty. if (work_queue_sets_ && !BlockedByFence()) - work_queue_sets_->OnPushQueue(this); + work_queue_sets_->OnTaskPushedToEmptyQueue(this); } TaskQueueImpl::Task WorkQueue::TakeTaskFromWorkQueue() { @@ -106,6 +111,13 @@ } TaskQueueImpl::Task pending_task = work_queue_.takeFirst(); + // NB immediate tasks have a different pipeline to delayed ones. + if (queue_type_ == QueueType::IMMEDIATE && work_queue_.empty()) { + // Short-circuit the queue reload so that OnPopQueue does the right thing. + work_queue_ = task_queue_->TakeImmediateIncomingQueue(); + } + // OnPopQueue calls GetFrontTaskEnqueueOrder which checks BlockedByFence() so + // we don't need to here. work_queue_sets_->OnPopQueue(this); task_queue_->TraceQueueSize(false); return pending_task; @@ -127,7 +139,7 @@ // Moving the fence forward may unblock some tasks. if (work_queue_sets_ && !work_queue_.empty() && was_blocked_by_fence && !BlockedByFence()) { - work_queue_sets_->OnPushQueue(this); + work_queue_sets_->OnTaskPushedToEmptyQueue(this); return true; } // Fence insertion may have blocked all tasks in this work queue. @@ -140,7 +152,7 @@ bool was_blocked_by_fence = BlockedByFence(); fence_ = 0; if (work_queue_sets_ && !work_queue_.empty() && was_blocked_by_fence) { - work_queue_sets_->OnPushQueue(this); + work_queue_sets_->OnTaskPushedToEmptyQueue(this); return true; } return false;
diff --git a/third_party/WebKit/Source/platform/scheduler/base/work_queue.h b/third_party/WebKit/Source/platform/scheduler/base/work_queue.h index 53f1efce..5449800 100644 --- a/third_party/WebKit/Source/platform/scheduler/base/work_queue.h +++ b/third_party/WebKit/Source/platform/scheduler/base/work_queue.h
@@ -31,7 +31,9 @@ // throttling mechanisms. class BLINK_PLATFORM_EXPORT WorkQueue { public: - WorkQueue(TaskQueueImpl* task_queue, const char* name); + enum class QueueType { DELAYED, IMMEDIATE }; + + WorkQueue(TaskQueueImpl* task_queue, const char* name, QueueType queue_type); ~WorkQueue(); // Associates this work queue with the given work queue sets. This must be @@ -63,10 +65,10 @@ // informs the WorkQueueSets if the head changed. void Push(TaskQueueImpl::Task task); - // Swap the |work_queue_| with |incoming_queue| and if a fence hasn't been - // reached it informs the WorkQueueSets if the head changed. Assumes - // |task_queue_->any_thread_lock_| is locked. - void SwapLocked(WTF::Deque<TaskQueueImpl::Task>& incoming_queue); + // Reloads the empty |work_queue_| with + // |task_queue_->TakeImmediateIncomingQueue| and if a fence hasn't been + // reached it informs the WorkQueueSets if the head changed. + void ReloadEmptyImmediateQueue(); size_t Size() const { return work_queue_.size(); } @@ -114,12 +116,13 @@ private: WTF::Deque<TaskQueueImpl::Task> work_queue_; - WorkQueueSets* work_queue_sets_; // NOT OWNED. - TaskQueueImpl* task_queue_; // NOT OWNED. + WorkQueueSets* work_queue_sets_; // NOT OWNED. + TaskQueueImpl* const task_queue_; // NOT OWNED. size_t work_queue_set_index_; HeapHandle heap_handle_; - const char* name_; + const char* const name_; EnqueueOrder fence_; + const QueueType queue_type_; DISALLOW_COPY_AND_ASSIGN(WorkQueue); };
diff --git a/third_party/WebKit/Source/platform/scheduler/base/work_queue_sets.cc b/third_party/WebKit/Source/platform/scheduler/base/work_queue_sets.cc index 1194df9..69d81a5 100644 --- a/third_party/WebKit/Source/platform/scheduler/base/work_queue_sets.cc +++ b/third_party/WebKit/Source/platform/scheduler/base/work_queue_sets.cc
@@ -53,7 +53,7 @@ work_queue_heaps_[set_index].insert({enqueue_order, work_queue}); } -void WorkQueueSets::OnPushQueue(WorkQueue* work_queue) { +void WorkQueueSets::OnTaskPushedToEmptyQueue(WorkQueue* work_queue) { // NOTE if this function changes, we need to keep |WorkQueueSets::AddQueue| in // sync. DCHECK_EQ(this, work_queue->work_queue_sets());
diff --git a/third_party/WebKit/Source/platform/scheduler/base/work_queue_sets.h b/third_party/WebKit/Source/platform/scheduler/base/work_queue_sets.h index 923c27e3..f2749c1 100644 --- a/third_party/WebKit/Source/platform/scheduler/base/work_queue_sets.h +++ b/third_party/WebKit/Source/platform/scheduler/base/work_queue_sets.h
@@ -43,7 +43,7 @@ void ChangeSetIndex(WorkQueue* queue, size_t set_index); // O(log num queues) - void OnPushQueue(WorkQueue* work_queue); + void OnTaskPushedToEmptyQueue(WorkQueue* work_queue); // If empty it's O(1) amortized, otherwise it's O(log num queues) // Assumes |work_queue| contains the lowest enqueue order in the set.
diff --git a/third_party/WebKit/Source/platform/scheduler/base/work_queue_sets_unittest.cc b/third_party/WebKit/Source/platform/scheduler/base/work_queue_sets_unittest.cc index 0f29b01..de0b9c4 100644 --- a/third_party/WebKit/Source/platform/scheduler/base/work_queue_sets_unittest.cc +++ b/third_party/WebKit/Source/platform/scheduler/base/work_queue_sets_unittest.cc
@@ -35,7 +35,8 @@ }; WorkQueue* NewTaskQueue(const char* queue_name) { - WorkQueue* queue = new WorkQueue(nullptr, "test"); + WorkQueue* queue = + new WorkQueue(nullptr, "test", WorkQueue::QueueType::IMMEDIATE); work_queues_.push_back(base::WrapUnique(queue)); work_queue_sets_->AddQueue(queue, TaskQueue::CONTROL_PRIORITY); return queue; @@ -70,7 +71,7 @@ work_queue_sets_->GetOldestQueueInSet(set, &selected_work_queue)); } -TEST_F(WorkQueueSetsTest, OnPushQueue) { +TEST_F(WorkQueueSetsTest, OnTaskPushedToEmptyQueue) { WorkQueue* work_queue = NewTaskQueue("queue"); size_t set = TaskQueue::NORMAL_PRIORITY; work_queue_sets_->ChangeSetIndex(work_queue, set); @@ -79,7 +80,7 @@ EXPECT_FALSE( work_queue_sets_->GetOldestQueueInSet(set, &selected_work_queue)); - // Calls OnPushQueue. + // Calls OnTaskPushedToEmptyQueue. work_queue->Push(FakeTaskWithEnqueueOrder(10)); EXPECT_TRUE(work_queue_sets_->GetOldestQueueInSet(set, &selected_work_queue));
diff --git a/third_party/WebKit/Source/platform/scheduler/base/work_queue_unittest.cc b/third_party/WebKit/Source/platform/scheduler/base/work_queue_unittest.cc index 7b11f440..800e868 100644 --- a/third_party/WebKit/Source/platform/scheduler/base/work_queue_unittest.cc +++ b/third_party/WebKit/Source/platform/scheduler/base/work_queue_unittest.cc
@@ -28,11 +28,10 @@ new TaskQueueImpl(nullptr, time_domain_.get(), TaskQueue::Spec(TaskQueue::QueueType::TEST), "", "")); - work_queue_.reset(new WorkQueue(task_queue_.get(), "test")); + work_queue_.reset(new WorkQueue(task_queue_.get(), "test", + WorkQueue::QueueType::IMMEDIATE)); work_queue_sets_.reset(new WorkQueueSets(1, "test")); work_queue_sets_->AddQueue(work_queue_.get(), 0); - - incoming_queue_.reset(new WTF::Deque<TaskQueueImpl::Task>()); } void TearDown() override { work_queue_sets_->RemoveQueue(work_queue_.get()); } @@ -123,19 +122,18 @@ EXPECT_FALSE(work_queue_sets_->GetOldestQueueInSet(0, &work_queue)); } -TEST_F(WorkQueueTest, SwapLocked) { - incoming_queue_->push_back(FakeTaskWithEnqueueOrder(2)); - incoming_queue_->push_back(FakeTaskWithEnqueueOrder(3)); - incoming_queue_->push_back(FakeTaskWithEnqueueOrder(4)); +TEST_F(WorkQueueTest, ReloadEmptyImmediateQueue) { + task_queue_->PushImmediateIncomingTaskForTest(FakeTaskWithEnqueueOrder(2)); + task_queue_->PushImmediateIncomingTaskForTest(FakeTaskWithEnqueueOrder(3)); + task_queue_->PushImmediateIncomingTaskForTest(FakeTaskWithEnqueueOrder(4)); WorkQueue* work_queue; EXPECT_FALSE(work_queue_sets_->GetOldestQueueInSet(0, &work_queue)); EXPECT_TRUE(work_queue_->Empty()); - work_queue_->SwapLocked(*incoming_queue_.get()); + work_queue_->ReloadEmptyImmediateQueue(); EXPECT_TRUE(work_queue_sets_->GetOldestQueueInSet(0, &work_queue)); EXPECT_FALSE(work_queue_->Empty()); - EXPECT_TRUE(incoming_queue_->empty()); ASSERT_NE(nullptr, work_queue_->GetFrontTask()); EXPECT_EQ(2ull, work_queue_->GetFrontTask()->enqueue_order()); @@ -144,20 +142,19 @@ EXPECT_EQ(4ull, work_queue_->GetBackTask()->enqueue_order()); } -TEST_F(WorkQueueTest, SwapLockedAfterFenceHit) { +TEST_F(WorkQueueTest, ReloadEmptyImmediateQueueAfterFenceHit) { work_queue_->InsertFence(1); - incoming_queue_->push_back(FakeTaskWithEnqueueOrder(2)); - incoming_queue_->push_back(FakeTaskWithEnqueueOrder(3)); - incoming_queue_->push_back(FakeTaskWithEnqueueOrder(4)); + task_queue_->PushImmediateIncomingTaskForTest(FakeTaskWithEnqueueOrder(2)); + task_queue_->PushImmediateIncomingTaskForTest(FakeTaskWithEnqueueOrder(3)); + task_queue_->PushImmediateIncomingTaskForTest(FakeTaskWithEnqueueOrder(4)); WorkQueue* work_queue; EXPECT_FALSE(work_queue_sets_->GetOldestQueueInSet(0, &work_queue)); EXPECT_TRUE(work_queue_->Empty()); - work_queue_->SwapLocked(*incoming_queue_.get()); + work_queue_->ReloadEmptyImmediateQueue(); EXPECT_FALSE(work_queue_sets_->GetOldestQueueInSet(0, &work_queue)); EXPECT_FALSE(work_queue_->Empty()); - EXPECT_TRUE(incoming_queue_->empty()); ASSERT_NE(nullptr, work_queue_->GetFrontTask()); EXPECT_EQ(2ull, work_queue_->GetFrontTask()->enqueue_order());
diff --git a/third_party/WebKit/Source/platform/text/BidiResolver.h b/third_party/WebKit/Source/platform/text/BidiResolver.h index fafb6c288..3257d331 100644 --- a/third_party/WebKit/Source/platform/text/BidiResolver.h +++ b/third_party/WebKit/Source/platform/text/BidiResolver.h
@@ -223,7 +223,7 @@ m_nestedIsolateCount(0), m_trailingSpaceRun(0) {} -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() ~BidiResolver(); #endif @@ -375,7 +375,7 @@ HashMap<Run*, MidpointState<Iterator>> m_midpointStateForIsolatedRun; }; -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() template <class Iterator, class Run, class IsolatedRun> BidiResolver<Iterator, Run, IsolatedRun>::~BidiResolver() { // The owner of this resolver should have handled the isolated runs.
diff --git a/third_party/WebKit/Source/platform/weborigin/KURL.cpp b/third_party/WebKit/Source/platform/weborigin/KURL.cpp index 7a1e7edc..c81f2d3a 100644 --- a/third_party/WebKit/Source/platform/weborigin/KURL.cpp +++ b/third_party/WebKit/Source/platform/weborigin/KURL.cpp
@@ -48,7 +48,7 @@ static const int invalidPortNumber = 0xFFFF; static void assertProtocolIsGood(const char* protocol) { -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() DCHECK_NE(protocol, ""); const char* p = protocol; while (*p) {
diff --git a/third_party/WebKit/Source/platform/weborigin/KURL.h b/third_party/WebKit/Source/platform/weborigin/KURL.h index 91c7851..c6d38fb 100644 --- a/third_party/WebKit/Source/platform/weborigin/KURL.h +++ b/third_party/WebKit/Source/platform/weborigin/KURL.h
@@ -191,6 +191,8 @@ bool isSafeToSendToAnotherThread() const; + bool whitespaceRemoved() const { return m_parsed.whitespace_removed; } + private: void init(const KURL& base, const String& relative,
diff --git a/third_party/WebKit/Source/platform/weborigin/KURLTest.cpp b/third_party/WebKit/Source/platform/weborigin/KURLTest.cpp index 8746f2af..896f65e 100644 --- a/third_party/WebKit/Source/platform/weborigin/KURLTest.cpp +++ b/third_party/WebKit/Source/platform/weborigin/KURLTest.cpp
@@ -302,6 +302,37 @@ EXPECT_EQ(encodeWithURLEscapeSequences(precomposed), "%C4%99"); } +TEST(KURLTest, RemoveWhitespace) { + struct { + const char* input; + const char* expected; + } cases[] = { + {"ht\ntps://example.com/yay?boo#foo", "https://example.com/yay?boo#foo"}, + {"ht\ttps://example.com/yay?boo#foo", "https://example.com/yay?boo#foo"}, + {"ht\rtps://example.com/yay?boo#foo", "https://example.com/yay?boo#foo"}, + {"https://exa\nmple.com/yay?boo#foo", "https://example.com/yay?boo#foo"}, + {"https://exa\tmple.com/yay?boo#foo", "https://example.com/yay?boo#foo"}, + {"https://exa\rmple.com/yay?boo#foo", "https://example.com/yay?boo#foo"}, + {"https://example.com/y\nay?boo#foo", "https://example.com/yay?boo#foo"}, + {"https://example.com/y\tay?boo#foo", "https://example.com/yay?boo#foo"}, + {"https://example.com/y\ray?boo#foo", "https://example.com/yay?boo#foo"}, + {"https://example.com/yay?b\noo#foo", "https://example.com/yay?boo#foo"}, + {"https://example.com/yay?b\too#foo", "https://example.com/yay?boo#foo"}, + {"https://example.com/yay?b\roo#foo", "https://example.com/yay?boo#foo"}, + {"https://example.com/yay?boo#f\noo", "https://example.com/yay?boo#foo"}, + {"https://example.com/yay?boo#f\too", "https://example.com/yay?boo#foo"}, + {"https://example.com/yay?boo#f\roo", "https://example.com/yay?boo#foo"}, + }; + + for (const auto& test : cases) { + const KURL input(ParsedURLString, test.input); + const KURL expected(ParsedURLString, test.expected); + EXPECT_EQ(input, expected); + EXPECT_TRUE(input.whitespaceRemoved()); + EXPECT_FALSE(expected.whitespaceRemoved()); + } +} + TEST(KURLTest, ResolveEmpty) { KURL emptyBase;
diff --git a/third_party/WebKit/Source/wtf/Assertions.h b/third_party/WebKit/Source/wtf/Assertions.h index 5904187a..392b24d 100644 --- a/third_party/WebKit/Source/wtf/Assertions.h +++ b/third_party/WebKit/Source/wtf/Assertions.h
@@ -46,14 +46,8 @@ #include <windows.h> #endif -// Users must test "#if ENABLE(ASSERT)", which helps ensure that code -// testing this macro has included this header. -#ifndef ENABLE_ASSERT -#define ENABLE_ASSERT DCHECK_IS_ON() -#endif - #ifndef LOG_DISABLED -#define LOG_DISABLED !ENABLE(ASSERT) +#define LOG_DISABLED !DCHECK_IS_ON() #endif // These helper functions are always declared, but not necessarily always @@ -152,7 +146,7 @@ LAZY_STREAM(logging::LogMessage(file, line, #assertion).stream(), \ DCHECK_IS_ON() ? !(assertion) : false) -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() #define ASSERT(assertion) DCHECK(assertion) #define ASSERT_NOT_REACHED() NOTREACHED() #else @@ -162,7 +156,7 @@ // Users must test "#if ENABLE(SECURITY_ASSERT)", which helps ensure // that code testing this macro has included this header. -#if defined(ADDRESS_SANITIZER) || ENABLE(ASSERT) +#if defined(ADDRESS_SANITIZER) || DCHECK_IS_ON() #define ENABLE_SECURITY_ASSERT 1 #else #define ENABLE_SECURITY_ASSERT 0
diff --git a/third_party/WebKit/Source/wtf/AssertionsTest.cpp b/third_party/WebKit/Source/wtf/AssertionsTest.cpp index 76fc801..a15d47c 100644 --- a/third_party/WebKit/Source/wtf/AssertionsTest.cpp +++ b/third_party/WebKit/Source/wtf/AssertionsTest.cpp
@@ -12,7 +12,7 @@ TEST(AssertionsTest, Assertions) { ASSERT(true); -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() EXPECT_DEATH_IF_SUPPORTED(ASSERT(false), ""); EXPECT_DEATH_IF_SUPPORTED(ASSERT_NOT_REACHED(), ""); #endif
diff --git a/third_party/WebKit/Source/wtf/dtoa/cached-powers.cc b/third_party/WebKit/Source/wtf/dtoa/cached-powers.cc index 4bc1a74..97b7e9a 100644 --- a/third_party/WebKit/Source/wtf/dtoa/cached-powers.cc +++ b/third_party/WebKit/Source/wtf/dtoa/cached-powers.cc
@@ -138,7 +138,7 @@ const int PowersOfTenCache::kMinDecimalExponent = -348; // kCachedPowers[0].decimal_exponent const int PowersOfTenCache::kMaxDecimalExponent = 340; // kCachedPowers[kCachedPowersLength - 1].decimal_exponent -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() static const int kCachedPowersLength = ARRAY_SIZE(kCachedPowers); // Check that the static constants match the values in kCachedPowers. @@ -155,20 +155,20 @@ int max_exponent, DiyFp* power, int* decimal_exponent) { -#if ENABLE(ASSERT) - validateStaticConstants(); +#if DCHECK_IS_ON() + validateStaticConstants(); #endif - const int kQ = DiyFp::kSignificandSize; - double k = ceil((min_exponent + kQ - 1) * kD_1_LOG2_10); - int foo = kCachedPowersOffset; - int index = - (foo + static_cast<int>(k) - 1) / kDecimalExponentDistance + 1; - ASSERT(0 <= index && index < kCachedPowersLength); - CachedPower cached_power = kCachedPowers[index]; - ASSERT(min_exponent <= cached_power.binary_exponent); - ASSERT(cached_power.binary_exponent <= max_exponent); - *decimal_exponent = cached_power.decimal_exponent; - *power = DiyFp(cached_power.significand, cached_power.binary_exponent); + const int kQ = DiyFp::kSignificandSize; + double k = ceil((min_exponent + kQ - 1) * kD_1_LOG2_10); + int foo = kCachedPowersOffset; + int index = + (foo + static_cast<int>(k) - 1) / kDecimalExponentDistance + 1; + ASSERT(0 <= index && index < kCachedPowersLength); + CachedPower cached_power = kCachedPowers[index]; + ASSERT(min_exponent <= cached_power.binary_exponent); + ASSERT(cached_power.binary_exponent <= max_exponent); + *decimal_exponent = cached_power.decimal_exponent; + *power = DiyFp(cached_power.significand, cached_power.binary_exponent); } @@ -177,7 +177,7 @@ int* found_exponent) { ASSERT(kMinDecimalExponent <= requested_exponent); ASSERT(requested_exponent < kMaxDecimalExponent + kDecimalExponentDistance); -#if ENABLE(ASSERT) +#if DCHECK_IS_ON() validateStaticConstants(); #endif int index =
diff --git a/tools/mb/mb.py b/tools/mb/mb.py index 59b820ad..edbb434 100755 --- a/tools/mb/mb.py +++ b/tools/mb/mb.py
@@ -1060,14 +1060,14 @@ android = 'target_os="android"' in vals['gn_args'] ozone = 'use_ozone=true' in vals['gn_args'] - ozone_x11 = (ozone and 'args' in isolate_map[target] and - '--ozone-platform=x11' in isolate_map[target]['args']) + chromeos = 'target_os="chromeos"' in vals['gn_args'] - # This needs to mirror the settings in //build/config/ui.gni: - # use_x11 = is_linux && !use_ozone || use_ozone && --ozone-platform=x11 - use_x11 = (self.platform == 'linux2' and + # This should be true if tests with type='windowed_test_launcher' are + # expected to run using xvfb. For example, Linux Desktop, X11 CrOS and + # Ozone CrOS builds. + use_xvfb = (self.platform == 'linux2' and not android and - (ozone_x11 or not ozone)) + ((not ozone) or (ozone and chromeos))) asan = 'is_asan=true' in vals['gn_args'] msan = 'is_msan=true' in vals['gn_args'] @@ -1103,7 +1103,7 @@ ] cmdline = (['./../../build/android/test_wrapper/logdog_wrapper.py'] + logdog_command + test_cmdline) - elif use_x11 and test_type == 'windowed_test_launcher': + elif use_xvfb and test_type == 'windowed_test_launcher': extra_files = [ '../../testing/test_env.py', '../../testing/xvfb.py',
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index 78a0d5c2..eb1845a 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml
@@ -51858,6 +51858,17 @@ </summary> </histogram> +<histogram base="true" name="PurgeAndSuspend.Experimental.MemoryGrowth" + units="KB"> +<!-- Name completed by histogram_suffixes name="PurgeAndSuspendExperiment" --> + + <owner>tasak@google.org</owner> + <summary> + The growth of the background renderer's memory usage after a background + renderer is purged. This is recorded 5, 10 and 15 minutes after the purge. + </summary> +</histogram> + <histogram name="PurgeAndSuspend.Memory.BlinkGCKB" units="KB"> <owner>tasak@google.com</owner> <summary> @@ -89391,8 +89402,7 @@ <int value="1769" label="DocumentCompleteURLHTTPContainingLessThan"/> <int value="1770" label="DocumentCompleteURLHTTPContainingNewlineAndLessThan"/> - <int value="1771" - label="DocumentCompleteURLNonHTTPContainingNewlineOrLessThan"/> + <int value="1771" label="DocumentCompleteURLNonHTTPContainingNewline"/> <int value="1772" label="CSSSelectorInternalMediaControlsTextTrackList"/> <int value="1773" label="CSSSelectorInternalMediaControlsTextTrackListItem"/> <int value="1774" @@ -115984,6 +115994,20 @@ <affected-histogram name="PLT.BeginToFinish_NormalLoad"/> </histogram_suffixes> +<histogram_suffixes name="PurgeAndSuspendExperiment" separator="."> + <suffix name="BlinkGCKB" label="Constrained to the BlinkGC allocator"/> + <suffix name="DiscardableKB" label="Constrained to discardable memory usage"/> + <suffix name="PartitionAllocKB" + label="Constrained to PartitionAlloc allocator"/> + <suffix name="MallocKB" label="Constrained to malloc memory usage"/> + <suffix name="TotalAllocatedKB" + label="Summed over the PartitionAlloc, malloc, discardable memory, + mainThreadIsolate() and BlinkGC allocators"/> + <suffix name="V8MainThreadIsolateKB" + label="Constrained to memory usage by mainThreadIsolate()"/> + <affected-histogram name="PurgeAndSuspend.Experimental.MemoryGrowth"/> +</histogram_suffixes> + <histogram_suffixes name="QueryTimeSuffix" separator="."> <suffix name="0" label="N = 0"/> <suffix name="1" label="N = 1"/>
diff --git a/ui/base/clipboard/clipboard_aurax11.cc b/ui/base/clipboard/clipboard_aurax11.cc index 9a353a1..fe05be26 100644 --- a/ui/base/clipboard/clipboard_aurax11.cc +++ b/ui/base/clipboard/clipboard_aurax11.cc
@@ -18,7 +18,7 @@ #include "base/macros.h" #include "base/memory/ref_counted_memory.h" #include "base/memory/singleton.h" -#include "base/metrics/histogram.h" +#include "base/metrics/histogram_macros.h" #include "base/stl_util.h" #include "base/strings/utf_string_conversions.h" #include "third_party/skia/include/core/SkBitmap.h"
diff --git a/ui/base/x/x11_util.cc b/ui/base/x/x11_util.cc index e0cb8d7..43bb7d7 100644 --- a/ui/base/x/x11_util.cc +++ b/ui/base/x/x11_util.cc
@@ -28,7 +28,7 @@ #include "base/macros.h" #include "base/memory/singleton.h" #include "base/message_loop/message_loop.h" -#include "base/metrics/histogram.h" +#include "base/metrics/histogram_macros.h" #include "base/single_thread_task_runner.h" #include "base/stl_util.h" #include "base/strings/string_number_conversions.h"
diff --git a/ui/gl/BUILD.gn b/ui/gl/BUILD.gn index 48ad007..360551d 100644 --- a/ui/gl/BUILD.gn +++ b/ui/gl/BUILD.gn
@@ -411,24 +411,21 @@ ] } -# Non-Ozone trybots end up trying to build this when building "all" and failing -# when X11 isn't there. -if (ozone_platform_x11) { - group("gl_unittests_ozonex") { - testonly = true - data_deps = [ - ":gl_unittests", - ] - } +# We can't run this test on real Chrome OS hardware for Ozone, so new target. +group("gl_unittests_ozone") { + testonly = true + data_deps = [ + ":gl_unittests", + ] +} - # TODO(GYP_GONE): Delete this after we've converted everything to GN. - # The _run targets exist only for compatibility w/ GYP. - group("gl_unittests_ozonex_run") { - testonly = true - deps = [ - ":gl_unittests_ozonex", - ] - } +# TODO(GYP_GONE): Delete this after we've converted everything to GN. +# The _run targets exist only for compatibility w/ GYP. +group("gl_unittests_ozone_run") { + testonly = true + deps = [ + ":gl_unittests_ozone", + ] } if (is_android) {
diff --git a/ui/keyboard/keyboard_util.cc b/ui/keyboard/keyboard_util.cc index 3523f0d..1f4069fc 100644 --- a/ui/keyboard/keyboard_util.cc +++ b/ui/keyboard/keyboard_util.cc
@@ -9,7 +9,7 @@ #include "base/command_line.h" #include "base/lazy_instance.h" #include "base/logging.h" -#include "base/metrics/histogram.h" +#include "base/metrics/histogram_macros.h" #include "base/strings/string16.h" #include "media/audio/audio_manager.h" #include "ui/aura/client/aura_constants.h"
diff --git a/ui/views/controls/scrollbar/overlay_scroll_bar.cc b/ui/views/controls/scrollbar/overlay_scroll_bar.cc index 5ea32a4..8a93b23 100644 --- a/ui/views/controls/scrollbar/overlay_scroll_bar.cc +++ b/ui/views/controls/scrollbar/overlay_scroll_bar.cc
@@ -149,15 +149,8 @@ thumb->SetBoundsRect(thumb_bounds); } -bool OverlayScrollBar::CanAcceptEvent(const ui::Event& event) { - return layer()->opacity() > 0 && BaseScrollBar::CanAcceptEvent(event); -} - void OverlayScrollBar::OnMouseEntered(const ui::MouseEvent& event) { - // Note that events are only accepted when the scrollbar is already visible - // (due to a change in the scroll value). Don't let the scrollbar vanish from - // under the mouse pointer. - hide_timer_.Stop(); + Show(); } void OverlayScrollBar::OnMouseExited(const ui::MouseEvent& event) {
diff --git a/ui/views/controls/scrollbar/overlay_scroll_bar.h b/ui/views/controls/scrollbar/overlay_scroll_bar.h index 5a21d424..5e4dac9 100644 --- a/ui/views/controls/scrollbar/overlay_scroll_bar.h +++ b/ui/views/controls/scrollbar/overlay_scroll_bar.h
@@ -27,7 +27,6 @@ // View overrides: void Layout() override; - bool CanAcceptEvent(const ui::Event& event) override; void OnMouseEntered(const ui::MouseEvent& event) override; void OnMouseExited(const ui::MouseEvent& event) override;
diff --git a/url/third_party/mozilla/url_parse.cc b/url/third_party/mozilla/url_parse.cc index 60aeb05..41768601 100644 --- a/url/third_party/mozilla/url_parse.cc +++ b/url/third_party/mozilla/url_parse.cc
@@ -690,8 +690,7 @@ } // namespace -Parsed::Parsed() : inner_parsed_(NULL) { -} +Parsed::Parsed() : whitespace_removed(false), inner_parsed_(NULL) {} Parsed::Parsed(const Parsed& other) : scheme(other.scheme),
diff --git a/url/third_party/mozilla/url_parse.h b/url/third_party/mozilla/url_parse.h index 222d605..968578ba 100644 --- a/url/third_party/mozilla/url_parse.h +++ b/url/third_party/mozilla/url_parse.h
@@ -177,6 +177,9 @@ // the string with the scheme stripped off. Component GetContent() const; + // True if whitespace was removed from the URL during parsing. + bool whitespace_removed; + // This is used for nested URL types, currently only filesystem. If you // parse a filesystem URL, the resulting Parsed will have a nested // inner_parsed_ to hold the parsed inner URL's component information.
diff --git a/url/url_util.cc b/url/url_util.cc index 867754f..2c8d697 100644 --- a/url/url_util.cc +++ b/url/url_util.cc
@@ -199,8 +199,13 @@ // Remove any whitespace from the middle of the relative URL if necessary. // Possibly this will result in copying to the new buffer. RawCanonOutputT<CHAR> whitespace_buffer; - if (whitespace_policy == REMOVE_WHITESPACE) - spec = RemoveURLWhitespace(spec, spec_len, &whitespace_buffer, &spec_len); + if (whitespace_policy == REMOVE_WHITESPACE) { + int original_len = spec_len; + spec = + RemoveURLWhitespace(spec, original_len, &whitespace_buffer, &spec_len); + if (spec_len != original_len) + output_parsed->whitespace_removed = true; + } Parsed parsed_input; #ifdef WIN32 @@ -280,6 +285,9 @@ const CHAR* relative = RemoveURLWhitespace(in_relative, in_relative_length, &whitespace_buffer, &relative_length); + if (in_relative_length != relative_length) + output_parsed->whitespace_removed = true; + bool base_is_authority_based = false; bool base_is_hierarchical = false; if (base_spec &&