diff --git a/.gitignore b/.gitignore index 8bf691f..d9ea400 100644 --- a/.gitignore +++ b/.gitignore
@@ -382,6 +382,7 @@ /third_party/leveldb /third_party/libc++-static/libc++.a /third_party/libaddressinput/src +/third_party/libdrm/src /third_party/libexif/sources /third_party/libFuzzer/src /third_party/libjingle/source
diff --git a/BUILD.gn b/BUILD.gn index deb2f340..527e5c7 100644 --- a/BUILD.gn +++ b/BUILD.gn
@@ -734,6 +734,7 @@ "//media/mojo:media_mojo_unittests", "//mojo/common:mojo_common_perftests", "//services/video_capture:video_capture_unittests", + "//tools/origin_trials/validate_subdomain_origin($host_toolchain)", ] }
diff --git a/DEPS b/DEPS index 40e836b..af04d62 100644 --- a/DEPS +++ b/DEPS
@@ -40,11 +40,11 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling Skia # and whatever else without interference from each other. - 'skia_revision': '578f52c6cf6372b88a88a05dee0efc5b67aa9a9c', + 'skia_revision': '0fcf017524fb393a43a437e5e0f3fbcf5e3a29d5', # 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': 'f8f09ec50b66b07307fca903e3b8108910f92b02', + 'v8_revision': '58ac28948a8e25dedfcbb1748316b53bdb82a906', # 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. @@ -228,7 +228,7 @@ Var('chromium_git') + '/native_client/src/third_party/scons-2.0.1.git' + '@' + '1c1550e17fc26355d08627fbdec13d8291227067', 'src/third_party/webrtc': - Var('chromium_git') + '/external/webrtc/trunk/webrtc.git' + '@' + '4f48669246d80eca01be30540878ffeccc374c0c', # commit position 15753 + Var('chromium_git') + '/external/webrtc/trunk/webrtc.git' + '@' + '7dab52145548fc6657d0ec101e33660f4987526b', # commit position 15763 'src/third_party/openmax_dl': Var('chromium_git') + '/external/webrtc/deps/third_party/openmax.git' + '@' + Var('openmax_dl_revision'),
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwServiceWorkerClientTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwServiceWorkerClientTest.java index f31b645..05fc446b 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/AwServiceWorkerClientTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwServiceWorkerClientTest.java
@@ -83,6 +83,7 @@ // Verify that WebView ServiceWorker code can properly handle http errors that happened // in ServiceWorker fetches. @SmallTest + @DisabledTest(message = "Disable for flakyness http://crbug.com/676422") public void testFetchHttpError() throws Throwable { final String fullIndexUrl = mWebServer.setResponse("/index.html", INDEX_HTML, null); final String fullSwUrl = mWebServer.setResponse("/sw.js", SW_HTML, null);
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/ClientOnReceivedError2Test.java b/android_webview/javatests/src/org/chromium/android_webview/test/ClientOnReceivedError2Test.java index 11439292..ef0d19f 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/ClientOnReceivedError2Test.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/ClientOnReceivedError2Test.java
@@ -14,7 +14,6 @@ import org.chromium.android_webview.test.util.AwTestTouchUtils; import org.chromium.android_webview.test.util.CommonResources; import org.chromium.base.test.util.Feature; -import org.chromium.base.test.util.RetryOnFailure; import org.chromium.content.browser.test.util.TestCallbackHelperContainer; import org.chromium.net.test.util.TestWebServer; @@ -173,7 +172,6 @@ @SmallTest @Feature({"AndroidWebView"}) - @RetryOnFailure(message = "crbug.com/653130") public void testUserGestureForIframeSubresource() throws Throwable { useDefaultTestAwContentsClient(); startWebServer();
diff --git a/android_webview/native/aw_contents.cc b/android_webview/native/aw_contents.cc index 66a3c05..f3a208e5 100644 --- a/android_webview/native/aw_contents.cc +++ b/android_webview/native/aw_contents.cc
@@ -61,6 +61,7 @@ #include "content/public/browser/browser_thread.h" #include "content/public/browser/child_process_security_policy.h" #include "content/public/browser/favicon_status.h" +#include "content/public/browser/interstitial_page.h" #include "content/public/browser/message_port_provider.h" #include "content/public/browser/navigation_entry.h" #include "content/public/browser/render_frame_host.h" @@ -95,6 +96,7 @@ using navigation_interception::InterceptNavigationDelegate; using content::BrowserThread; using content::ContentViewCore; +using content::RenderFrameHost; using content::WebContents; namespace android_webview { @@ -1272,6 +1274,7 @@ int process_id = new_host->GetProcess()->GetID(); int routing_id = new_host->GetRoutingID(); + // At this point, the current RVH may or may not contain a compositor. So // compositor_ may be nullptr, in which case // BrowserViewRenderer::DidInitializeCompositor() callback is time when the @@ -1280,4 +1283,25 @@ CompositorID(process_id, routing_id)); } +void AwContents::DidAttachInterstitialPage() { + CompositorID compositor_id; + RenderFrameHost* rfh = web_contents_->GetInterstitialPage()->GetMainFrame(); + compositor_id.process_id = rfh->GetProcess()->GetID(); + compositor_id.routing_id = rfh->GetRenderViewHost()->GetRoutingID(); + browser_view_renderer_.SetActiveCompositorID(compositor_id); +} + +void AwContents::DidDetachInterstitialPage() { + CompositorID compositor_id; + if (web_contents_->GetRenderProcessHost() && + web_contents_->GetRenderViewHost()) { + compositor_id.process_id = web_contents_->GetRenderProcessHost()->GetID(); + compositor_id.routing_id = + web_contents_->GetRenderViewHost()->GetRoutingID(); + } else { + LOG(WARNING) << "failed setting the compositor on detaching interstitital"; + } + browser_view_renderer_.SetActiveCompositorID(compositor_id); +} + } // namespace android_webview
diff --git a/android_webview/native/aw_contents.h b/android_webview/native/aw_contents.h index 78a94f6..32e872b2 100644 --- a/android_webview/native/aw_contents.h +++ b/android_webview/native/aw_contents.h
@@ -339,6 +339,8 @@ // content::WebContentsObserver overrides void RenderViewHostChanged(content::RenderViewHost* old_host, content::RenderViewHost* new_host) override; + void DidAttachInterstitialPage() override; + void DidDetachInterstitialPage() override; private: void InitAutofillIfNecessary(bool enabled);
diff --git a/ash/BUILD.gn b/ash/BUILD.gn index 3ddf11a..87f968a 100644 --- a/ash/BUILD.gn +++ b/ash/BUILD.gn
@@ -1401,10 +1401,7 @@ ] if (!use_x11) { - sources -= [ - "host/ash_window_tree_host_x11_unittest.cc", - "touch/touch_transformer_controller_unittest.cc", - ] + sources -= [ "host/ash_window_tree_host_x11_unittest.cc" ] } # Usage of content should be in ash_with_content.
diff --git a/ash/common/system/chromeos/ime_menu/ime_menu_tray.cc b/ash/common/system/chromeos/ime_menu/ime_menu_tray.cc index 7ac33c2..2fd3d3f 100644 --- a/ash/common/system/chromeos/ime_menu/ime_menu_tray.cc +++ b/ash/common/system/chromeos/ime_menu/ime_menu_tray.cc
@@ -50,7 +50,7 @@ // Returns the height range of ImeListView. gfx::Range GetImeListViewRange() { const int max_items = 5; - const int min_items = 2; + const int min_items = 1; const int tray_item_height = GetTrayConstant(TRAY_POPUP_ITEM_MIN_HEIGHT); return gfx::Range(tray_item_height * min_items, tray_item_height * max_items); } @@ -306,7 +306,7 @@ ImeMenuListView(SystemTrayItem* owner, bool show_keyboard_toggle, SingleImeBehavior single_ime_behavior) - : ImeListView(owner, show_keyboard_toggle, ImeListView::HIDE_SINGLE_IME) { + : ImeListView(owner, show_keyboard_toggle, single_ime_behavior) { set_should_focus_ime_after_selection_with_keyboard(true); }
diff --git a/ash/metrics/task_switch_metrics_recorder.cc b/ash/metrics/task_switch_metrics_recorder.cc index 655b9de..9314696 100644 --- a/ash/metrics/task_switch_metrics_recorder.cc +++ b/ash/metrics/task_switch_metrics_recorder.cc
@@ -73,7 +73,11 @@ TaskSwitchTimeTracker* TaskSwitchMetricsRecorder::FindTaskSwitchTimeTracker( TaskSwitchSource task_switch_source) { - return histogram_map_.get(static_cast<int>(task_switch_source)); + auto it = histogram_map_.find(static_cast<int>(task_switch_source)); + if (it == histogram_map_.end()) + return nullptr; + + return it->second.get(); } void TaskSwitchMetricsRecorder::AddTaskSwitchTimeTracker( @@ -84,8 +88,8 @@ const char* histogram_name = GetHistogramName(task_switch_source); DCHECK(histogram_name); - histogram_map_.add(static_cast<int>(task_switch_source), - base::MakeUnique<TaskSwitchTimeTracker>(histogram_name)); + histogram_map_[static_cast<int>(task_switch_source)] = + base::MakeUnique<TaskSwitchTimeTracker>(histogram_name); } } // namespace ash
diff --git a/ash/metrics/task_switch_metrics_recorder.h b/ash/metrics/task_switch_metrics_recorder.h index c4c8c4f..164d0ce5 100644 --- a/ash/metrics/task_switch_metrics_recorder.h +++ b/ash/metrics/task_switch_metrics_recorder.h
@@ -7,10 +7,10 @@ #include <memory> #include <string> +#include <unordered_map> #include "ash/ash_export.h" #include "ash/common/metrics/task_switch_source.h" -#include "base/containers/scoped_ptr_hash_map.h" #include "base/macros.h" namespace ash { @@ -62,7 +62,7 @@ // Tracks TaskSwitchSource to TaskSwitchTimeTracker mappings. The // |histogram_map_| is populated on demand the first time a // TaskSwitchTimeTracker is needed for a given source. - base::ScopedPtrHashMap<int, std::unique_ptr<TaskSwitchTimeTracker>> + std::unordered_map<int, std::unique_ptr<TaskSwitchTimeTracker>> histogram_map_; DISALLOW_COPY_AND_ASSIGN(TaskSwitchMetricsRecorder);
diff --git a/ash/touch/touch_transformer_controller.cc b/ash/touch/touch_transformer_controller.cc index 020561f..d253fc6f 100644 --- a/ash/touch/touch_transformer_controller.cc +++ b/ash/touch/touch_transformer_controller.cc
@@ -8,6 +8,7 @@ #include "ash/host/ash_window_tree_host.h" #include "ash/root_window_controller.h" #include "ash/shell.h" +#include "third_party/skia/include/core/SkMatrix44.h" #include "ui/aura/window_tree_host.h" #include "ui/display/display_layout.h" #include "ui/display/manager/chromeos/display_configurator.h" @@ -35,6 +36,127 @@ return ui::TouchscreenDevice(); } +// Given an array of touch point and display point pairs, this function computes +// and returns the constants(defined below) using a least fit algorithm. +// If (xt, yt) is a touch point then its corresponding (xd, yd) would be defined +// by the following 2 equations: +// xd = xt * A + yt * B + C +// yd = xt * D + yt * E + F +// This function computes A, B, C, D, E and F and sets |ctm| with the calibrated +// transform matrix. In case the computation fails, the function will return +// false. +// See http://crbug.com/672293 +bool GetCalibratedTransform( + std::array<std::pair<gfx::Point, gfx::Point>, 4> touch_point_pairs, + const gfx::Transform& pre_calibration_tm, + gfx::Transform* ctm) { + // Transform the display points before solving the equation. + // If the calibration was performed at a resolution that is 0.5 times the + // current resolution, then the display points (x, y) for a given touch point + // now represents a display point at (2 * x, 2 * y). This and other kinds of + // similar tranforms can be applied using |pre_calibration_tm|. + for (int row = 0; row < 4; row++) + pre_calibration_tm.TransformPoint(&touch_point_pairs[row].first); + + // Vector of the X-coordinate of display points corresponding to each of the + // touch points. + SkVector4 display_points_x( + touch_point_pairs[0].first.x(), touch_point_pairs[1].first.x(), + touch_point_pairs[2].first.x(), touch_point_pairs[3].first.x()); + // Vector of the Y-coordinate of display points corresponding to each of the + // touch points. + SkVector4 display_points_y( + touch_point_pairs[0].first.y(), touch_point_pairs[1].first.y(), + touch_point_pairs[2].first.y(), touch_point_pairs[3].first.y()); + + // Initialize |touch_point_matrix| + // If {(xt_1, yt_1), (xt_2, yt_2), (xt_3, yt_3)....} are a set of touch points + // received during calibration, then the |touch_point_matrix| would be defined + // as: + // |xt_1 yt_1 1 0| + // |xt_2 yt_2 1 0| + // |xt_3 yt_3 1 0| + // |xt_4 yt_4 1 0| + SkMatrix44 touch_point_matrix; + for (int row = 0; row < 4; row++) { + touch_point_matrix.set(row, 0, touch_point_pairs[row].second.x()); + touch_point_matrix.set(row, 1, touch_point_pairs[row].second.y()); + touch_point_matrix.set(row, 2, 1); + touch_point_matrix.set(row, 3, 0); + } + SkMatrix44 touch_point_matrix_transpose(touch_point_matrix); + touch_point_matrix_transpose.transpose(); + + SkMatrix44 product_matrix = touch_point_matrix_transpose * touch_point_matrix; + + // Set (3, 3) = 1 so that |determinent| of the matrix is != 0 and the inverse + // can be calculated. + product_matrix.set(3, 3, 1); + + SkMatrix44 product_matrix_inverse; + + // NOTE: If the determinent is zero then the inverse cannot be computed. The + // only solution is to restart touch calibration and get new points from user. + if (!product_matrix.invert(&product_matrix_inverse)) { + NOTREACHED() << "Touch Calibration failed. Determinent is zero."; + return false; + } + + product_matrix_inverse.set(3, 3, 0); + + product_matrix = product_matrix_inverse * touch_point_matrix_transpose; + + // Constants [A, B, C, 0] used to calibrate the x-coordinate of touch input. + // x_new = x_old * A + y_old * B + C; + SkVector4 x_constants = product_matrix * display_points_x; + // Constants [D, E, F, 0] used to calibrate the y-coordinate of touch input. + // y_new = x_old * D + y_old * E + F; + SkVector4 y_constants = product_matrix * display_points_y; + + // Create a transform matrix using the touch calibration data. + ctm->ConcatTransform(gfx::Transform( + x_constants.fData[0], x_constants.fData[1], 0, x_constants.fData[2], + y_constants.fData[0], y_constants.fData[1], 0, y_constants.fData[2], 0, 0, + 1, 0, 0, 0, 0, 1)); + return true; +} + +// Returns an uncalibrated touch transform. +gfx::Transform GetUncalibratedTransform( + const gfx::Transform& tm, + const display::ManagedDisplayInfo& display, + const display::ManagedDisplayInfo& touch_display, + const gfx::SizeF& touch_area, + const gfx::SizeF& touch_native_size) { + gfx::SizeF current_size(display.bounds_in_native().size()); + gfx::Transform ctm(tm); + // Take care of panel fitting only if supported. Panel fitting is emulated + // in software mirroring mode (display != touch_display). + // If panel fitting is enabled then the aspect ratio is preserved and the + // display is scaled acordingly. In this case blank regions would be present + // in order to center the displayed area. + if (display.is_aspect_preserving_scaling() || + display.id() != touch_display.id()) { + float touch_calib_ar = + touch_native_size.width() / touch_native_size.height(); + float current_ar = current_size.width() / current_size.height(); + + if (current_ar > touch_calib_ar) { // Letterboxing + ctm.Translate( + 0, (1 - current_ar / touch_calib_ar) * 0.5 * current_size.height()); + ctm.Scale(1, current_ar / touch_calib_ar); + } else if (touch_calib_ar > current_ar) { // Pillarboxing + ctm.Translate( + (1 - touch_calib_ar / current_ar) * 0.5 * current_size.width(), 0); + ctm.Scale(touch_calib_ar / current_ar, 1); + } + } + // Take care of scaling between touchscreen area and display resolution. + ctm.Scale(current_size.width() / touch_area.width(), + current_size.height() / touch_area.height()); + return ctm; +} + } // namespace // This is to compute the scale ratio for the TouchEvent's radius. The @@ -85,36 +207,71 @@ return ctm; #if defined(USE_OZONE) - // Translate the touch so that it falls within the display bounds. - ctm.Translate(display.bounds_in_native().x(), display.bounds_in_native().y()); + // Translate the touch so that it falls within the display bounds. This + // should not be performed if the displays are mirrored. + if (display.id() == touch_display.id()) { + ctm.Translate(display.bounds_in_native().x(), + display.bounds_in_native().y()); + } #endif - // Take care of panel fitting only if supported. Panel fitting is emulated in - // software mirroring mode (display != touch_display). - // If panel fitting is enabled then the aspect ratio is preserved and the - // display is scaled acordingly. In this case blank regions would be present - // in order to center the displayed area. - if (display.is_aspect_preserving_scaling() || - display.id() != touch_display.id()) { - float touch_native_ar = - touch_native_size.width() / touch_native_size.height(); - float current_ar = current_size.width() / current_size.height(); - - if (current_ar > touch_native_ar) { // Letterboxing - ctm.Translate( - 0, (1 - current_ar / touch_native_ar) * 0.5 * current_size.height()); - ctm.Scale(1, current_ar / touch_native_ar); - } else if (touch_native_ar > current_ar) { // Pillarboxing - ctm.Translate( - (1 - touch_native_ar / current_ar) * 0.5 * current_size.width(), 0); - ctm.Scale(touch_native_ar / current_ar, 1); - } + // If touch calibration data is unavailable, use naive approach. + if (!touch_display.has_touch_calibration_data()) { + return GetUncalibratedTransform(ctm, display, touch_display, touch_area, + touch_native_size); } - // Take care of scaling between touchscreen area and display resolution. - ctm.Scale(current_size.width() / touch_area.width(), - current_size.height() / touch_area.height()); - return ctm; + // The resolution at which the touch calibration was performed. + gfx::SizeF touch_calib_size(touch_display.GetTouchCalibrationData().bounds); + + // Any additional transfomration that needs to be applied to the display + // points, before we solve for the final transform. + gfx::Transform pre_transform; + + if (display.id() != touch_display.id() || + display.is_aspect_preserving_scaling()) { + // Case of displays being mirrored or in panel fitting mode. + // Aspect ratio of the touch display's resolution during calibration. + float calib_ar = touch_calib_size.width() / touch_calib_size.height(); + // Aspect ratio of the display that is being mirrored. + float current_ar = current_size.width() / current_size.height(); + + if (current_ar < calib_ar) { + pre_transform.Scale(current_size.height() / touch_calib_size.height(), + current_size.height() / touch_calib_size.height()); + pre_transform.Translate( + (current_ar / calib_ar - 1.f) * touch_calib_size.width() * 0.5f, 0); + } else { + pre_transform.Scale(current_size.width() / touch_calib_size.width(), + current_size.width() / touch_calib_size.width()); + pre_transform.Translate( + 0, (calib_ar / current_ar - 1.f) * touch_calib_size.height() * 0.5f); + } + } else { + // Case of current resolution being different from the resolution when the + // touch calibration was performed. + pre_transform.Scale(current_size.width() / touch_calib_size.width(), + current_size.height() / touch_calib_size.height()); + } + // Solve for coefficients and compute transform matrix. + gfx::Transform stored_ctm; + if (!GetCalibratedTransform( + touch_display.GetTouchCalibrationData().point_pairs, pre_transform, + &stored_ctm)) { + // TODO(malaykeshav): This can be checked at the calibration step before + // storing the calibration associated data. This will allow us to explicitly + // inform the user with proper UX. + + // Clear stored calibration data. + GetDisplayManager()->ClearTouchCalibrationData(touch_display.id()); + + // Return uncalibrated transform. + return GetUncalibratedTransform(ctm, display, touch_display, touch_area, + touch_native_size); + } + + stored_ctm.ConcatTransform(ctm); + return stored_ctm; } TouchTransformerController::TouchTransformerController() {
diff --git a/ash/touch/touch_transformer_controller.h b/ash/touch/touch_transformer_controller.h index 640fcbb8..7abb8ce 100644 --- a/ash/touch/touch_transformer_controller.h +++ b/ash/touch/touch_transformer_controller.h
@@ -36,13 +36,7 @@ void OnDisplayConfigurationChanged() override; private: - FRIEND_TEST_ALL_PREFIXES(TouchTransformerControllerTest, - MirrorModeLetterboxing); - FRIEND_TEST_ALL_PREFIXES(TouchTransformerControllerTest, - MirrorModePillarboxing); - FRIEND_TEST_ALL_PREFIXES(TouchTransformerControllerTest, SoftwareMirrorMode); - FRIEND_TEST_ALL_PREFIXES(TouchTransformerControllerTest, ExtendedMode); - FRIEND_TEST_ALL_PREFIXES(TouchTransformerControllerTest, TouchRadiusScale); + friend class TouchTransformerControllerTest; // Returns a transform that will be used to change an event's location from // the touchscreen's coordinate system into |display|'s coordinate system.
diff --git a/ash/touch/touch_transformer_controller_unittest.cc b/ash/touch/touch_transformer_controller_unittest.cc index 09343bf..0b6b9a370 100644 --- a/ash/touch/touch_transformer_controller_unittest.cc +++ b/ash/touch/touch_transformer_controller_unittest.cc
@@ -6,6 +6,8 @@ #include "ash/shell.h" #include "ash/test/ash_test_base.h" +#include "base/rand_util.h" +#include "base/strings/string_number_conversions.h" #include "ui/aura/window_tree_host.h" #include "ui/events/devices/device_data_manager.h" @@ -13,6 +15,9 @@ namespace { +constexpr int kDisplayId1 = 1; +constexpr int kTouchId1 = 5; + display::ManagedDisplayInfo CreateDisplayInfo(int64_t id, unsigned int touch_device_id, const gfx::Rect& bounds) { @@ -35,9 +40,84 @@ std::string(), size, 0); } +std::string GetTouchPointString( + const display::TouchCalibrationData::CalibrationPointPairQuad& pts) { + std::string str = "Failed for point pairs: "; + for (std::size_t row = 0; row < pts.size(); row++) { + str += "{(" + base::IntToString(pts[row].first.x()) + "," + + base::IntToString(pts[row].first.y()) + "), (" + + base::IntToString(pts[row].second.x()) + "," + + base::IntToString(pts[row].second.y()) + ")} "; + } + return str; +} + +// Checks if the touch input has been calibrated properly. The input is said to +// be calibrated if any touch input is transformed to the correct corresponding +// display point within an error delta of |max_error_delta.width()| along the X +// axis and |max_error_delta.height()| along the Y axis; +void CheckPointsOfInterests(const int touch_id, + const gfx::Size& touch_size, + const gfx::Size& display_size, + const gfx::Size& max_error_delta, + const std::string& error_msg) { + ui::DeviceDataManager* device_manager = ui::DeviceDataManager::GetInstance(); + float x, y; + + // Origin of the touch device should correspond to origin of the display. + x = y = 0.0; + device_manager->ApplyTouchTransformer(touch_id, &x, &y); + EXPECT_NEAR(0, x, max_error_delta.width()) << error_msg; + EXPECT_NEAR(0, y, max_error_delta.height()) << error_msg; + + // Center of the touch device should correspond to the center of the display + // device. + x = touch_size.width() / 2; + y = touch_size.height() / 2; + device_manager->ApplyTouchTransformer(touch_id, &x, &y); + EXPECT_NEAR(display_size.width() / 2, x, max_error_delta.width()) + << error_msg; + EXPECT_NEAR(display_size.height() / 2, y, max_error_delta.height()) + << error_msg; + + // Bottom right corner of the touch device should correspond to rightmost + // corner of display device. + x = touch_size.width(); + y = touch_size.height(); + device_manager->ApplyTouchTransformer(touch_id, &x, &y); + EXPECT_NEAR(display_size.width(), x, max_error_delta.width()) << error_msg; + EXPECT_NEAR(display_size.height(), y, max_error_delta.height()) << error_msg; +} + } // namespace -typedef test::AshTestBase TouchTransformerControllerTest; +class TouchTransformerControllerTest : public test::AshTestBase { + public: + TouchTransformerControllerTest() {} + ~TouchTransformerControllerTest() override {} + + gfx::Transform GetTouchTransform( + const display::ManagedDisplayInfo& display, + const display::ManagedDisplayInfo& touch_display, + const ui::TouchscreenDevice& touchscreen, + const gfx::Size& framebuffer_size) const { + return Shell::GetInstance() + ->touch_transformer_controller() + ->GetTouchTransform(display, touch_display, touchscreen, + framebuffer_size); + } + + double GetTouchResolutionScale( + const display::ManagedDisplayInfo& touch_display, + const ui::TouchscreenDevice& touch_device) const { + return Shell::GetInstance() + ->touch_transformer_controller() + ->GetTouchResolutionScale(touch_display, touch_device); + } + + private: + DISALLOW_COPY_AND_ASSIGN(TouchTransformerControllerTest); +}; TEST_F(TouchTransformerControllerTest, MirrorModeLetterboxing) { // The internal display has native resolution of 2560x1700, and in @@ -67,21 +147,17 @@ ui::TouchscreenDevice external_touchscreen = CreateTouchscreenDevice(11, fb_size); - TouchTransformerController* tt_controller = - Shell::GetInstance()->touch_transformer_controller(); ui::DeviceDataManager* device_manager = ui::DeviceDataManager::GetInstance(); device_manager->UpdateTouchInfoForDisplay( internal_display_info.id(), internal_touchscreen.id, - tt_controller->GetTouchTransform(internal_display_info, - internal_display_info, - internal_touchscreen, fb_size)); + GetTouchTransform(internal_display_info, internal_display_info, + internal_touchscreen, fb_size)); device_manager->UpdateTouchInfoForDisplay( internal_display_info.id(), external_touchscreen.id, - tt_controller->GetTouchTransform(external_display_info, - external_display_info, - external_touchscreen, fb_size)); + GetTouchTransform(external_display_info, external_display_info, + external_touchscreen, fb_size)); EXPECT_EQ(1, device_manager->GetTargetDisplayForTouchDevice(10)); EXPECT_EQ(1, device_manager->GetTargetDisplayForTouchDevice(11)); @@ -138,21 +214,17 @@ ui::TouchscreenDevice external_touchscreen = CreateTouchscreenDevice(11, fb_size); - TouchTransformerController* tt_controller = - Shell::GetInstance()->touch_transformer_controller(); ui::DeviceDataManager* device_manager = ui::DeviceDataManager::GetInstance(); device_manager->UpdateTouchInfoForDisplay( internal_display_info.id(), internal_touchscreen.id, - tt_controller->GetTouchTransform(internal_display_info, - internal_display_info, - internal_touchscreen, fb_size)); + GetTouchTransform(internal_display_info, internal_display_info, + internal_touchscreen, fb_size)); device_manager->UpdateTouchInfoForDisplay( internal_display_info.id(), external_touchscreen.id, - tt_controller->GetTouchTransform(external_display_info, - external_display_info, - external_touchscreen, fb_size)); + GetTouchTransform(external_display_info, external_display_info, + external_touchscreen, fb_size)); EXPECT_EQ(1, device_manager->GetTargetDisplayForTouchDevice(10)); EXPECT_EQ(1, device_manager->GetTargetDisplayForTouchDevice(11)); @@ -214,19 +286,17 @@ ui::TouchscreenDevice display2_touchscreen = CreateTouchscreenDevice(11, fb_size); - TouchTransformerController* tt_controller = - Shell::GetInstance()->touch_transformer_controller(); ui::DeviceDataManager* device_manager = ui::DeviceDataManager::GetInstance(); device_manager->UpdateTouchInfoForDisplay( display1_info.id(), display1_touchscreen.id, - tt_controller->GetTouchTransform(display1_info, display1_info, - display1_touchscreen, fb_size)); + GetTouchTransform(display1_info, display1_info, display1_touchscreen, + fb_size)); device_manager->UpdateTouchInfoForDisplay( display1_info.id(), display2_touchscreen.id, - tt_controller->GetTouchTransform(display1_info, display2_info, - display2_touchscreen, fb_size)); + GetTouchTransform(display1_info, display2_info, display2_touchscreen, + fb_size)); EXPECT_EQ(1, device_manager->GetTargetDisplayForTouchDevice(10)); EXPECT_EQ(1, device_manager->GetTargetDisplayForTouchDevice(11)); @@ -285,19 +355,15 @@ ui::TouchscreenDevice touchscreen1 = CreateTouchscreenDevice(5, fb_size); ui::TouchscreenDevice touchscreen2 = CreateTouchscreenDevice(6, fb_size); - TouchTransformerController* tt_controller = - Shell::GetInstance()->touch_transformer_controller(); ui::DeviceDataManager* device_manager = ui::DeviceDataManager::GetInstance(); device_manager->UpdateTouchInfoForDisplay( display1.id(), touchscreen1.id, - tt_controller->GetTouchTransform(display1, display1, touchscreen1, - fb_size)); + GetTouchTransform(display1, display1, touchscreen1, fb_size)); device_manager->UpdateTouchInfoForDisplay( display2.id(), touchscreen2.id, - tt_controller->GetTouchTransform(display2, display2, touchscreen2, - fb_size)); + GetTouchTransform(display2, display2, touchscreen2, fb_size)); EXPECT_EQ(1, device_manager->GetTargetDisplayForTouchDevice(5)); EXPECT_EQ(2, device_manager->GetTargetDisplayForTouchDevice(6)); @@ -349,11 +415,414 @@ ui::TouchscreenDevice touch_device = CreateTouchscreenDevice(5, gfx::Size(1001, 1001)); - TouchTransformerController* tt_controller = - Shell::GetInstance()->touch_transformer_controller(); // Default touchscreen position range is 1001x1001; EXPECT_EQ(sqrt((2560.0 * 1600.0) / (1001.0 * 1001.0)), - tt_controller->GetTouchResolutionScale(display, touch_device)); + GetTouchResolutionScale(display, touch_device)); +} + +TEST_F(TouchTransformerControllerTest, OzoneTranslation) { +#if defined(USE_OZONE) + // The internal display has size 1920 x 1200. The external display has + // size 1920x1200. The total frame buffer is 1920x2450, + // where 2458 = 1200 + 50 (hidden gap) + 1200 + // and the second monitor is translated to Point (0, 1250) in the + // framebuffer. + const int kDisplayId2 = 2; + const int kTouchId2 = 6; + const gfx::Size kDisplaySize(1920, 1200); + const gfx::Size kTouchSize(1920, 1200); + const int kHiddenGap = 50; + + display::ManagedDisplayInfo display1 = CreateDisplayInfo( + kDisplayId1, kTouchId1, + gfx::Rect(0, 0, kDisplaySize.width(), kDisplaySize.height())); + display::ManagedDisplayInfo display2 = + CreateDisplayInfo(kDisplayId2, kTouchId2, + gfx::Rect(0, kDisplaySize.height() + kHiddenGap, + kDisplaySize.width(), kDisplaySize.height())); + + gfx::Size fb_size(1920, 2450); + + ui::TouchscreenDevice touchscreen1 = + CreateTouchscreenDevice(kTouchId1, kDisplaySize); + ui::TouchscreenDevice touchscreen2 = + CreateTouchscreenDevice(kTouchId2, kDisplaySize); + + ui::DeviceDataManager* device_manager = ui::DeviceDataManager::GetInstance(); + + // Mirror displays. Touch screen 2 is associated to display 1. + device_manager->UpdateTouchInfoForDisplay( + display1.id(), touchscreen1.id, + GetTouchTransform(display1, display1, touchscreen1, kTouchSize)); + + device_manager->UpdateTouchInfoForDisplay( + display1.id(), touchscreen2.id, + GetTouchTransform(display1, display2, touchscreen2, kTouchSize)); + + EXPECT_EQ(kDisplayId1, + device_manager->GetTargetDisplayForTouchDevice(kTouchId1)); + EXPECT_EQ(kDisplayId1, + device_manager->GetTargetDisplayForTouchDevice(kTouchId2)); + + float x, y; + + x = y = 0.0; + device_manager->ApplyTouchTransformer(kTouchId1, &x, &y); + EXPECT_NEAR(0, x, 0.5); + EXPECT_NEAR(0, y, 0.5); + + x = y = 0.0; + device_manager->ApplyTouchTransformer(kTouchId2, &x, &y); + EXPECT_NEAR(0, x, 0.5); + EXPECT_NEAR(0, y, 0.5); + + x = 1920.0; + y = 1200.0; + device_manager->ApplyTouchTransformer(kTouchId1, &x, &y); + EXPECT_NEAR(1920, x, 0.5); + EXPECT_NEAR(1200, y, 0.5); + + x = 1920.0; + y = 1200.0; + device_manager->ApplyTouchTransformer(kTouchId2, &x, &y); + EXPECT_NEAR(1920, x, 0.5); + EXPECT_NEAR(1200, y, 0.5); + + // Remove mirroring of displays. + device_manager->UpdateTouchInfoForDisplay( + display2.id(), touchscreen2.id, + GetTouchTransform(display2, display2, touchscreen2, kTouchSize)); + + x = 1920.0; + y = 1200.0; + device_manager->ApplyTouchTransformer(kTouchId1, &x, &y); + EXPECT_NEAR(1920, x, 0.5); + EXPECT_NEAR(1200, y, 0.5); + + x = 1920.0; + y = 1200.0; + device_manager->ApplyTouchTransformer(kTouchId2, &x, &y); + EXPECT_NEAR(1920, x, 0.5); + EXPECT_NEAR(1200 + kDisplaySize.height() + kHiddenGap, y, 0.5); +#endif // USE_OZONE +} + +TEST_F(TouchTransformerControllerTest, AccurateUserTouchCalibration) { + const gfx::Size kDisplaySize(1920, 1200); + const gfx::Size kTouchSize(1920, 1200); + + display::ManagedDisplayInfo display = CreateDisplayInfo( + kDisplayId1, kTouchId1, + gfx::Rect(0, 0, kDisplaySize.width(), kDisplaySize.height())); + + // Assuming the user provided accurate inputs during calibration. ie the user + // actually tapped (100,100) when asked to tap (100,100) with no human error. + display::TouchCalibrationData::CalibrationPointPairQuad user_input = {{ + std::make_pair(gfx::Point(100, 100), gfx::Point(100, 100)), + std::make_pair(gfx::Point(1820, 100), gfx::Point(1820, 100)), + std::make_pair(gfx::Point(100, 1100), gfx::Point(100, 1100)), + std::make_pair(gfx::Point(1820, 1100), gfx::Point(1820, 1100)), + }}; + display::TouchCalibrationData touch_data(user_input, kDisplaySize); + display.SetTouchCalibrationData(touch_data); + EXPECT_TRUE(display.has_touch_calibration_data()); + + const std::string msg = GetTouchPointString(user_input); + + gfx::Size fb_size(1920, 1200); + + ui::TouchscreenDevice touchscreen = + CreateTouchscreenDevice(kTouchId1, kTouchSize); + + ui::DeviceDataManager* device_manager = ui::DeviceDataManager::GetInstance(); + + device_manager->UpdateTouchInfoForDisplay( + display.id(), touchscreen.id, + GetTouchTransform(display, display, touchscreen, kTouchSize)); + + EXPECT_EQ(kDisplayId1, + device_manager->GetTargetDisplayForTouchDevice(kTouchId1)); + + CheckPointsOfInterests(kTouchId1, kTouchSize, kDisplaySize, gfx::Size(1, 1), + msg); +} + +TEST_F(TouchTransformerControllerTest, ErrorProneUserTouchCalibration) { + const gfx::Size kDisplaySize(1920, 1200); + const gfx::Size kTouchSize(1920, 1200); + // User touch inputs have a max error of 5%. + const float kError = 0.05; + // The maximum user error rate is |kError|%. Since the calibration is + // performed with a best fit algorithm, the error rate observed should be less + // than |kError|. + const gfx::Size kMaxErrorDelta = gfx::ScaleToCeiledSize(kTouchSize, kError); + + display::ManagedDisplayInfo display = CreateDisplayInfo( + kDisplayId1, kTouchId1, + gfx::Rect(0, 0, kDisplaySize.width(), kDisplaySize.height())); + + // Assuming the user provided inaccurate inputs during calibration. ie the + // user did not tap (100,100) when asked to tap (100,100) due to human error. + display::TouchCalibrationData::CalibrationPointPairQuad user_input = { + {std::make_pair(gfx::Point(100, 100), gfx::Point(130, 60)), + std::make_pair(gfx::Point(1820, 100), gfx::Point(1878, 130)), + std::make_pair(gfx::Point(100, 1100), gfx::Point(158, 1060)), + std::make_pair(gfx::Point(1820, 1100), gfx::Point(1790, 1140))}}; + display::TouchCalibrationData touch_data(user_input, kDisplaySize); + display.SetTouchCalibrationData(touch_data); + EXPECT_TRUE(display.has_touch_calibration_data()); + + const std::string msg = GetTouchPointString(user_input); + + ui::TouchscreenDevice touchscreen = + CreateTouchscreenDevice(kTouchId1, kTouchSize); + + ui::DeviceDataManager* device_manager = ui::DeviceDataManager::GetInstance(); + + device_manager->UpdateTouchInfoForDisplay( + display.id(), touchscreen.id, + GetTouchTransform(display, display, touchscreen, kTouchSize)); + + EXPECT_EQ(kDisplayId1, + device_manager->GetTargetDisplayForTouchDevice(kTouchId1)); + + CheckPointsOfInterests(kTouchId1, kTouchSize, kDisplaySize, kMaxErrorDelta, + msg); +} + +TEST_F(TouchTransformerControllerTest, ResolutionChangeUserTouchCalibration) { + const gfx::Size kDisplaySize(2560, 1600); + const gfx::Size kTouchSize(1920, 1200); + // User touch inputs have a max error of 5%. + const float kError = 0.05; + // The maximum user error rate is |kError|%. Since the calibration is + // performed with a best fit algorithm, the error rate observed should be less + // tha |kError|. + gfx::Size kMaxErrorDelta = gfx::ScaleToCeiledSize(kDisplaySize, kError); + + display::ManagedDisplayInfo display = CreateDisplayInfo( + kDisplayId1, kTouchId1, + gfx::Rect(0, 0, kDisplaySize.width(), kDisplaySize.height())); + + // The calibration was performed at a resolution different from the curent + // resolution of the display. + const gfx::Size CALIBRATION_SIZE(1920, 1200); + display::TouchCalibrationData::CalibrationPointPairQuad user_input = { + {std::make_pair(gfx::Point(100, 100), gfx::Point(50, 70)), + std::make_pair(gfx::Point(1820, 100), gfx::Point(1780, 70)), + std::make_pair(gfx::Point(100, 1100), gfx::Point(70, 1060)), + std::make_pair(gfx::Point(1820, 1100), gfx::Point(1770, 1140))}}; + + display::TouchCalibrationData touch_data(user_input, CALIBRATION_SIZE); + display.SetTouchCalibrationData(touch_data); + EXPECT_TRUE(display.has_touch_calibration_data()); + + const std::string msg = GetTouchPointString(user_input); + + ui::TouchscreenDevice touchscreen = + CreateTouchscreenDevice(kTouchId1, kTouchSize); + + ui::DeviceDataManager* device_manager = ui::DeviceDataManager::GetInstance(); + + device_manager->UpdateTouchInfoForDisplay( + display.id(), touchscreen.id, + GetTouchTransform(display, display, touchscreen, kTouchSize)); + + EXPECT_EQ(kDisplayId1, + device_manager->GetTargetDisplayForTouchDevice(kTouchId1)); + + CheckPointsOfInterests(kTouchId1, kTouchSize, kDisplaySize, kMaxErrorDelta, + msg); +} + +TEST_F(TouchTransformerControllerTest, DifferentBoundsUserTouchCalibration) { + // The display bounds is different from the touch device bounds in this test. + const gfx::Size kDisplaySize(1024, 600); + const gfx::Size kTouchSize(4096, 4096); + const float kAcceptableError = 0.04; + gfx::Size kMaxErrorDelta = + gfx::ScaleToCeiledSize(kDisplaySize, kAcceptableError); + + display::ManagedDisplayInfo display = CreateDisplayInfo( + kDisplayId1, kTouchId1, + gfx::Rect(0, 0, kDisplaySize.width(), kDisplaySize.height())); + + // Real world data. + display::TouchCalibrationData::CalibrationPointPairQuad user_input = { + {std::make_pair(gfx::Point(136, 136), gfx::Point(538, 931)), + std::make_pair(gfx::Point(873, 136), gfx::Point(3475, 922)), + std::make_pair(gfx::Point(136, 411), gfx::Point(611, 2800)), + std::make_pair(gfx::Point(873, 411), gfx::Point(3535, 2949))}}; + display::TouchCalibrationData touch_data(user_input, kDisplaySize); + display.SetTouchCalibrationData(touch_data); + EXPECT_TRUE(display.has_touch_calibration_data()); + + const std::string msg = GetTouchPointString(user_input); + + ui::TouchscreenDevice touchscreen = + CreateTouchscreenDevice(kTouchId1, kTouchSize); + + ui::DeviceDataManager* device_manager = ui::DeviceDataManager::GetInstance(); + + device_manager->UpdateTouchInfoForDisplay( + display.id(), touchscreen.id, + GetTouchTransform(display, display, touchscreen, kTouchSize)); + + EXPECT_EQ(kDisplayId1, + device_manager->GetTargetDisplayForTouchDevice(kTouchId1)); + + CheckPointsOfInterests(kTouchId1, kTouchSize, kDisplaySize, kMaxErrorDelta, + msg); +} + +TEST_F(TouchTransformerControllerTest, LetterboxingUserTouchCalibration) { + // The internal display has native resolution of 2560x1700, and in + // mirror mode it is configured as 1920x1200. This is in letterboxing + // mode. + const gfx::Size kNativeDisplaySize(2560, 1700); + const gfx::Size kDisplaySize(1920, 1200); + const gfx::Size kTouchSize(1920, 1200); + + display::ManagedDisplayInfo internal_display_info = CreateDisplayInfo( + kDisplayId1, kTouchId1, + gfx::Rect(0, 0, kDisplaySize.width(), kDisplaySize.height())); + internal_display_info.set_is_aspect_preserving_scaling(true); + + display::ManagedDisplayInfo::ManagedDisplayModeList internal_modes; + + internal_modes.push_back(make_scoped_refptr(new display::ManagedDisplayMode( + gfx::Size(kNativeDisplaySize.width(), kNativeDisplaySize.height()), 60, + false, true))); + internal_modes.push_back(make_scoped_refptr(new display::ManagedDisplayMode( + gfx::Size(kDisplaySize.width(), kDisplaySize.height()), 60, false, + false))); + internal_display_info.SetManagedDisplayModes(internal_modes); + + gfx::Size fb_size(kDisplaySize); + + // Create the touchscreens with the same size as the framebuffer so we can + // share the tests between Ozone & X11. + ui::TouchscreenDevice internal_touchscreen = + CreateTouchscreenDevice(kTouchId1, fb_size); + + ui::DeviceDataManager* device_manager = ui::DeviceDataManager::GetInstance(); + + // Assuming the user provided inaccurate inputs during calibration. ie the + // user did not tap (100,100) when asked to tap (100,100) due to human error. + // Since the display is of size 2560x1700 and the touch device is of size + // 1920x1200, the corresponding points have to be scaled. + display::TouchCalibrationData::CalibrationPointPairQuad user_input = {{ + std::make_pair(gfx::Point(100, 100), gfx::Point(75, 71)), + std::make_pair(gfx::Point(2460, 100), gfx::Point(1845, 71)), + std::make_pair(gfx::Point(100, 1600), gfx::Point(75, 1130)), + std::make_pair(gfx::Point(2460, 1600), gfx::Point(1845, 1130)), + }}; + // The calibration was performed at the native display resolution. + display::TouchCalibrationData touch_data(user_input, kNativeDisplaySize); + internal_display_info.SetTouchCalibrationData(touch_data); + EXPECT_TRUE(internal_display_info.has_touch_calibration_data()); + + device_manager->UpdateTouchInfoForDisplay( + internal_display_info.id(), internal_touchscreen.id, + GetTouchTransform(internal_display_info, internal_display_info, + internal_touchscreen, fb_size)); + + EXPECT_EQ(kDisplayId1, + device_manager->GetTargetDisplayForTouchDevice(kTouchId1)); + + float x, y; + // In letterboxing, there is (1-2560*(1200/1920)/1700)/2 = 2.95% of the + // height on both the top & bottom region of the screen is blank. + // When touch events coming at Y range [0, 1200), the mapping should be + // [0, ~35] ---> < 0 + // [~35, ~1165] ---> [0, 1200) + // [~1165, 1200] ---> >= 1200 + x = 100.0; + y = 35.0; + device_manager->ApplyTouchTransformer(kTouchId1, &x, &y); + EXPECT_NEAR(100, x, 0.5); + EXPECT_NEAR(0, y, 0.5); + + x = 100.0; + y = 1165.0; + device_manager->ApplyTouchTransformer(kTouchId1, &x, &y); + EXPECT_NEAR(100, x, 0.5); + EXPECT_NEAR(1200, y, 0.5); +} + +TEST_F(TouchTransformerControllerTest, PillarBoxingUserTouchCalibration) { + // The internal display has native resolution of 2560x1700, and in + // mirror mode it is configured as 1920x1200. This is in letterboxing + // mode. + const gfx::Size kNativeDisplaySize(2560, 1600); + const gfx::Size kDisplaySize(1920, 1400); + const gfx::Size kTouchSize(1920, 1400); + + display::ManagedDisplayInfo internal_display_info = CreateDisplayInfo( + kDisplayId1, kTouchId1, + gfx::Rect(0, 0, kDisplaySize.width(), kDisplaySize.height())); + internal_display_info.set_is_aspect_preserving_scaling(true); + + display::ManagedDisplayInfo::ManagedDisplayModeList internal_modes; + + internal_modes.push_back(make_scoped_refptr(new display::ManagedDisplayMode( + gfx::Size(kNativeDisplaySize.width(), kNativeDisplaySize.height()), 60, + false, true))); + internal_modes.push_back(make_scoped_refptr(new display::ManagedDisplayMode( + gfx::Size(kDisplaySize.width(), kDisplaySize.height()), 60, false, + false))); + internal_display_info.SetManagedDisplayModes(internal_modes); + + gfx::Size fb_size(kDisplaySize); + + // Create the touchscreens with the same size as the framebuffer so we can + // share the tests between Ozone & X11. + ui::TouchscreenDevice internal_touchscreen = + CreateTouchscreenDevice(kTouchId1, fb_size); + + ui::DeviceDataManager* device_manager = ui::DeviceDataManager::GetInstance(); + + // Assuming the user provided accurate inputs during calibration. ie the user + // actually tapped (100,100) when asked to tap (100,100) with no human error. + // Since the display is of size 2560x1600 and the touch device is of size + // 1920x1400, the corresponding points have to be scaled. + display::TouchCalibrationData::CalibrationPointPairQuad user_input = {{ + std::make_pair(gfx::Point(100, 100), gfx::Point(75, 88)), + std::make_pair(gfx::Point(2460, 100), gfx::Point(1845, 88)), + std::make_pair(gfx::Point(100, 1500), gfx::Point(75, 1313)), + std::make_pair(gfx::Point(2460, 1500), gfx::Point(1845, 1313)), + }}; + // The calibration was performed at the native display resolution. + display::TouchCalibrationData touch_data(user_input, kNativeDisplaySize); + internal_display_info.SetTouchCalibrationData(touch_data); + EXPECT_TRUE(internal_display_info.has_touch_calibration_data()); + + device_manager->UpdateTouchInfoForDisplay( + internal_display_info.id(), internal_touchscreen.id, + GetTouchTransform(internal_display_info, internal_display_info, + internal_touchscreen, fb_size)); + + EXPECT_EQ(kDisplayId1, + device_manager->GetTargetDisplayForTouchDevice(kTouchId1)); + + float x, y; + // In pillarboxing, there is (1-1600*(1920/1400)/2560)/2 = 7.14% of the + // width on both the left & region region of the screen is blank. + // When touch events coming at X range [0, 1920), the mapping should be + // [0, ~137] ---> < 0 + // [~137, ~1782] ---> [0, 1920) + // [~1782, 1920] ---> >= 1920 + x = 137.0; + y = 0.0; + device_manager->ApplyTouchTransformer(kTouchId1, &x, &y); + EXPECT_NEAR(0, x, 0.5); + EXPECT_NEAR(0, y, 0.5); + + x = 1782.0; + y = 0.0; + device_manager->ApplyTouchTransformer(kTouchId1, &x, &y); + EXPECT_NEAR(1920, x, 0.5); + EXPECT_NEAR(0, y, 0.5); } } // namespace ash
diff --git a/base/numerics/safe_conversions_impl.h b/base/numerics/safe_conversions_impl.h index 270d5916..75676e1 100644 --- a/base/numerics/safe_conversions_impl.h +++ b/base/numerics/safe_conversions_impl.h
@@ -40,8 +40,8 @@ template <typename T> constexpr bool HasSignBit(T x) { // Cast to unsigned since right shift on signed is undefined. - return !!(static_cast<typename std::make_unsigned<T>::type>(x) >> - PositionOfSignBit<T>::value); + return (static_cast<typename std::make_unsigned<T>::type>(x) >> + PositionOfSignBit<T>::value) != 0; } // This wrapper undoes the standard integer promotions. @@ -80,22 +80,34 @@ (static_cast<UnsignedT>(x) ^ -SignedT(is_negative)) + is_negative); } -// This performs a safe, non-branching absolute value via unsigned overflow. +// Wrapper for the sign mask used in the absolute value function. template <typename T> -constexpr T SafeUnsignedAbsImpl(T value, T sign_mask) { - static_assert(!std::is_signed<T>::value, "Types must be unsigned."); - return (value ^ sign_mask) - sign_mask; +constexpr T SignMask(T x) { + using SignedT = typename std::make_signed<T>::type; + // Right shift on a signed number is implementation defined, but it's often + // implemented as arithmetic shift. If the compiler uses an arithmetic shift, + // then use that to avoid the extra negation. + return static_cast<T>( + (static_cast<SignedT>(-1) >> PositionOfSignBit<T>::value) == + static_cast<SignedT>(-1) + ? (static_cast<SignedT>(x) >> PositionOfSignBit<T>::value) + : -static_cast<SignedT>(HasSignBit(x))); } +static_assert(SignMask(-2) == -1, + "Inconsistent handling of signed right shift."); +static_assert(SignMask(-3L) == -1L, + "Inconsistent handling of signed right shift."); +static_assert(SignMask(-4LL) == -1LL, + "Inconsistent handling of signed right shift."); +// This performs a safe, non-branching absolute value via unsigned overflow. template <typename T, typename std::enable_if<std::is_integral<T>::value && std::is_signed<T>::value>::type* = nullptr> constexpr typename std::make_unsigned<T>::type SafeUnsignedAbs(T value) { using UnsignedT = typename std::make_unsigned<T>::type; - return SafeUnsignedAbsImpl( - static_cast<UnsignedT>(value), - // The sign mask is all ones for negative and zero otherwise. - static_cast<UnsignedT>(-static_cast<T>(HasSignBit(value)))); + return static_cast<T>(static_cast<UnsignedT>(value ^ SignMask(value)) - + static_cast<UnsignedT>(SignMask(value))); } template <typename T,
diff --git a/base/win/object_watcher.cc b/base/win/object_watcher.cc index 9a7eea2..6abc399 100644 --- a/base/win/object_watcher.cc +++ b/base/win/object_watcher.cc
@@ -6,7 +6,7 @@ #include "base/bind.h" #include "base/logging.h" -#include "base/threading/thread_task_runner_handle.h" +#include "base/threading/sequenced_task_runner_handle.h" namespace base { namespace win { @@ -32,8 +32,8 @@ if (!wait_object_) return false; - // Make sure ObjectWatcher is used in a single-threaded fashion. - DCHECK(task_runner_->BelongsToCurrentThread()); + // Make sure ObjectWatcher is used in a sequenced fashion. + DCHECK(task_runner_->RunsTasksOnCurrentThread()); // Blocking call to cancel the wait. Any callbacks already in progress will // finish before we return from this call. @@ -70,14 +70,14 @@ bool execute_only_once) { DCHECK(delegate); DCHECK(!wait_object_) << "Already watching an object"; - DCHECK(ThreadTaskRunnerHandle::IsSet()); + DCHECK(SequencedTaskRunnerHandle::IsSet()); - task_runner_ = ThreadTaskRunnerHandle::Get(); + task_runner_ = SequencedTaskRunnerHandle::Get(); run_once_ = execute_only_once; // Since our job is to just notice when an object is signaled and report the - // result back to this thread, we can just run on a Windows wait thread. + // result back to this sequence, we can just run on a Windows wait thread. DWORD wait_flags = WT_EXECUTEINWAITTHREAD; if (run_once_) wait_flags |= WT_EXECUTEONLYONCE;
diff --git a/base/win/object_watcher.h b/base/win/object_watcher.h index a2821c1..67a1e26c 100644 --- a/base/win/object_watcher.h +++ b/base/win/object_watcher.h
@@ -12,7 +12,7 @@ #include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" -#include "base/single_thread_task_runner.h" +#include "base/sequenced_task_runner.h" namespace base { namespace win { @@ -20,7 +20,7 @@ // A class that provides a means to asynchronously wait for a Windows object to // become signaled. It is an abstraction around RegisterWaitForSingleObject // that provides a notification callback, OnObjectSignaled, that runs back on -// the origin thread (i.e., the thread that called StartWatching). +// the origin sequence (i.e., the sequence that called StartWatching). // // This class acts like a smart pointer such that when it goes out-of-scope, // UnregisterWaitEx is automatically called, and any in-flight notification is @@ -48,14 +48,13 @@ // still called after (but not necessarily immediately after) watch is started. // // NOTE: Except for the constructor, all public methods of this class must be -// called on the same thread. A ThreadTaskRunnerHandle must be set on that -// thread. +// called in sequence, in a scope where SequencedTaskRunnerHandle::IsSet(). class BASE_EXPORT ObjectWatcher { public: class BASE_EXPORT Delegate { public: virtual ~Delegate() {} - // Called from the thread that started the watch when a signaled object is + // Called from the sequence that started the watch when a signaled object is // detected. To continue watching the object, StartWatching must be called // again. virtual void OnObjectSignaled(HANDLE object) = 0; @@ -64,16 +63,16 @@ ObjectWatcher(); ~ObjectWatcher(); - // When the object is signaled, the given delegate is notified on the thread + // When the object is signaled, the given delegate is notified on the sequence // where StartWatchingOnce is called. The ObjectWatcher is not responsible for // deleting the delegate. // Returns whether watching was successfully initiated. bool StartWatchingOnce(HANDLE object, Delegate* delegate); - // Notifies the delegate, on the thread where this method is called, each time - // the object is set. By definition, the handle must be an auto-reset object. - // The caller must ensure that it (or any Windows system code) doesn't reset - // the event or else the delegate won't be called. + // Notifies the delegate, on the sequence where this method is called, each + // time the object is set. By definition, the handle must be an auto-reset + // object. The caller must ensure that it (or any Windows system code) doesn't + // reset the event or else the delegate won't be called. // Returns whether watching was successfully initiated. bool StartWatchingMultipleTimes(HANDLE object, Delegate* delegate); @@ -112,8 +111,8 @@ // The wait handle returned by RegisterWaitForSingleObject. HANDLE wait_object_ = nullptr; - // The task runner of the thread on which the watch was started. - scoped_refptr<SingleThreadTaskRunner> task_runner_; + // The task runner of the sequence on which the watch was started. + scoped_refptr<SequencedTaskRunner> task_runner_; bool run_once_ = true;
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn index b5231b153..76ac515 100644 --- a/build/config/compiler/BUILD.gn +++ b/build/config/compiler/BUILD.gn
@@ -1266,9 +1266,14 @@ ] } common_optimize_on_ldflags = [] - if (!is_component_build) { + + # /OPT:ICF is not desirable in Debug builds, since code-folding can result in + # misleading symbols in stack traces. It is also incompatible with + # incremental linking, which we enable for both Debug and component builds. + if (!is_debug && !is_component_build) { common_optimize_on_ldflags += [ "/OPT:ICF" ] # Redundant COMDAT folding. } + if (is_official_build) { common_optimize_on_ldflags += [ "/OPT:REF" ] # Remove unreferenced data. if (!use_lld) {
diff --git a/build/config/linux/gconf/BUILD.gn b/build/config/linux/gconf/BUILD.gn index 262e96a..60edf2d 100644 --- a/build/config/linux/gconf/BUILD.gn +++ b/build/config/linux/gconf/BUILD.gn
@@ -8,11 +8,6 @@ # CrOS doesn't install GTK, gconf or any gnome packages. assert(!is_chromeos && use_gconf) -# These packages should _only_ be expected when building for a target. -# If these extra checks are not run, gconf is required when building host -# tools for a CrOS build. -assert(current_toolchain == default_toolchain) - pkg_config("gconf") { packages = [ "gconf-2.0" ] defines = [ "USE_GCONF" ]
diff --git a/cc/output/filter_operation.cc b/cc/output/filter_operation.cc index 198057a2..e75b4170 100644 --- a/cc/output/filter_operation.cc +++ b/cc/output/filter_operation.cc
@@ -336,9 +336,9 @@ SkVector spread = MapStdDeviation(op.amount(), matrix); float spread_x = std::abs(spread.x()); float spread_y = std::abs(spread.y()); - gfx::Rect result = rect; + gfx::RectF result(rect); result.Inset(-spread_x, -spread_y, -spread_x, -spread_y); - return result; + return gfx::ToEnclosingRect(result); } case FilterOperation::DROP_SHADOW: { SkVector spread = MapStdDeviation(op.amount(), matrix);
diff --git a/cc/output/filter_operations_unittest.cc b/cc/output/filter_operations_unittest.cc index 8a32e66..fe86feb 100644 --- a/cc/output/filter_operations_unittest.cc +++ b/cc/output/filter_operations_unittest.cc
@@ -39,6 +39,14 @@ ops.MapRect(gfx::Rect(0, -10, 10, 10), SkMatrix::MakeScale(1, -1))); } +TEST(FilterOperationsTest, MapRectBlurOverflow) { + // Passes if float-cast-overflow does not occur in ubsan builds. + // The blur spread exceeds INT_MAX. + FilterOperations ops; + ops.Append(FilterOperation::CreateBlurFilter(2e9f)); + ops.MapRect(gfx::Rect(0, 0, 10, 10), SkMatrix::I()); +} + TEST(FilterOperationsTest, MapRectReverseBlur) { FilterOperations ops; ops.Append(FilterOperation::CreateBlurFilter(20));
diff --git a/chrome/VERSION b/chrome/VERSION index d9bd8fe3..082d2a6 100644 --- a/chrome/VERSION +++ b/chrome/VERSION
@@ -1,4 +1,4 @@ MAJOR=57 MINOR=0 -BUILD=2960 +BUILD=2961 PATCH=0
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/datareduction/DataReductionProxyUma.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/datareduction/DataReductionProxyUma.java index 903fde8..71ee52e 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/datareduction/DataReductionProxyUma.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/datareduction/DataReductionProxyUma.java
@@ -16,6 +16,13 @@ "DataReductionProxy.SnackbarPromo.DataSavings"; public static final String PREVIEWS_HISTOGRAM_NAME = "Previews.ContextMenuAction.LoFi"; + public static final String USER_VIEWED_ORIGINAL_SIZE_HISTOGRAM_NAME = + "DataReductionProxy.UserViewedOriginalSize"; + public static final String USER_VIEWED_SAVINGS_SIZE_HISTOGRAM_NAME = + "DataReductionProxy.UserViewedSavingsSize"; + public static final String USER_VIEWED_SAVINGS_PERCENT_HISTOGRAM_NAME = + "DataReductionProxy.UserViewedSavingsPercent"; + // Represent the possible user actions in the various data reduction promos and settings menu. // This must remain in sync with DataReductionProxy.UIAction in // tools/metrics/histograms/histograms.xml. @@ -66,6 +73,26 @@ } /** + * Record UMA on data savings displayed to the user. Called when the user views the data + * savings in the UI. + * @param compressedTotalBytes The total data used as shown to the user. + * @param originalTotalBytes Original total size as shown to the user. + * @param percentage Percentage savings as shown to the user. + */ + public static void dataReductionProxyUserViewedSavings( + long compressedTotalBytes, long originalTotalBytes, double percentage) { + // The byte counts are stored in KB. The largest histogram bucket is set to ~1 TB. + RecordHistogram.recordCustomCountHistogram(USER_VIEWED_ORIGINAL_SIZE_HISTOGRAM_NAME, + (int) (originalTotalBytes / 1024), 1, 1000 * 1000 * 1000, 100); + RecordHistogram.recordCustomCountHistogram(USER_VIEWED_SAVINGS_SIZE_HISTOGRAM_NAME, + (int) ((originalTotalBytes - compressedTotalBytes) / 1024), 1, 1000 * 1000 * 1000, + 100); + + RecordHistogram.recordPercentageHistogram( + USER_VIEWED_SAVINGS_PERCENT_HISTOGRAM_NAME, (int) percentage); + } + + /** * Record the Previews.ContextMenuAction.LoFi histogram. * @param action LoFi user action on the context menu */
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/datareduction/DataReductionStatsPreference.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/datareduction/DataReductionStatsPreference.java index c9e429a..ee08ac48 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/datareduction/DataReductionStatsPreference.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/datareduction/DataReductionStatsPreference.java
@@ -91,7 +91,7 @@ /** * Sets up a data usage chart and text views containing data reduction statistics. - * @oaram view The current view. + * @param view The current view. */ @Override protected void onBindView(View view) { @@ -160,6 +160,9 @@ mStartDatePhrase = formatDate(context, start); mEndDatePhrase = formatDate(context, end); + + DataReductionProxyUma.dataReductionProxyUserViewedSavings( + compressedTotalBytes, originalTotalBytes, 100.0 * percentage); } private static String formatDate(Context context, long millisSinceEpoch) {
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/OfflinePageSavePageLaterEvaluationTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/OfflinePageSavePageLaterEvaluationTest.java index c7f087e..81ae3da 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/OfflinePageSavePageLaterEvaluationTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/OfflinePageSavePageLaterEvaluationTest.java
@@ -15,6 +15,7 @@ import org.chromium.base.Log; import org.chromium.base.ThreadUtils; import org.chromium.base.test.util.Manual; +import org.chromium.base.test.util.TimeoutScale; import org.chromium.chrome.browser.ChromeActivity; import org.chromium.chrome.browser.offlinepages.evaluation.OfflinePageEvaluationBridge; import org.chromium.chrome.browser.offlinepages.evaluation.OfflinePageEvaluationBridge.OfflinePageEvaluationObserver; @@ -273,6 +274,7 @@ timeDelta.setStartTime(System.currentTimeMillis()); metadata.mTimeDelta = timeDelta; mRequestMetadata.put(request.getRequestId(), metadata); + log("SavePageRequest Added for " + metadata.mUrl + " with id " + metadata.mId); } public void savePageRequestCompleted(SavePageRequest request, int status) { RequestMetadata metadata = mRequestMetadata.get(request.getRequestId()); @@ -323,6 +325,7 @@ return; } int count = 0; + log("# of Urls in file: " + mUrls.size()); for (int i = 0; i < mUrls.size(); i++) { savePageLater(mUrls.get(i), NAMESPACE); count++; @@ -332,6 +335,7 @@ mCompletionLatch.await(); } } + log("All urls are processed, going to write results."); writeResults(); } @@ -495,8 +499,11 @@ /** * The test is the entry point for all kinds of testing of SavePageLater. * It is encouraged to use run_offline_page_evaluation_test.py to run this test. + * TimeoutScale is set to 4, in case we hit the hard limit for @Manual tests(10 hours) + * and gets killed. It expand the timeout to 10 * 4 hours. */ @Manual + @TimeoutScale(4) public void testFailureRate() throws IOException, InterruptedException { parseConfigFile(); setUpIOAndBridge(mUseTestScheduler);
diff --git a/chrome/app/settings_strings.grdp b/chrome/app/settings_strings.grdp index 69481a0..231dba5 100644 --- a/chrome/app/settings_strings.grdp +++ b/chrome/app/settings_strings.grdp
@@ -472,25 +472,34 @@ <!-- Bluetooth Page --> <if expr="chromeos"> - <message name="IDS_SETTINGS_BLUETOOTH" desc="Name of the settings page which displays bluetooth device settings."> + <message name="IDS_SETTINGS_BLUETOOTH" desc="Name of the settings page which displays Bluetooth device settings."> Bluetooth </message> - <message name="IDS_SETTINGS_BLUETOOTH_ADD_DEVICE" desc="Name of the settings page for adding bluetooth devices."> - Add a Device + <message name="IDS_SETTINGS_BLUETOOTH_PAIR" desc="Label for the settings button to pair a previously paired Bluetooth device."> + Pair </message> - <message name="IDS_SETTINGS_BLUETOOTH_PAIR_DEVICE" desc="Name of the settings page for pairing bluetooth devices."> - Pair Bluetooth Device + <message name="IDS_SETTINGS_BLUETOOTH_PAIR_DEVICE" desc="Label for the settings button to add and pair a new Bluetooth device."> + Pair device </message> - <message name="IDS_SETTINGS_BLUETOOTH_ENABLED" desc="Label for bluetooth section when enabled."> + <message name="IDS_SETTINGS_BLUETOOTH_PAIR_DEVICE_TITLE" desc="Title of the settings dialog for adding or pairing Bluetooth a device."> + Pair Bluetooth device + </message> + <message name="IDS_SETTINGS_BLUETOOTH_SCANNING" desc="Message displayed while scanning for Bluetooth devices."> + Scanning for devices... + </message> + <message name="IDS_SETTINGS_BLUETOOTH_NO_DEVICES" desc="Message displayed when no Bluetooth devices are found after a scan."> + No Bluetooth devices found. + </message> + <message name="IDS_SETTINGS_BLUETOOTH_ENABLED" desc="Label for Bluetooth section when enabled."> Bluetooth enabled </message> - <message name="IDS_SETTINGS_BLUETOOTH_DISABLED" desc="Label for bluetooth section when disabled."> + <message name="IDS_SETTINGS_BLUETOOTH_DISABLED" desc="Label for Bluetooth section when disabled."> Bluetooth disabled </message> - <message name="IDS_SETTINGS_BLUETOOTH_EXPAND_ACCESSIBILITY_LABEL" desc="Label for the button that toggles showing available bluetooth devices. Only visible by screen reader software."> - Show available bluetooth devices + <message name="IDS_SETTINGS_BLUETOOTH_EXPAND_ACCESSIBILITY_LABEL" desc="Label for the button that toggles showing available Bluetooth devices. Only visible by screen reader software."> + Show available Bluetooth devices </message> - <message name="IDS_SETTINGS_BLUETOOTH_REMOVE" desc="Label for removing (unpairing) a paired bluetooth device"> + <message name="IDS_SETTINGS_BLUETOOTH_REMOVE" desc="Label for removing (unpairing) a paired Bluetooth device"> Remove from list </message> <message name="IDS_SETTINGS_BLUETOOTH_REQUEST_PINCODE" desc="Bluetooth pairing message typically displayed when the external Bluetooth 2.0 and older device has no display or means of input.">
diff --git a/chrome/browser/android/offline_pages/evaluation/run_offline_page_evaluation_test.py b/chrome/browser/android/offline_pages/evaluation/run_offline_page_evaluation_test.py index 35b67528..d726351 100755 --- a/chrome/browser/android/offline_pages/evaluation/run_offline_page_evaluation_test.py +++ b/chrome/browser/android/offline_pages/evaluation/run_offline_page_evaluation_test.py
@@ -88,7 +88,7 @@ parser.set_defaults( output_dir=os.path.expanduser('~/offline_eval_output'), user_request=DEFAULT_USER_REQUEST, - user_test_scheduler=DEFAULT_USE_TEST_SCHEDULER, + use_test_scheduler=DEFAULT_USE_TEST_SCHEDULER, schedule_batch_size=DEFAULT_BATCH_SIZE, verbose=DEFAULT_VERBOSE) @@ -145,13 +145,24 @@ is_user_requested=options.user_request, use_test_scheduler=options.use_test_scheduler, schedule_batch_size=options.schedule_batch_size) - # Run test + # Run test with timeout-scale as 20.0 and strict mode off. + # This scale is only applied to timeouts which are defined as scalable ones + # in the test framework (like the timeout used to decide if Chrome doesn't + # start properly), on svelte devices we would hit the 'no tab selected' + # assertion since the starting time is longer than expected by the framework. + # So we're setting the scale to 20. It will not affect the annotation-based + # timeouts. + # Also turning off the strict mode so that we won't run into StrictMode + # violations when writing to files. test_runner_cmd = [ test_runner_path, '-f', - 'OfflinePageSavePageLaterEvaluationTest.testFailureRate' + 'OfflinePageSavePageLaterEvaluationTest.testFailureRate', + '--timeout-scale', '20.0', '--strict-mode', 'off', ] if options.verbose: test_runner_cmd += ['-v'] + if options.device_id != None: + test_runner_cmd += ['-d', options.device_id] subprocess.call(test_runner_cmd) print 'Fetching results from device...'
diff --git a/chrome/browser/browser_resources.grd b/chrome/browser/browser_resources.grd index 974c2ff0..5c382bf 100644 --- a/chrome/browser/browser_resources.grd +++ b/chrome/browser/browser_resources.grd
@@ -13,15 +13,8 @@ <structure name="IDR_APP_LIST_START_PAGE_HTML" file="resources\app_list\start_page.html" flattenhtml="true" type="chrome_html" /> <structure name="IDR_APP_LIST_START_PAGE_JS" file="resources\app_list\start_page.js" flattenhtml="true" type="chrome_html" /> </if> - <if expr="not is_android"> - <if expr="use_vulcanize"> - <then> - <structure name="IDR_MD_DOWNLOADS_VULCANIZED_HTML" file="resources\md_downloads\vulcanized.html" flattenhtml="true" allowexternalscript="true" type="chrome_html" /> - </then> - <else> - <structure name="IDR_MD_DOWNLOADS_DOWNLOADS_HTML" file="resources\md_downloads\downloads.html" flattenhtml="true" allowexternalscript="true" type="chrome_html" /> - </else> - </if> + <if expr="not is_android and not use_vulcanize"> + <structure name="IDR_MD_DOWNLOADS_DOWNLOADS_HTML" file="resources\md_downloads\downloads.html" flattenhtml="true" allowexternalscript="true" type="chrome_html" /> </if> <if expr="enable_extensions"> <structure name="IDR_EXTENSIONS_HTML" file="resources\extensions\extensions.html" flattenhtml="true" type="chrome_html" /> @@ -145,7 +138,8 @@ <include name="IDR_MD_DOWNLOADS_2X_NO_DOWNLOADS_PNG" file="resources\md_downloads\2x\no_downloads.png" type="BINDATA" /> <if expr="use_vulcanize"> <then> - <include name="IDR_MD_DOWNLOADS_CRISPER_JS" file="resources\md_downloads\crisper.js" flattenhtml="true" type="BINDATA" /> + <include name="IDR_MD_DOWNLOADS_CRISPER_JS" file="resources\md_downloads\crisper.js" flattenhtml="true" type="BINDATA" compress="gzip" /> + <include name="IDR_MD_DOWNLOADS_VULCANIZED_HTML" file="resources\md_downloads\vulcanized.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" compress="gzip" /> </then> <else> <include name="IDR_MD_DOWNLOADS_ACTION_SERVICE_HTML" file="resources\md_downloads\action_service.html" type="BINDATA" /> @@ -256,16 +250,16 @@ <!-- MD History. --> <include name="IDR_MD_HISTORY_CONSTANTS_HTML" file="resources\md_history\constants.html" type="BINDATA" /> <include name="IDR_MD_HISTORY_CONSTANTS_JS" file="resources\md_history\constants.js" type="BINDATA" /> - <include name="IDR_MD_HISTORY_HISTORY_HTML" file="resources\md_history\history.html" flattenhtml="true" type="BINDATA" /> + <include name="IDR_MD_HISTORY_HISTORY_HTML" file="resources\md_history\history.html" flattenhtml="true" type="BINDATA" compress="gzip" /> <include name="IDR_MD_HISTORY_HISTORY_JS" file="resources\md_history\history.js" type="BINDATA" /> <include name="IDR_MD_HISTORY_IMAGES_100_SIGN_IN_PROMO_JPG" file="resources\md_history\images\100\sign_in_promo.jpg" type="BINDATA" /> <include name="IDR_MD_HISTORY_IMAGES_200_SIGN_IN_PROMO_JPG" file="resources\md_history\images\200\sign_in_promo.jpg" type="BINDATA" /> <if expr="use_vulcanize"> <then> - <include name="IDR_MD_HISTORY_APP_VULCANIZED_HTML" file="resources\md_history\app.vulcanized.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" /> - <include name="IDR_MD_HISTORY_APP_CRISPER_JS" file="resources\md_history\app.crisper.js" flattenhtml="true" allowexternalscript="true" type="BINDATA" /> - <include name="IDR_MD_HISTORY_LAZY_LOAD_VULCANIZED_HTML" file="resources\md_history\lazy_load.vulcanized.html" allowexternalscript="true" type="BINDATA" /> - <include name="IDR_MD_HISTORY_LAZY_LOAD_CRISPER_JS" file="resources\md_history\lazy_load.crisper.js" allowexternalscript="true" type="BINDATA" /> + <include name="IDR_MD_HISTORY_APP_VULCANIZED_HTML" file="resources\md_history\app.vulcanized.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" compress="gzip" /> + <include name="IDR_MD_HISTORY_APP_CRISPER_JS" file="resources\md_history\app.crisper.js" flattenhtml="true" allowexternalscript="true" type="BINDATA" compress="gzip" /> + <include name="IDR_MD_HISTORY_LAZY_LOAD_VULCANIZED_HTML" file="resources\md_history\lazy_load.vulcanized.html" allowexternalscript="true" type="BINDATA" compress="gzip" /> + <include name="IDR_MD_HISTORY_LAZY_LOAD_CRISPER_JS" file="resources\md_history\lazy_load.crisper.js" allowexternalscript="true" type="BINDATA" compress="gzip" /> </then> <else> <include name="IDR_MD_HISTORY_APP_HTML" file="resources\md_history\app.html" type="BINDATA" />
diff --git a/chrome/browser/chromeos/display/touch_calibrator/touch_calibrator_controller_unittest.cc b/chrome/browser/chromeos/display/touch_calibrator/touch_calibrator_controller_unittest.cc index d5627a5..4ac1ea6 100644 --- a/chrome/browser/chromeos/display/touch_calibrator/touch_calibrator_controller_unittest.cc +++ b/chrome/browser/chromeos/display/touch_calibrator/touch_calibrator_controller_unittest.cc
@@ -55,7 +55,13 @@ TouchCalibratorView* target_calibrator_view = ctrl->touch_calibrator_views_[target_display.id()].get(); - EXPECT_EQ(target_calibrator_view->state(), TouchCalibratorView::UNKNOWN); + // End the background fade in animation. + target_calibrator_view->SkipCurrentAnimationForTest(); + + // TouchCalibratorView on the display being calibrated should be at the + // state where the first display point is visible. + EXPECT_EQ(target_calibrator_view->state(), + TouchCalibratorView::DISPLAY_POINT_1); } private:
diff --git a/chrome/browser/chromeos/display/touch_calibrator/touch_calibrator_view.cc b/chrome/browser/chromeos/display/touch_calibrator/touch_calibrator_view.cc index c0484a6..4d155a6 100644 --- a/chrome/browser/chromeos/display/touch_calibrator/touch_calibrator_view.cc +++ b/chrome/browser/chromeos/display/touch_calibrator/touch_calibrator_view.cc
@@ -8,7 +8,11 @@ #include "ash/public/cpp/shell_window_ids.h" #include "ash/shell.h" #include "ui/aura/window.h" +#include "ui/base/resource/resource_bundle.h" +#include "ui/gfx/animation/linear_animation.h" #include "ui/gfx/canvas.h" +#include "ui/strings/grit/ui_strings.h" +#include "ui/views/controls/label.h" #include "ui/views/widget/widget.h" namespace chromeos { @@ -17,6 +21,16 @@ constexpr char kWidgetName[] = "TouchCalibratorOverlay"; +constexpr int kAnimationFrameRate = 100; +constexpr int kFadeDurationInMs = 150; + +const SkColor kExitLabelColor = SkColorSetARGBInline(255, 96, 96, 96); +const SkColor kExitLabelShadowColor = SkColorSetARGBInline(255, 11, 11, 11); +constexpr int kExitLabelWidth = 300; +constexpr int kExitLabelHeight = 20; + +constexpr float kBackgroundFinalOpacity = 0.75f; + // Returns the initialization params for the widget that contains the touch // calibrator view. views::Widget::InitParams GetWidgetParams(aura::Window* root_window) { @@ -37,7 +51,9 @@ TouchCalibratorView::TouchCalibratorView(const display::Display& target_display, bool is_primary_view) - : display_(target_display), is_primary_view_(is_primary_view) { + : display_(target_display), + is_primary_view_(is_primary_view), + exit_label_(nullptr) { aura::Window* root = ash::Shell::GetInstance() ->window_tree_host_manager() ->GetRootWindowForDisplayId(display_.id()); @@ -47,29 +63,106 @@ widget_->SetBounds(display_.bounds()); widget_->Show(); set_owned_by_client(); + + animator_.reset( + new gfx::LinearAnimation(kFadeDurationInMs, kAnimationFrameRate, this)); + + InitViewContents(); + AdvanceToNextState(); } TouchCalibratorView::~TouchCalibratorView() { state_ = UNKNOWN; widget_->Hide(); + animator_->End(); +} + +void TouchCalibratorView::InitViewContents() { + // Initialize the background rect. + background_rect_ = + gfx::RectF(0, 0, display_.bounds().width(), display_.bounds().height()); + + ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); + // Initialize exit label that informs the user how to exit the touch + // calibration setup. + exit_label_ = new views::Label( + rb.GetLocalizedString(IDS_DISPLAY_TOUCH_CALIBRATION_EXIT_LABEL), + rb.GetFontListWithDelta(8, gfx::Font::FontStyle::NORMAL, + gfx::Font::Weight::NORMAL)); + exit_label_->SetBounds((display_.bounds().width() - kExitLabelWidth) / 2, + display_.bounds().height() * 3.f / 4, kExitLabelWidth, + kExitLabelHeight); + exit_label_->SetEnabledColor(kExitLabelColor); + exit_label_->SetHorizontalAlignment(gfx::ALIGN_CENTER); + exit_label_->SetShadows(gfx::ShadowValues( + 1, gfx::ShadowValue(gfx::Vector2d(1, 1), 1, kExitLabelShadowColor))); + exit_label_->SetSubpixelRenderingEnabled(false); + exit_label_->SetVisible(false); + + AddChildView(exit_label_); } void TouchCalibratorView::OnPaint(gfx::Canvas* canvas) { OnPaintBackground(canvas); } -void TouchCalibratorView::OnPaintBackground(gfx::Canvas* canvas) {} +void TouchCalibratorView::OnPaintBackground(gfx::Canvas* canvas) { + float opacity; + + // If current state is a fade in or fade out state then update opacity + // based on how far the animation has progressed. + if (animator_ && (state_ == TouchCalibratorView::BACKGROUND_FADING_OUT || + state_ == TouchCalibratorView::BACKGROUND_FADING_IN)) { + opacity = static_cast<float>(animator_->CurrentValueBetween( + start_opacity_value_, end_opacity_value_)); + } else { + opacity = state_ == BACKGROUND_FADING_OUT ? 0.f : kBackgroundFinalOpacity; + } + + paint_.setColor(SkColorSetA(SK_ColorBLACK, + std::numeric_limits<uint8_t>::max() * opacity)); + canvas->DrawRect(background_rect_, paint_); +} void TouchCalibratorView::AnimationProgressed(const gfx::Animation* animation) { + SchedulePaint(); } void TouchCalibratorView::AnimationCanceled(const gfx::Animation* animation) { AnimationEnded(animation); } -void TouchCalibratorView::AnimationEnded(const gfx::Animation* animation) {} +void TouchCalibratorView::AnimationEnded(const gfx::Animation* animation) { + switch (state_) { + case BACKGROUND_FADING_IN: + exit_label_->SetVisible(true); + state_ = is_primary_view_ ? DISPLAY_POINT_1 : CALIBRATION_COMPLETE; + break; + default: + break; + } +} -void TouchCalibratorView::AdvanceToNextState() {} +void TouchCalibratorView::AdvanceToNextState() { + // Stop any previous animations and skip them to the end. + animator_->End(); + + switch (state_) { + case UNKNOWN: + case BACKGROUND_FADING_IN: + state_ = BACKGROUND_FADING_IN; + start_opacity_value_ = 0.f; + end_opacity_value_ = kBackgroundFinalOpacity; + + paint_.setStyle(SkPaint::kFill_Style); + + animator_->SetDuration(kFadeDurationInMs); + break; + default: + break; + } + animator_->Start(); +} bool TouchCalibratorView::GetDisplayPointLocation(gfx::Point* location) { if (!is_primary_view_) @@ -79,4 +172,9 @@ void TouchCalibratorView::SkipToFinalState() {} +void TouchCalibratorView::SkipCurrentAnimationForTest() { + if (animator_->is_animating()) + animator_->End(); +} + } // namespace chromeos
diff --git a/chrome/browser/chromeos/display/touch_calibrator/touch_calibrator_view.h b/chrome/browser/chromeos/display/touch_calibrator/touch_calibrator_view.h index aeaf20f..dec47afe 100644 --- a/chrome/browser/chromeos/display/touch_calibrator/touch_calibrator_view.h +++ b/chrome/browser/chromeos/display/touch_calibrator/touch_calibrator_view.h
@@ -11,9 +11,15 @@ #include "ui/views/view.h" namespace views { +class Label; class Widget; } +namespace gfx { +class Animation; +class LinearAnimation; +} + namespace chromeos { // An overlay view used during touch calibration. This view is responsible for @@ -72,10 +78,15 @@ // the touch calibration UX. bool GetDisplayPointLocation(gfx::Point* location); + // Skips/cancels any ongoing animation to its end. + void SkipCurrentAnimationForTest(); + // Returns the current state of the view. State state() { return state_; } private: + void InitViewContents(); + // The target display on which this view is rendered on. const display::Display display_; @@ -84,6 +95,23 @@ std::unique_ptr<views::Widget> widget_; + SkPaint paint_; + + // Defines the bounds for the background animation. + gfx::RectF background_rect_; + + // Text label indicating how to exit the touch calibration. + views::Label* exit_label_; + + // Start and end opacity values used during the fade animation. This is set + // before the animation begins. + float start_opacity_value_; + float end_opacity_value_; + + // Linear animation used for various aniations including fade-in, fade out, + // and view translation. + std::unique_ptr<gfx::LinearAnimation> animator_; + State state_ = UNKNOWN; DISALLOW_COPY_AND_ASSIGN(TouchCalibratorView);
diff --git a/chrome/browser/plugins/flash_download_interception.cc b/chrome/browser/plugins/flash_download_interception.cc index c318142..61a7106 100644 --- a/chrome/browser/plugins/flash_download_interception.cc +++ b/chrome/browser/plugins/flash_download_interception.cc
@@ -116,10 +116,6 @@ FlashDownloadInterception::MaybeCreateThrottleFor(NavigationHandle* handle) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - // Never intercept Flash Download navigations in a new window. - if (handle->GetWebContents()->HasOpener()) - return nullptr; - // Browser initiated navigations like the Back button or the context menu // should never be intercepted. if (!handle->IsRendererInitiated())
diff --git a/chrome/browser/plugins/flash_permission_browsertest.cc b/chrome/browser/plugins/flash_permission_browsertest.cc index c1db46d..57aea02 100644 --- a/chrome/browser/plugins/flash_permission_browsertest.cc +++ b/chrome/browser/plugins/flash_permission_browsertest.cc
@@ -4,6 +4,7 @@ #include "base/base_switches.h" #include "base/command_line.h" +#include "base/memory/ptr_util.h" #include "base/path_service.h" #include "chrome/browser/permissions/permissions_browsertest.h" #include "chrome/browser/ui/website_settings/mock_permission_prompt_factory.h" @@ -107,6 +108,37 @@ CommonSucceedsIfAllowed(); } +IN_PROC_BROWSER_TEST_F(FlashPermissionBrowserTest, SucceedsInPopupWindow) { + // Spawn the same page in a popup window and wait for it to finish loading. + content::WebContents* original_contents = GetWebContents(); + ASSERT_TRUE(RunScriptReturnBool("spawnPopupAndAwaitLoad();")); + + // Assert that the popup's WebContents is now the active one. + ASSERT_NE(original_contents, GetWebContents()); + + PermissionRequestManager* manager = PermissionRequestManager::FromWebContents( + GetWebContents()); + auto popup_prompt_factory = + base::MakeUnique<MockPermissionPromptFactory>(manager); + manager->DisplayPendingRequests(); + + EXPECT_EQ(0, popup_prompt_factory->total_request_count()); + popup_prompt_factory->set_response_type(PermissionRequestManager::ACCEPT_ALL); + // FlashPermissionContext::UpdateTabContext will reload the page, we'll have + // to wait until it is ready. + PageReloadWaiter reload_waiter(GetWebContents()); + EXPECT_TRUE(RunScriptReturnBool("triggerPrompt();")); + EXPECT_TRUE(reload_waiter.Wait()); + + EXPECT_TRUE(FeatureUsageSucceeds()); + EXPECT_EQ(1, popup_prompt_factory->total_request_count()); + + // Shut down the popup window tab, as the normal test teardown assumes there + // is only one test tab. + popup_prompt_factory.reset(); + GetWebContents()->Close(); +} + IN_PROC_BROWSER_TEST_F(FlashPermissionBrowserTest, TriggerPromptViaNewWindow) { EXPECT_EQ(0, prompt_factory()->total_request_count()); prompt_factory()->set_response_type(PermissionRequestManager::ACCEPT_ALL);
diff --git a/chrome/browser/resources/.clang-format b/chrome/browser/resources/.clang-format index 4d25b73..8fd4c4a 100644 --- a/chrome/browser/resources/.clang-format +++ b/chrome/browser/resources/.clang-format
@@ -6,7 +6,7 @@ AllowShortBlocksOnASingleLine: false AllowShortCaseLabelsOnASingleLine: false -AllowShortFunctionsOnASingleLine: false +AllowShortFunctionsOnASingleLine: Empty AllowShortIfStatementsOnASingleLine: false AllowShortLoopsOnASingleLine: false SpacesInContainerLiterals: false
diff --git a/chrome/browser/resources/settings/bluetooth_page/bluetooth_device_dialog.html b/chrome/browser/resources/settings/bluetooth_page/bluetooth_device_dialog.html index 3460a36..80a33f7e 100644 --- a/chrome/browser/resources/settings/bluetooth_page/bluetooth_device_dialog.html +++ b/chrome/browser/resources/settings/bluetooth_page/bluetooth_device_dialog.html
@@ -75,7 +75,7 @@ } </style> <dialog is="cr-dialog" id="dialog" on-cancel="onDialogCanceled_"> - <div class="title">[[getTitle_(dialogId)]]</div> + <div class="title">$i18n{bluetoothPairDevicePageTitle}</div> <div class="body"> <div class="contents layout vertical center center-justified"> <!-- Note: dialog + dom-if + iron-list makes sizing complicated so use @@ -157,7 +157,7 @@ on-tap="onRejectTap_">$i18n{bluetoothReject}</paper-button> <paper-button hidden$="[[!showConnect_(pairingEvent)]]" disabled="[[!enableConnect_(pairingEvent, pinOrPass)]]" - on-tap="onConnectTap_">$i18n{bluetoothConnect}</paper-button> + on-tap="onConnectTap_">$i18n{bluetoothPair}</paper-button> <paper-button hidden$="[[!showDismiss_(pairingDevice, pairingEvent)]]" on-tap="close">$i18n{bluetoothDismiss}</paper-button> <paper-button hidden$="[[showDismiss_(pairingDevice, pairingEvent)]]"
diff --git a/chrome/browser/resources/settings/bluetooth_page/bluetooth_device_dialog.js b/chrome/browser/resources/settings/bluetooth_page/bluetooth_device_dialog.js index 5c1a8bf9..e84f96c4 100644 --- a/chrome/browser/resources/settings/bluetooth_page/bluetooth_device_dialog.js +++ b/chrome/browser/resources/settings/bluetooth_page/bluetooth_device_dialog.js
@@ -392,17 +392,6 @@ }, /** - * @param {string} dialogId - * @return {string} The title of for that |dialogId|. - */ - getTitle_: function(dialogId) { - if (dialogId == 'addDevice') - return this.i18n('bluetoothAddDevicePageTitle'); - // Use the 'pair' title for the pairing dialog and error dialog. - return this.i18n('bluetoothPairDevicePageTitle'); - }, - - /** * @param {string} desiredDialogType * @return {boolean} * @private
diff --git a/chrome/browser/resources/settings/bluetooth_page/bluetooth_device_list_item.js b/chrome/browser/resources/settings/bluetooth_page/bluetooth_device_list_item.js index c72b2e4..876f163 100644 --- a/chrome/browser/resources/settings/bluetooth_page/bluetooth_device_list_item.js +++ b/chrome/browser/resources/settings/bluetooth_page/bluetooth_device_list_item.js
@@ -57,7 +57,7 @@ * @private */ getConnectActionText_: function(connected) { - return this.i18n(connected ? 'bluetoothDisconnect' : 'bluetoothConnect'); + return this.i18n(connected ? 'bluetoothDisconnect' : 'bluetoothPair'); }, /**
diff --git a/chrome/browser/resources/settings/bluetooth_page/bluetooth_page.html b/chrome/browser/resources/settings/bluetooth_page/bluetooth_page.html index b978357..20fd975 100644 --- a/chrome/browser/resources/settings/bluetooth_page/bluetooth_page.html +++ b/chrome/browser/resources/settings/bluetooth_page/bluetooth_page.html
@@ -83,7 +83,7 @@ </div> <div class="settings-box" hidden$="[[!bluetoothEnabled_]]"> <paper-button class="primary-button" on-tap="onAddDeviceTap_"> - $i18n{bluetoothAddDevice} + $i18n{bluetoothPairDevice} </paper-button> </div> </iron-collapse>
diff --git a/chrome/browser/resources/settings/site_settings/category_setting_exceptions.html b/chrome/browser/resources/settings/site_settings/category_setting_exceptions.html index c7aad34..c3f4b1f 100644 --- a/chrome/browser/resources/settings/site_settings/category_setting_exceptions.html +++ b/chrome/browser/resources/settings/site_settings/category_setting_exceptions.html
@@ -17,19 +17,16 @@ <site-list category="[[category]]" category-subtype="[[PermissionValues.BLOCK]]" - category-enabled="[[categoryEnabled]]" category-header="$i18n{siteSettingsBlock}"> </site-list> <site-list category="[[category]]" category-subtype="[[PermissionValues.SESSION_ONLY]]" - category-enabled="[[categoryEnabled]]" category-header="$i18n{siteSettingsSessionOnly}"> </site-list> <site-list category="[[category]]" category-subtype="[[PermissionValues.ALLOW]]" - category-enabled="[[categoryEnabled]]" category-header="$i18n{siteSettingsAllow}"> </site-list> </template>
diff --git a/chrome/browser/resources/settings/site_settings/protocol_handlers.html b/chrome/browser/resources/settings/site_settings/protocol_handlers.html index 265b2f1..ab34821 100644 --- a/chrome/browser/resources/settings/site_settings/protocol_handlers.html +++ b/chrome/browser/resources/settings/site_settings/protocol_handlers.html
@@ -3,7 +3,6 @@ <link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button.html"> <link rel="import" href="chrome://resources/polymer/v1_0/paper-toggle-button/paper-toggle-button.html"> <link rel="import" href="chrome://resources/cr_elements/cr_action_menu/cr_action_menu.html"> - <link rel="import" href="chrome://resources/html/web_ui_listener_behavior.html"> <link rel="import" href="/i18n_setup.html"> <link rel="import" href="/settings_shared_css.html">
diff --git a/chrome/browser/resources/settings/site_settings/protocol_handlers.js b/chrome/browser/resources/settings/site_settings/protocol_handlers.js index b175e83..43572b8 100644 --- a/chrome/browser/resources/settings/site_settings/protocol_handlers.js +++ b/chrome/browser/resources/settings/site_settings/protocol_handlers.js
@@ -64,17 +64,16 @@ this.setProtocolHandlers_.bind(this)); this.addWebUIListener('setIgnoredProtocolHandlers', this.setIgnoredProtocolHandlers_.bind(this)); - this.browserProxy.initializeProtocolHandlerList(); + this.browserProxy.observeProtocolHandlers(); }, /** * Obtains the description for the main toggle. - * @param {boolean} categoryEnabled Whether the main toggle is enabled. * @return {string} The description to use. * @private */ - computeHandlersDescription_: function(categoryEnabled) { - var setting = categoryEnabled ? + computeHandlersDescription_: function() { + var setting = this.categoryEnabled ? settings.PermissionValues.ALLOW : settings.PermissionValues.BLOCK; return this.computeCategoryDesc( settings.ContentSettingsTypes.PROTOCOL_HANDLERS, setting, true);
diff --git a/chrome/browser/resources/settings/site_settings/site_list.js b/chrome/browser/resources/settings/site_settings/site_list.js index bffe5019..8501b13 100644 --- a/chrome/browser/resources/settings/site_settings/site_list.js +++ b/chrome/browser/resources/settings/site_settings/site_list.js
@@ -68,16 +68,6 @@ }, /** - * Represents the state of the main toggle shown for the category. For - * example, the Location category can be set to Block/Ask so false, in that - * case, represents Block and true represents Ask. - */ - categoryEnabled: { - type: Boolean, - value: true, - }, - - /** * Whether to show the Allow action in the action menu. */ showAllowAction_: Boolean,
diff --git a/chrome/browser/resources/settings/site_settings/site_settings_prefs_browser_proxy.js b/chrome/browser/resources/settings/site_settings/site_settings_prefs_browser_proxy.js index b510502..05035f40 100644 --- a/chrome/browser/resources/settings/site_settings/site_settings_prefs_browser_proxy.js +++ b/chrome/browser/resources/settings/site_settings/site_settings_prefs_browser_proxy.js
@@ -208,10 +208,23 @@ removeAllCookies: function() {}, /** - * Initializes the protocol handler list. List is returned through JS calls - * to setHandlersEnabled, setProtocolHandlers & setIgnoredProtocolHandlers. + * observes _all_ of the the protocol handler state, which includes a list + * that is returned through JS calls to 'setProtocolHandlers' along with + * other state sent with the messages 'setIgnoredProtocolHandler' and + * 'setHandlersEnabled'. */ - initializeProtocolHandlerList: function() {}, + observeProtocolHandlers: function() {}, + + /** + * Observes one aspect of the protocol handler so that updates to the + * enabled/disabled state are sent. A 'setHandlersEnabled' will be sent + * from C++ immediately after receiving this observe request and updates + * may follow via additional 'setHandlersEnabled' messages. + * + * If |observeProtocolHandlers| is called, there's no need to call this + * observe as well. + */ + observeProtocolHandlersEnabledState: function() {}, /** * Enables or disables the ability for sites to ask to become the default @@ -354,8 +367,14 @@ return cr.sendWithPromise('removeAllCookies'); }, - initializeProtocolHandlerList: function() { - chrome.send('initializeProtocolHandlerList'); + /** @override */ + observeProtocolHandlers: function() { + chrome.send('observeProtocolHandlers'); + }, + + /** @override */ + observeProtocolHandlersEnabledState: function() { + chrome.send('observeProtocolHandlersEnabledState'); }, /** @override */
diff --git a/chrome/browser/ui/sync/one_click_signin_sync_starter.cc b/chrome/browser/ui/sync/one_click_signin_sync_starter.cc index a800de2..2a4f603 100644 --- a/chrome/browser/ui/sync/one_click_signin_sync_starter.cc +++ b/chrome/browser/ui/sync/one_click_signin_sync_starter.cc
@@ -142,7 +142,6 @@ // will not be able to complete successfully. syncer::SyncPrefs sync_prefs(profile_->GetPrefs()); sync_prefs.SetSyncRequested(true); - skip_sync_confirm_ = false; } void OneClickSigninSyncStarter::ConfirmSignin(const std::string& oauth_token) { @@ -312,7 +311,6 @@ FinishProfileSyncServiceSetup(); Initialize(new_profile, nullptr); DCHECK_EQ(profile_, new_profile); - skip_sync_confirm_ = true; // We've transferred our credentials to the new profile - notify that // the signin for the original profile was cancelled (must do this after @@ -478,14 +476,6 @@ // Regardless of whether the account was successfully added or not, // continue with sync starting. - // TODO(zmin): Remove this hack once the https://crbug.com/657924 fixed. - // Skip the Sync confirmation dialog if user choose to create a new profile - // for the corp signin. This is because the dialog doesn't work properly - // after the corp signin. - if (skip_sync_confirm_) { - OnSyncConfirmationUIClosed(LoginUIService::ABORT_SIGNIN); - return; - } if (switches::UsePasswordSeparatedSigninFlow()) { // Under the new signin flow, the sync confirmation dialog should always be
diff --git a/chrome/browser/ui/sync/one_click_signin_sync_starter.h b/chrome/browser/ui/sync/one_click_signin_sync_starter.h index 44f76027..956efa19 100644 --- a/chrome/browser/ui/sync/one_click_signin_sync_starter.h +++ b/chrome/browser/ui/sync/one_click_signin_sync_starter.h
@@ -248,10 +248,6 @@ // Prevents Sync from running until configuration is complete. std::unique_ptr<syncer::SyncSetupInProgressHandle> sync_blocker_; - // Temporary flag to disable new sync confirm page if user choose to create a - // new profile after the corp account signin. - bool skip_sync_confirm_; - base::WeakPtrFactory<OneClickSigninSyncStarter> weak_pointer_factory_; DISALLOW_COPY_AND_ASSIGN(OneClickSigninSyncStarter);
diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_views_browsertest.cc b/chrome/browser/ui/views/omnibox/omnibox_view_views_browsertest.cc index 0104caf..ce444efd 100644 --- a/chrome/browser/ui/views/omnibox/omnibox_view_views_browsertest.cc +++ b/chrome/browser/ui/views/omnibox/omnibox_view_views_browsertest.cc
@@ -192,7 +192,7 @@ } #if defined(OS_LINUX) && !defined(OS_CHROMEOS) -IN_PROC_BROWSER_TEST_F(OmniboxViewViewsTest, SelectionClipboard) { +IN_PROC_BROWSER_TEST_F(OmniboxViewViewsTest, DISABLED_SelectionClipboard) { OmniboxView* omnibox_view = NULL; ASSERT_NO_FATAL_FAILURE(GetOmniboxViewForBrowser(browser(), &omnibox_view)); omnibox_view->SetUserText(base::ASCIIToUTF16("http://www.google.com/"));
diff --git a/chrome/browser/ui/webui/bluetooth_internals/bluetooth_internals_ui.cc b/chrome/browser/ui/webui/bluetooth_internals/bluetooth_internals_ui.cc index ba5f948..81ae761 100644 --- a/chrome/browser/ui/webui/bluetooth_internals/bluetooth_internals_ui.cc +++ b/chrome/browser/ui/webui/bluetooth_internals/bluetooth_internals_ui.cc
@@ -44,7 +44,7 @@ html_source->AddResourcePath("device/bluetooth/public/interfaces/uuid.mojom", IDR_BLUETOOTH_UUID_MOJO_JS); html_source->SetDefaultResource(IDR_BLUETOOTH_INTERNALS_HTML); - html_source->DisableI18nAndUseGzipForAllPaths(); + html_source->UseGzip(std::unordered_set<std::string>()); Profile* profile = Profile::FromWebUI(web_ui); content::WebUIDataSource::Add(profile, html_source);
diff --git a/chrome/browser/ui/webui/domain_reliability_internals_ui.cc b/chrome/browser/ui/webui/domain_reliability_internals_ui.cc index a8535ae..7a2aebd4 100644 --- a/chrome/browser/ui/webui/domain_reliability_internals_ui.cc +++ b/chrome/browser/ui/webui/domain_reliability_internals_ui.cc
@@ -26,7 +26,7 @@ html_source->AddResourcePath("domain_reliability_internals.js", IDR_DOMAIN_RELIABILITY_INTERNALS_JS); html_source->SetDefaultResource(IDR_DOMAIN_RELIABILITY_INTERNALS_HTML); - html_source->DisableI18nAndUseGzipForAllPaths(); + html_source->UseGzip(std::unordered_set<std::string>()); web_ui->RegisterMessageCallback("updateData", base::Bind(&DomainReliabilityInternalsUI::UpdateData,
diff --git a/chrome/browser/ui/webui/engagement/site_engagement_ui.cc b/chrome/browser/ui/webui/engagement/site_engagement_ui.cc index b66a4588..81d8ed9 100644 --- a/chrome/browser/ui/webui/engagement/site_engagement_ui.cc +++ b/chrome/browser/ui/webui/engagement/site_engagement_ui.cc
@@ -87,7 +87,7 @@ IDR_SITE_ENGAGEMENT_MOJO_JS); source->AddResourcePath("url/mojo/url.mojom", IDR_URL_MOJO_JS); source->SetDefaultResource(IDR_SITE_ENGAGEMENT_HTML); - source->DisableI18nAndUseGzipForAllPaths(); + source->UseGzip(std::unordered_set<std::string>()); content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), source.release()); }
diff --git a/chrome/browser/ui/webui/gcm_internals_ui.cc b/chrome/browser/ui/webui/gcm_internals_ui.cc index 038faaf..e61ea1c 100644 --- a/chrome/browser/ui/webui/gcm_internals_ui.cc +++ b/chrome/browser/ui/webui/gcm_internals_ui.cc
@@ -168,7 +168,7 @@ html_source->AddResourcePath(gcm_driver::kGcmInternalsJS, IDR_GCM_DRIVER_GCM_INTERNALS_JS); html_source->SetDefaultResource(IDR_GCM_DRIVER_GCM_INTERNALS_HTML); - html_source->DisableI18nAndUseGzipForAllPaths(); + html_source->UseGzip(std::unordered_set<std::string>()); Profile* profile = Profile::FromWebUI(web_ui); content::WebUIDataSource::Add(profile, html_source);
diff --git a/chrome/browser/ui/webui/history_ui.cc b/chrome/browser/ui/webui/history_ui.cc index 6a97749..ea2ea05 100644 --- a/chrome/browser/ui/webui/history_ui.cc +++ b/chrome/browser/ui/webui/history_ui.cc
@@ -169,7 +169,7 @@ source->AddResourcePath(kOtherDevicesJsFile, IDR_OTHER_DEVICES_JS); source->SetDefaultResource(IDR_HISTORY_HTML); source->DisableDenyXFrameOptions(); - source->DisableI18nAndUseGzipForAllPaths(); + source->UseGzip(std::unordered_set<std::string>()); return source; }
diff --git a/chrome/browser/ui/webui/invalidations_ui.cc b/chrome/browser/ui/webui/invalidations_ui.cc index d3295a4..15c4b0c 100644 --- a/chrome/browser/ui/webui/invalidations_ui.cc +++ b/chrome/browser/ui/webui/invalidations_ui.cc
@@ -19,7 +19,7 @@ content::WebUIDataSource::Create(chrome::kChromeUIInvalidationsHost); source->AddResourcePath("about_invalidations.js", IDR_ABOUT_INVALIDATIONS_JS); source->SetDefaultResource(IDR_ABOUT_INVALIDATIONS_HTML); - source->DisableI18nAndUseGzipForAllPaths(); + source->UseGzip(std::unordered_set<std::string>()); return source; }
diff --git a/chrome/browser/ui/webui/md_downloads/md_downloads_ui.cc b/chrome/browser/ui/webui/md_downloads/md_downloads_ui.cc index 99404cb..c70dd2d1 100644 --- a/chrome/browser/ui/webui/md_downloads/md_downloads_ui.cc +++ b/chrome/browser/ui/webui/md_downloads/md_downloads_ui.cc
@@ -105,6 +105,13 @@ IDR_MD_DOWNLOADS_2X_NO_DOWNLOADS_PNG); #if BUILDFLAG(USE_VULCANIZE) + std::unordered_set<std::string> exclude_from_gzip; + exclude_from_gzip.insert("1x/incognito_marker.png"); + exclude_from_gzip.insert("2x/incognito_marker.png"); + exclude_from_gzip.insert("1x/no_downloads.png"); + exclude_from_gzip.insert("2x/no_downloads.png"); + source->UseGzip(exclude_from_gzip); + source->AddResourcePath("crisper.js", IDR_MD_DOWNLOADS_CRISPER_JS); source->SetDefaultResource(IDR_MD_DOWNLOADS_VULCANIZED_HTML); #else
diff --git a/chrome/browser/ui/webui/md_history_ui.cc b/chrome/browser/ui/webui/md_history_ui.cc index 0859733b..105541e 100644 --- a/chrome/browser/ui/webui/md_history_ui.cc +++ b/chrome/browser/ui/webui/md_history_ui.cc
@@ -141,13 +141,59 @@ source->AddBoolean(kIsUserSignedInKey, IsUserSignedIn(profile)); - source->AddResourcePath("constants.html", IDR_MD_HISTORY_CONSTANTS_HTML); - source->AddResourcePath("constants.js", IDR_MD_HISTORY_CONSTANTS_JS); - source->AddResourcePath("images/100/sign_in_promo.jpg", - IDR_MD_HISTORY_IMAGES_100_SIGN_IN_PROMO_JPG); - source->AddResourcePath("images/200/sign_in_promo.jpg", - IDR_MD_HISTORY_IMAGES_200_SIGN_IN_PROMO_JPG); - source->AddResourcePath("history.js", IDR_MD_HISTORY_HISTORY_JS); + struct UncompressedResource { + const char* path; + int idr; + }; + const UncompressedResource uncompressed_resources[] = { + {"constants.html", IDR_MD_HISTORY_CONSTANTS_HTML}, + {"constants.js", IDR_MD_HISTORY_CONSTANTS_JS}, + {"history.js", IDR_MD_HISTORY_HISTORY_JS}, + {"images/100/sign_in_promo.jpg", + IDR_MD_HISTORY_IMAGES_100_SIGN_IN_PROMO_JPG}, + {"images/200/sign_in_promo.jpg", + IDR_MD_HISTORY_IMAGES_200_SIGN_IN_PROMO_JPG}, +#if !BUILDFLAG(USE_VULCANIZE) + {"app.html", IDR_MD_HISTORY_APP_HTML}, + {"app.js", IDR_MD_HISTORY_APP_JS}, + {"browser_service.html", IDR_MD_HISTORY_BROWSER_SERVICE_HTML}, + {"browser_service.js", IDR_MD_HISTORY_BROWSER_SERVICE_JS}, + {"grouped_list.html", IDR_MD_HISTORY_GROUPED_LIST_HTML}, + {"grouped_list.js", IDR_MD_HISTORY_GROUPED_LIST_JS}, + {"history_item.html", IDR_MD_HISTORY_HISTORY_ITEM_HTML}, + {"history_item.js", IDR_MD_HISTORY_HISTORY_ITEM_JS}, + {"history_list.html", IDR_MD_HISTORY_HISTORY_LIST_HTML}, + {"history_list.js", IDR_MD_HISTORY_HISTORY_LIST_JS}, + {"history_list_behavior.html", IDR_MD_HISTORY_HISTORY_LIST_BEHAVIOR_HTML}, + {"history_list_behavior.js", IDR_MD_HISTORY_HISTORY_LIST_BEHAVIOR_JS}, + {"history_toolbar.html", IDR_MD_HISTORY_HISTORY_TOOLBAR_HTML}, + {"history_toolbar.js", IDR_MD_HISTORY_HISTORY_TOOLBAR_JS}, + {"icons.html", IDR_MD_HISTORY_ICONS_HTML}, + {"lazy_load.html", IDR_MD_HISTORY_LAZY_LOAD_HTML}, + {"list_container.html", IDR_MD_HISTORY_LIST_CONTAINER_HTML}, + {"list_container.js", IDR_MD_HISTORY_LIST_CONTAINER_JS}, + {"router.html", IDR_MD_HISTORY_ROUTER_HTML}, + {"router.js", IDR_MD_HISTORY_ROUTER_JS}, + {"searched_label.html", IDR_MD_HISTORY_SEARCHED_LABEL_HTML}, + {"searched_label.js", IDR_MD_HISTORY_SEARCHED_LABEL_JS}, + {"shared_style.html", IDR_MD_HISTORY_SHARED_STYLE_HTML}, + {"shared_vars.html", IDR_MD_HISTORY_SHARED_VARS_HTML}, + {"side_bar.html", IDR_MD_HISTORY_SIDE_BAR_HTML}, + {"side_bar.js", IDR_MD_HISTORY_SIDE_BAR_JS}, + {"synced_device_card.html", IDR_MD_HISTORY_SYNCED_DEVICE_CARD_HTML}, + {"synced_device_card.js", IDR_MD_HISTORY_SYNCED_DEVICE_CARD_JS}, + {"synced_device_manager.html", IDR_MD_HISTORY_SYNCED_DEVICE_MANAGER_HTML}, + {"synced_device_manager.js", IDR_MD_HISTORY_SYNCED_DEVICE_MANAGER_JS}, +#endif + }; + + std::unordered_set<std::string> exclude_from_gzip; + for (size_t i = 0; i < arraysize(uncompressed_resources); ++i) { + const UncompressedResource& resource = uncompressed_resources[i]; + source->AddResourcePath(resource.path, resource.idr); + exclude_from_gzip.insert(resource.path); + } + source->UseGzip(exclude_from_gzip); #if BUILDFLAG(USE_VULCANIZE) source->AddResourcePath("app.html", @@ -158,59 +204,7 @@ IDR_MD_HISTORY_LAZY_LOAD_VULCANIZED_HTML); source->AddResourcePath("lazy_load.crisper.js", IDR_MD_HISTORY_LAZY_LOAD_CRISPER_JS); -#else - source->AddResourcePath("app.html", IDR_MD_HISTORY_APP_HTML); - source->AddResourcePath("app.js", IDR_MD_HISTORY_APP_JS); - source->AddResourcePath("browser_service.html", - IDR_MD_HISTORY_BROWSER_SERVICE_HTML); - source->AddResourcePath("browser_service.js", - IDR_MD_HISTORY_BROWSER_SERVICE_JS); - source->AddResourcePath("grouped_list.html", - IDR_MD_HISTORY_GROUPED_LIST_HTML); - source->AddResourcePath("grouped_list.js", IDR_MD_HISTORY_GROUPED_LIST_JS); - source->AddResourcePath("history_item.html", - IDR_MD_HISTORY_HISTORY_ITEM_HTML); - source->AddResourcePath("history_item.js", IDR_MD_HISTORY_HISTORY_ITEM_JS); - source->AddResourcePath("history_list.html", - IDR_MD_HISTORY_HISTORY_LIST_HTML); - source->AddResourcePath("history_list.js", IDR_MD_HISTORY_HISTORY_LIST_JS); - source->AddResourcePath("history_list_behavior.html", - IDR_MD_HISTORY_HISTORY_LIST_BEHAVIOR_HTML); - source->AddResourcePath("history_list_behavior.js", - IDR_MD_HISTORY_HISTORY_LIST_BEHAVIOR_JS); - source->AddResourcePath("history_toolbar.html", - IDR_MD_HISTORY_HISTORY_TOOLBAR_HTML); - source->AddResourcePath("history_toolbar.js", - IDR_MD_HISTORY_HISTORY_TOOLBAR_JS); - source->AddResourcePath("icons.html", IDR_MD_HISTORY_ICONS_HTML); - source->AddResourcePath("lazy_load.html", IDR_MD_HISTORY_LAZY_LOAD_HTML); - source->AddResourcePath("list_container.html", - IDR_MD_HISTORY_LIST_CONTAINER_HTML); - source->AddResourcePath("list_container.js", - IDR_MD_HISTORY_LIST_CONTAINER_JS); - source->AddResourcePath("router.html", - IDR_MD_HISTORY_ROUTER_HTML); - source->AddResourcePath("router.js", - IDR_MD_HISTORY_ROUTER_JS); - source->AddResourcePath("searched_label.html", - IDR_MD_HISTORY_SEARCHED_LABEL_HTML); - source->AddResourcePath("searched_label.js", - IDR_MD_HISTORY_SEARCHED_LABEL_JS); - source->AddResourcePath("shared_style.html", - IDR_MD_HISTORY_SHARED_STYLE_HTML); - source->AddResourcePath("shared_vars.html", - IDR_MD_HISTORY_SHARED_VARS_HTML); - source->AddResourcePath("side_bar.html", IDR_MD_HISTORY_SIDE_BAR_HTML); - source->AddResourcePath("side_bar.js", IDR_MD_HISTORY_SIDE_BAR_JS); - source->AddResourcePath("synced_device_card.html", - IDR_MD_HISTORY_SYNCED_DEVICE_CARD_HTML); - source->AddResourcePath("synced_device_card.js", - IDR_MD_HISTORY_SYNCED_DEVICE_CARD_JS); - source->AddResourcePath("synced_device_manager.html", - IDR_MD_HISTORY_SYNCED_DEVICE_MANAGER_HTML); - source->AddResourcePath("synced_device_manager.js", - IDR_MD_HISTORY_SYNCED_DEVICE_MANAGER_JS); -#endif // BUILDFLAG(USE_VULCANIZE) +#endif source->SetDefaultResource(IDR_MD_HISTORY_HISTORY_HTML); source->SetJsonPath("strings.js");
diff --git a/chrome/browser/ui/webui/net_internals/net_internals_ui.cc b/chrome/browser/ui/webui/net_internals/net_internals_ui.cc index 1e821dc..36b7a53 100644 --- a/chrome/browser/ui/webui/net_internals/net_internals_ui.cc +++ b/chrome/browser/ui/webui/net_internals/net_internals_ui.cc
@@ -178,7 +178,7 @@ source->SetDefaultResource(IDR_NET_INTERNALS_INDEX_HTML); source->AddResourcePath("index.js", IDR_NET_INTERNALS_INDEX_JS); source->SetJsonPath("strings.js"); - source->DisableI18nAndUseGzipForAllPaths(); + source->UseGzip(std::unordered_set<std::string>()); return source; } @@ -211,6 +211,7 @@ void OnClearBrowserCache(const base::ListValue* list); void OnGetPrerenderInfo(const base::ListValue* list); void OnGetHistoricNetworkStats(const base::ListValue* list); + void OnGetSessionNetworkStats(const base::ListValue* list); void OnGetExtensionInfo(const base::ListValue* list); void OnGetDataReductionProxyInfo(const base::ListValue* list); #if defined(OS_CHROMEOS) @@ -300,7 +301,6 @@ void OnHSTSQuery(const base::ListValue* list); void OnHSTSAdd(const base::ListValue* list); void OnHSTSDelete(const base::ListValue* list); - void OnGetSessionNetworkStats(const base::ListValue* list); void OnCloseIdleSockets(const base::ListValue* list); void OnFlushSocketPools(const base::ListValue* list); #if defined(OS_WIN) @@ -444,10 +444,6 @@ base::Bind(&IOThreadImpl::CallbackHelper, &IOThreadImpl::OnHSTSDelete, proxy_)); web_ui()->RegisterMessageCallback( - "getSessionNetworkStats", - base::Bind(&IOThreadImpl::CallbackHelper, - &IOThreadImpl::OnGetSessionNetworkStats, proxy_)); - web_ui()->RegisterMessageCallback( "closeIdleSockets", base::Bind(&IOThreadImpl::CallbackHelper, &IOThreadImpl::OnCloseIdleSockets, proxy_)); @@ -478,6 +474,10 @@ base::Bind(&NetInternalsMessageHandler::OnGetHistoricNetworkStats, base::Unretained(this))); web_ui()->RegisterMessageCallback( + "getSessionNetworkStats", + base::Bind(&NetInternalsMessageHandler::OnGetSessionNetworkStats, + base::Unretained(this))); + web_ui()->RegisterMessageCallback( "getExtensionInfo", base::Bind(&NetInternalsMessageHandler::OnGetExtensionInfo, base::Unretained(this))); @@ -568,6 +568,24 @@ std::move(historic_network_info)); } +void NetInternalsMessageHandler::OnGetSessionNetworkStats( + const base::ListValue* list) { + DCHECK_CURRENTLY_ON(BrowserThread::UI); + std::unique_ptr<base::Value> session_network_info; + Profile* profile = Profile::FromWebUI(web_ui()); + DataReductionProxyChromeSettings* data_reduction_proxy_settings = + DataReductionProxyChromeSettingsFactory::GetForBrowserContext(profile); + if (data_reduction_proxy_settings) { + data_reduction_proxy::DataReductionProxyCompressionStats* + compression_stats = + data_reduction_proxy_settings->data_reduction_proxy_service() + ->compression_stats(); + session_network_info = compression_stats->SessionNetworkStatsInfoToValue(); + } + SendJavascriptCommand("receivedSessionNetworkStats", + std::move(session_network_info)); +} + void NetInternalsMessageHandler::OnGetExtensionInfo( const base::ListValue* list) { DCHECK_CURRENTLY_ON(BrowserThread::UI); @@ -866,27 +884,6 @@ transport_security_state->DeleteDynamicDataForHost(domain); } -void NetInternalsMessageHandler::IOThreadImpl::OnGetSessionNetworkStats( - const base::ListValue* list) { - DCHECK(!list); - net::URLRequestContext* context = - main_context_getter_->GetURLRequestContext(); - net::HttpNetworkSession* http_network_session = - GetHttpNetworkSession(context); - - std::unique_ptr<base::Value> network_info; - if (http_network_session) { - // TODO(mmenke): This cast is ugly. Can we get rid of it, or, better, - // remove DRP data from net-internals entirely? - data_reduction_proxy::DataReductionProxyNetworkDelegate* net_delegate = - static_cast<data_reduction_proxy::DataReductionProxyNetworkDelegate*>( - context->network_delegate()); - if (net_delegate) - network_info = net_delegate->SessionNetworkStatsInfoToValue(); - } - SendJavascriptCommand("receivedSessionNetworkStats", std::move(network_info)); -} - void NetInternalsMessageHandler::IOThreadImpl::OnFlushSocketPools( const base::ListValue* list) { DCHECK(!list);
diff --git a/chrome/browser/ui/webui/offline/offline_internals_ui.cc b/chrome/browser/ui/webui/offline/offline_internals_ui.cc index ae21d36..9dd4b14 100644 --- a/chrome/browser/ui/webui/offline/offline_internals_ui.cc +++ b/chrome/browser/ui/webui/offline/offline_internals_ui.cc
@@ -28,7 +28,7 @@ html_source->AddResourcePath("offline_internals_browser_proxy.js", IDR_OFFLINE_INTERNALS_BROWSER_PROXY_JS); html_source->SetDefaultResource(IDR_OFFLINE_INTERNALS_HTML); - html_source->DisableI18nAndUseGzipForAllPaths(); + html_source->UseGzip(std::unordered_set<std::string>()); Profile* profile = Profile::FromWebUI(web_ui); html_source->AddBoolean("isIncognito", profile->IsOffTheRecord());
diff --git a/chrome/browser/ui/webui/password_manager_internals/password_manager_internals_ui.cc b/chrome/browser/ui/webui/password_manager_internals/password_manager_internals_ui.cc index af29f96f..36d2ceb8 100644 --- a/chrome/browser/ui/webui/password_manager_internals/password_manager_internals_ui.cc +++ b/chrome/browser/ui/webui/password_manager_internals/password_manager_internals_ui.cc
@@ -39,7 +39,7 @@ IDR_PASSWORD_MANAGER_INTERNALS_PASSWORD_MANAGER_INTERNALS_CSS); source->SetDefaultResource( IDR_PASSWORD_MANAGER_INTERNALS_PASSWORD_MANAGER_INTERNALS_HTML); - source->DisableI18nAndUseGzipForAllPaths(); + source->UseGzip(std::unordered_set<std::string>()); return source; }
diff --git a/chrome/browser/ui/webui/predictors/predictors_ui.cc b/chrome/browser/ui/webui/predictors/predictors_ui.cc index 2a7f91a..df3880e 100644 --- a/chrome/browser/ui/webui/predictors/predictors_ui.cc +++ b/chrome/browser/ui/webui/predictors/predictors_ui.cc
@@ -19,7 +19,7 @@ content::WebUIDataSource::Create(chrome::kChromeUIPredictorsHost); source->AddResourcePath("predictors.js", IDR_PREDICTORS_JS); source->SetDefaultResource(IDR_PREDICTORS_HTML); - source->DisableI18nAndUseGzipForAllPaths(); + source->UseGzip(std::unordered_set<std::string>()); return source; }
diff --git a/chrome/browser/ui/webui/print_preview/printer_capabilities_unittest.cc b/chrome/browser/ui/webui/print_preview/printer_capabilities_unittest.cc new file mode 100644 index 0000000..76e3934 --- /dev/null +++ b/chrome/browser/ui/webui/print_preview/printer_capabilities_unittest.cc
@@ -0,0 +1,124 @@ +// Copyright 2016 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. + +#include <memory> + +#include "base/bind.h" +#include "base/memory/ptr_util.h" +#include "base/memory/ref_counted.h" +#include "base/run_loop.h" +#include "base/test/values_test_util.h" +#include "chrome/browser/ui/webui/print_preview/printer_capabilities.h" +#include "content/public/browser/browser_thread.h" +#include "content/public/test/test_browser_thread_bundle.h" +#include "printing/backend/test_print_backend.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "ui/gfx/geometry/size.h" + +namespace { + +void SettingsReply(std::unique_ptr<base::DictionaryValue>* out, + std::unique_ptr<base::DictionaryValue> reply) { + out->reset(reply.release()); +} + +std::unique_ptr<base::DictionaryValue> GetSettingsSynchronous( + const std::string& printer_name, + const printing::PrinterBasicInfo& basic_info) { + std::unique_ptr<base::DictionaryValue> settings_dictionary; + + base::SequencedWorkerPool* worker_pool = + content::BrowserThread::GetBlockingPool(); + + base::PostTaskAndReplyWithResult( + worker_pool, FROM_HERE, base::Bind(&printing::GetSettingsOnBlockingPool, + printer_name, basic_info), + base::Bind(&SettingsReply, base::Unretained(&settings_dictionary))); + + worker_pool->FlushForTesting(); + base::RunLoop().RunUntilIdle(); + + return settings_dictionary; +} + +} // namespace + +class PrinterCapabilitiesTest : public testing::Test { + public: + PrinterCapabilitiesTest() : test_browser_threads_() {} + + protected: + void SetUp() override { + test_backend_ = new printing::TestPrintBackend(); + printing::PrintBackend::SetPrintBackendForTesting(test_backend_.get()); + } + + void TearDown() override { test_backend_ = nullptr; } + + printing::TestPrintBackend* print_backend() { return test_backend_.get(); } + + private: + content::TestBrowserThreadBundle test_browser_threads_; + scoped_refptr<printing::TestPrintBackend> test_backend_; +}; + +// Verify that we don't crash for a missing printer and a nullptr is never +// returned. +TEST_F(PrinterCapabilitiesTest, NonNullForMissingPrinter) { + printing::PrinterBasicInfo basic_info; + std::string printer_name = "missing_printer"; + + std::unique_ptr<base::DictionaryValue> settings_dictionary = + GetSettingsSynchronous(printer_name, basic_info); + + ASSERT_TRUE(settings_dictionary); +} + +TEST_F(PrinterCapabilitiesTest, ProvidedCapabilitiesUsed) { + std::string printer_name = "test_printer"; + printing::PrinterBasicInfo basic_info; + std::unique_ptr<printing::PrinterSemanticCapsAndDefaults> caps = + base::MakeUnique<printing::PrinterSemanticCapsAndDefaults>(); + + // set a capability + caps->dpis = {gfx::Size(600, 600)}; + + print_backend()->AddValidPrinter(printer_name, std::move(caps)); + + std::unique_ptr<base::DictionaryValue> settings_dictionary = + GetSettingsSynchronous(printer_name, basic_info); + + // verify settings were created + ASSERT_TRUE(settings_dictionary); + + // verify capabilities and have one entry + base::DictionaryValue* cdd; + ASSERT_TRUE(settings_dictionary->GetDictionary("capabilities", &cdd)); + + // read the CDD for the dpi attribute. + base::DictionaryValue* caps_dict; + ASSERT_TRUE(cdd->GetDictionary("printer", &caps_dict)); + EXPECT_TRUE(caps_dict->HasKey("dpi")); +} + +// Ensure that the capabilities dictionary is present but empty if the backend +// doesn't return capabilities. +TEST_F(PrinterCapabilitiesTest, NullCapabilitiesExcluded) { + std::string printer_name = "test_printer"; + printing::PrinterBasicInfo basic_info; + + // return false when attempting to retrieve capabilities + print_backend()->AddValidPrinter(printer_name, nullptr); + + std::unique_ptr<base::DictionaryValue> settings_dictionary = + GetSettingsSynchronous(printer_name, basic_info); + + // verify settings were created + ASSERT_TRUE(settings_dictionary); + + // verify that capabilities is an empty dictionary + base::DictionaryValue* caps_dict; + ASSERT_TRUE(settings_dictionary->GetDictionary("capabilities", &caps_dict)); + EXPECT_TRUE(caps_dict->empty()); +}
diff --git a/chrome/browser/ui/webui/profiler_ui.cc b/chrome/browser/ui/webui/profiler_ui.cc index 8c0eacf5..80643d2f 100644 --- a/chrome/browser/ui/webui/profiler_ui.cc +++ b/chrome/browser/ui/webui/profiler_ui.cc
@@ -105,7 +105,7 @@ source->SetJsonPath("strings.js"); source->AddResourcePath("profiler.js", IDR_PROFILER_JS); source->SetDefaultResource(IDR_PROFILER_HTML); - source->DisableI18nAndUseGzipForAllPaths(); + source->UseGzip(std::unordered_set<std::string>()); source->AddBoolean("enableMemoryTaskProfiler", BUILDFLAG(ENABLE_MEMORY_TASK_PROFILER));
diff --git a/chrome/browser/ui/webui/settings/md_settings_localized_strings_provider.cc b/chrome/browser/ui/webui/settings/md_settings_localized_strings_provider.cc index 1b6f120..b1c1b5c5 100644 --- a/chrome/browser/ui/webui/settings/md_settings_localized_strings_provider.cc +++ b/chrome/browser/ui/webui/settings/md_settings_localized_strings_provider.cc
@@ -320,9 +320,6 @@ void AddBluetoothStrings(content::WebUIDataSource* html_source) { LocalizedString localized_strings[] = { {"bluetoothAccept", IDS_OPTIONS_SETTINGS_BLUETOOTH_ACCEPT_PASSKEY}, - {"bluetoothAddDevice", IDS_OPTIONS_SETTINGS_ADD_BLUETOOTH_DEVICE}, - {"bluetoothAddDevicePageTitle", IDS_SETTINGS_BLUETOOTH_ADD_DEVICE}, - {"bluetoothConnect", IDS_OPTIONS_SETTINGS_BLUETOOTH_CONNECT}, {"bluetoothConnecting", IDS_SETTINGS_BLUETOOTH_CONNECTING}, {"bluetoothDisabled", IDS_SETTINGS_BLUETOOTH_DISABLED}, {"bluetoothDisconnect", IDS_OPTIONS_SETTINGS_BLUETOOTH_DISCONNECT}, @@ -330,12 +327,15 @@ {"bluetoothEnabled", IDS_SETTINGS_BLUETOOTH_ENABLED}, {"bluetoothExpandA11yLabel", IDS_SETTINGS_BLUETOOTH_EXPAND_ACCESSIBILITY_LABEL}, - {"bluetoothNoDevices", IDS_OPTIONS_SETTINGS_BLUETOOTH_NO_DEVICES}, + {"bluetoothNoDevices", IDS_SETTINGS_BLUETOOTH_NO_DEVICES}, {"bluetoothPageTitle", IDS_SETTINGS_BLUETOOTH}, - {"bluetoothPairDevicePageTitle", IDS_SETTINGS_BLUETOOTH_PAIR_DEVICE}, + {"bluetoothPair", IDS_SETTINGS_BLUETOOTH_PAIR}, + {"bluetoothPairDevice", IDS_SETTINGS_BLUETOOTH_PAIR_DEVICE}, + {"bluetoothPairDevicePageTitle", + IDS_SETTINGS_BLUETOOTH_PAIR_DEVICE_TITLE}, {"bluetoothReject", IDS_OPTIONS_SETTINGS_BLUETOOTH_REJECT_PASSKEY}, {"bluetoothRemove", IDS_SETTINGS_BLUETOOTH_REMOVE}, - {"bluetoothScanning", IDS_OPTIONS_SETTINGS_BLUETOOTH_SCANNING}, + {"bluetoothScanning", IDS_SETTINGS_BLUETOOTH_SCANNING}, // Device connecting and pairing. {"bluetoothStartConnecting", IDS_SETTINGS_BLUETOOTH_START_CONNECTING}, {"bluetoothEnterKey", IDS_OPTIONS_SETTINGS_BLUETOOTH_ENTER_KEY},
diff --git a/chrome/browser/ui/webui/settings/people_handler.cc b/chrome/browser/ui/webui/settings/people_handler.cc index 35e1d2d..2fcfd1e 100644 --- a/chrome/browser/ui/webui/settings/people_handler.cc +++ b/chrome/browser/ui/webui/settings/people_handler.cc
@@ -328,8 +328,6 @@ base::StringValue(kSpinnerPageStatus)); } -// TODO(kochi): Handle error conditions other than timeout. -// http://crbug.com/128692 void PeopleHandler::DisplayTimeout() { // Stop a timer to handle timeout in waiting for checking network connection. engine_start_timer_.reset(); @@ -777,8 +775,15 @@ return; ProfileSyncService* service = GetSyncService(); - DCHECK(service); + // The sync service may be nullptr if it has been just disabled by policy. + if (!service) + return; + if (!service->IsEngineInitialized()) { + // Requesting the sync service to start may trigger another reentrant call + // to PushSyncPrefs. Setting up the startup tracker beforehand correctly + // signals the re-entrant call to early exit. + sync_startup_tracker_.reset(new SyncStartupTracker(profile_, this)); service->RequestStart(); // See if it's even possible to bring up the sync engine - if not @@ -789,9 +794,6 @@ SyncStartupTracker::SYNC_STARTUP_ERROR) { DisplaySpinner(); } - - // Start SyncSetupTracker to wait for sync to initialize. - sync_startup_tracker_.reset(new SyncStartupTracker(profile_, this)); return; } @@ -904,8 +906,8 @@ signin::SetUserSkippedPromo(profile_); ProfileSyncService* service = GetSyncService(); - DCHECK(service); - if (service->IsFirstSetupComplete()) + // The sync service may be nullptr if it has been just disabled by policy. + if (!service || service->IsFirstSetupComplete()) return; // This is the first time configuring sync, so log it.
diff --git a/chrome/browser/ui/webui/settings/protocol_handlers_handler.cc b/chrome/browser/ui/webui/settings/protocol_handlers_handler.cc index 2e9c467..8ede9b3 100644 --- a/chrome/browser/ui/webui/settings/protocol_handlers_handler.cc +++ b/chrome/browser/ui/webui/settings/protocol_handlers_handler.cc
@@ -40,9 +40,13 @@ } void ProtocolHandlersHandler::RegisterMessages() { - web_ui()->RegisterMessageCallback("initializeProtocolHandlerList", - base::Bind(&ProtocolHandlersHandler::HandleInitializeList, + web_ui()->RegisterMessageCallback("observeProtocolHandlers", + base::Bind(&ProtocolHandlersHandler::HandleObserveProtocolHandlers, base::Unretained(this))); + web_ui()->RegisterMessageCallback("observeProtocolHandlersEnabledState", + base::Bind( + &ProtocolHandlersHandler::HandleObserveProtocolHandlersEnabledState, + base::Unretained(this))); web_ui()->RegisterMessageCallback("clearDefault", base::Bind(&ProtocolHandlersHandler::HandleClearDefault, base::Unretained(this))); @@ -131,13 +135,19 @@ *ignored_handlers); } -void ProtocolHandlersHandler::HandleInitializeList( +void ProtocolHandlersHandler::HandleObserveProtocolHandlers( const base::ListValue* args) { AllowJavascript(); SendHandlersEnabledValue(); UpdateHandlerList(); } +void ProtocolHandlersHandler::HandleObserveProtocolHandlersEnabledState( + const base::ListValue* args) { + AllowJavascript(); + SendHandlersEnabledValue(); +} + void ProtocolHandlersHandler::SendHandlersEnabledValue() { CallJavascriptFunction("cr.webUIListenerCallback", base::StringValue("setHandlersEnabled"),
diff --git a/chrome/browser/ui/webui/settings/protocol_handlers_handler.h b/chrome/browser/ui/webui/settings/protocol_handlers_handler.h index 8911534..269f27f 100644 --- a/chrome/browser/ui/webui/settings/protocol_handlers_handler.h +++ b/chrome/browser/ui/webui/settings/protocol_handlers_handler.h
@@ -44,8 +44,15 @@ const content::NotificationDetails& details) override; private: - // Called to fetch the initial list of data to show. - void HandleInitializeList(const base::ListValue* args); + // Called to fetch the state of the protocol handlers. If the full list of + // handlers is not needed, consider HandleObserveProtocolHandlersEnabledState + // instead. + void HandleObserveProtocolHandlers(const base::ListValue* args); + + // Called to begin updates to the handlers enabled status. This is a subset + // (lighter alternative) of HandleObserveProtocolHandlers. There's no need to + // call this function if HandleObserveProtocolHandlers is called. + void HandleObserveProtocolHandlersEnabledState(const base::ListValue* args); // Notifies the JS side whether the handlers are enabled or not. void SendHandlersEnabledValue();
diff --git a/chrome/browser/ui/webui/signin_internals_ui.cc b/chrome/browser/ui/webui/signin_internals_ui.cc index fea74c0..94bc931 100644 --- a/chrome/browser/ui/webui/signin_internals_ui.cc +++ b/chrome/browser/ui/webui/signin_internals_ui.cc
@@ -28,7 +28,7 @@ source->SetJsonPath("strings.js"); source->AddResourcePath("signin_internals.js", IDR_SIGNIN_INTERNALS_INDEX_JS); source->SetDefaultResource(IDR_SIGNIN_INTERNALS_INDEX_HTML); - source->DisableI18nAndUseGzipForAllPaths(); + source->UseGzip(std::unordered_set<std::string>()); return source; }
diff --git a/chrome/browser/ui/webui/snippets_internals_ui.cc b/chrome/browser/ui/webui/snippets_internals_ui.cc index 28f6856..0b9a597 100644 --- a/chrome/browser/ui/webui/snippets_internals_ui.cc +++ b/chrome/browser/ui/webui/snippets_internals_ui.cc
@@ -21,7 +21,7 @@ source->AddResourcePath("snippets_internals.js", IDR_SNIPPETS_INTERNALS_JS); source->AddResourcePath("snippets_internals.css", IDR_SNIPPETS_INTERNALS_CSS); source->SetDefaultResource(IDR_SNIPPETS_INTERNALS_HTML); - source->DisableI18nAndUseGzipForAllPaths(); + source->UseGzip(std::unordered_set<std::string>()); return source; }
diff --git a/chrome/browser/ui/webui/supervised_user_internals_ui.cc b/chrome/browser/ui/webui/supervised_user_internals_ui.cc index 31e08a4cb..23aa9f6 100644 --- a/chrome/browser/ui/webui/supervised_user_internals_ui.cc +++ b/chrome/browser/ui/webui/supervised_user_internals_ui.cc
@@ -22,7 +22,7 @@ source->AddResourcePath("supervised_user_internals.css", IDR_SUPERVISED_USER_INTERNALS_CSS); source->SetDefaultResource(IDR_SUPERVISED_USER_INTERNALS_HTML); - source->DisableI18nAndUseGzipForAllPaths(); + source->UseGzip(std::unordered_set<std::string>()); return source; }
diff --git a/chrome/browser/ui/webui/translate_internals/translate_internals_ui.cc b/chrome/browser/ui/webui/translate_internals/translate_internals_ui.cc index bfb80e2..c88c865 100644 --- a/chrome/browser/ui/webui/translate_internals/translate_internals_ui.cc +++ b/chrome/browser/ui/webui/translate_internals/translate_internals_ui.cc
@@ -50,7 +50,7 @@ source->SetJsonPath("strings.js"); source->AddResourcePath("translate_internals.js", IDR_TRANSLATE_INTERNALS_TRANSLATE_INTERNALS_JS); - source->DisableI18nAndUseGzipForAllPaths(); + source->UseGzip(std::unordered_set<std::string>()); base::DictionaryValue langs; GetLanguages(&langs);
diff --git a/chrome/browser/ui/webui/usb_internals/usb_internals_ui.cc b/chrome/browser/ui/webui/usb_internals/usb_internals_ui.cc index 99f31890..7a06580 100644 --- a/chrome/browser/ui/webui/usb_internals/usb_internals_ui.cc +++ b/chrome/browser/ui/webui/usb_internals/usb_internals_ui.cc
@@ -23,7 +23,7 @@ source->AddResourcePath("url/mojo/origin.mojom", IDR_ORIGIN_MOJO_JS); source->AddResourcePath("url/mojo/url.mojom", IDR_URL_MOJO_JS); source->SetDefaultResource(IDR_USB_INTERNALS_HTML); - source->DisableI18nAndUseGzipForAllPaths(); + source->UseGzip(std::unordered_set<std::string>()); content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), source); }
diff --git a/chrome/browser/ui/webui/vr_shell/vr_shell_ui_ui.cc b/chrome/browser/ui/webui/vr_shell/vr_shell_ui_ui.cc index 528726d1..5e615ea 100644 --- a/chrome/browser/ui/webui/vr_shell/vr_shell_ui_ui.cc +++ b/chrome/browser/ui/webui/vr_shell/vr_shell_ui_ui.cc
@@ -190,8 +190,8 @@ source->SetDefaultResource(IDR_VR_SHELL_UI_HTML); // We're localizing strings, so we can't currently use gzip since it's // incompatible with i18n. TODO(klausw): re-enable gzip once an i18n - // compatible variant of WebUIDataSource's DisableI18nAndUseGzipForAllPaths - // gets added, and add compress=gzip to browser_resources.grd as appropriate. + // compatible variant of WebUIDataSource's UseGzip gets added, and add + // compress=gzip to browser_resources.grd as appropriate. source->AddLocalizedString( "insecureWebVrContentPermanent", IDS_WEBSITE_SETTINGS_INSECURE_WEBVR_CONTENT_PERMANENT);
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn index f07bb46e..81f78e4 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn
@@ -4303,6 +4303,7 @@ "../browser/printing/print_preview_test.h", "../browser/ui/webui/print_preview/extension_printer_handler_unittest.cc", "../browser/ui/webui/print_preview/print_preview_ui_unittest.cc", + "../browser/ui/webui/print_preview/printer_capabilities_unittest.cc", "../common/cloud_print/cloud_print_helpers_unittest.cc", "../common/service_process_util_mac_unittest.mm", "../common/service_process_util_unittest.cc", @@ -4316,6 +4317,8 @@ "../service/service_process_prefs_unittest.cc", "../utility/cloud_print/pwg_encoder_unittest.cc", ] + + deps += [ "//printing:test_support" ] } if (enable_media_router) {
diff --git a/chrome/test/data/permissions/flash.js b/chrome/test/data/permissions/flash.js index 0331ce25..be51ef9 100644 --- a/chrome/test/data/permissions/flash.js +++ b/chrome/test/data/permissions/flash.js
@@ -32,4 +32,12 @@ function flashIsEnabledForPluginWithoutFallback() { flashIsEnabledForPlugin( document.getElementById('flash-object-no-fallback')); -} \ No newline at end of file +} + +function spawnPopupAndAwaitLoad() { + var popup = window.open(window.location.href); + popup.addEventListener('load', function handleLoad() { + popup.removeEventListener('load', handleLoad); + window.domAutomationController.send(true); + }); +}
diff --git a/chrome/test/data/webui/settings/protocol_handlers_tests.js b/chrome/test/data/webui/settings/protocol_handlers_tests.js index 92cde77..8ec96f8 100644 --- a/chrome/test/data/webui/settings/protocol_handlers_tests.js +++ b/chrome/test/data/webui/settings/protocol_handlers_tests.js
@@ -76,7 +76,7 @@ PolymerTest.clearBody(); testElement = document.createElement('protocol-handlers'); document.body.appendChild(testElement); - return browserProxy.whenCalled('initializeProtocolHandlerList'). + return browserProxy.whenCalled('observeProtocolHandlers'). then(Polymer.dom.flush.bind(Polymer.dom)); } @@ -114,8 +114,8 @@ /** * A reusable function to test different action buttons. - * @param {!string} button id of the button to test. - * @param {!string} handler name of browserProxy handler to react. + * @param {string} button id of the button to test. + * @param {string} handler name of browserProxy handler to react. * @return {!Promise} */ function testButtonFlow(button, browserProxyHandler) {
diff --git a/chrome/test/data/webui/settings/test_site_settings_prefs_browser_proxy.js b/chrome/test/data/webui/settings/test_site_settings_prefs_browser_proxy.js index a0ef8dc..46d3bfa7 100644 --- a/chrome/test/data/webui/settings/test_site_settings_prefs_browser_proxy.js +++ b/chrome/test/data/webui/settings/test_site_settings_prefs_browser_proxy.js
@@ -50,7 +50,8 @@ 'fetchZoomLevels', 'getDefaultValueForContentType', 'getExceptionList', - 'initializeProtocolHandlerList', + 'observeProtocolHandlers', + 'observeProtocolHandlersEnabledState', 'removeProtocolHandler', 'removeUsbDevice', 'removeZoomLevel', @@ -241,10 +242,16 @@ }, /** @override */ - initializeProtocolHandlerList: function() { + observeProtocolHandlers: function() { cr.webUIListenerCallback('setHandlersEnabled', true); cr.webUIListenerCallback('setProtocolHandlers', this.protocolHandlers_); - this.methodCalled('initializeProtocolHandlerList'); + this.methodCalled('observeProtocolHandlers'); + }, + + /** @override */ + observeProtocolHandlersEnabledState: function() { + cr.webUIListenerCallback('setHandlersEnabled', true); + this.methodCalled('observeProtocolHandlersEnabledState'); }, /** @override */
diff --git a/components/autofill/core/browser/BUILD.gn b/components/autofill/core/browser/BUILD.gn index 74426f0c..3833eda 100644 --- a/components/autofill/core/browser/BUILD.gn +++ b/components/autofill/core/browser/BUILD.gn
@@ -320,6 +320,7 @@ "phone_number_unittest.cc", "ui/card_unmask_prompt_controller_impl_unittest.cc", "validation_unittest.cc", + "webdata/autocomplete_sync_bridge_unittest.cc", "webdata/autofill_data_type_controller_unittest.cc", "webdata/autofill_profile_syncable_service_unittest.cc", "webdata/autofill_table_unittest.cc",
diff --git a/components/autofill/core/browser/webdata/autocomplete_sync_bridge.cc b/components/autofill/core/browser/webdata/autocomplete_sync_bridge.cc index 3a76db0b..9b8e201 100644 --- a/components/autofill/core/browser/webdata/autocomplete_sync_bridge.cc +++ b/components/autofill/core/browser/webdata/autocomplete_sync_bridge.cc
@@ -4,14 +4,18 @@ #include "components/autofill/core/browser/webdata/autocomplete_sync_bridge.h" +#include <unordered_set> + #include "base/bind.h" #include "base/memory/ptr_util.h" +#include "base/strings/utf_string_conversions.h" #include "components/autofill/core/browser/webdata/autofill_metadata_change_list.h" #include "components/autofill/core/browser/webdata/autofill_table.h" #include "components/autofill/core/browser/webdata/autofill_webdata_backend.h" #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" #include "components/sync/model/entity_data.h" #include "components/sync/model/model_type_change_processor.h" +#include "components/sync/model/mutable_data_batch.h" #include "components/sync/model/sync_error.h" #include "net/base/escape.h" @@ -26,9 +30,18 @@ return reinterpret_cast<void*>(&user_data_key); } -const std::string FormatStorageKey(const std::string name, - const std::string value) { - return net::EscapePath(name) + "|" + net::EscapePath(value); +std::unique_ptr<syncer::EntityData> CreateEntityData( + const autofill::AutofillEntry& entry) { + auto entity_data = base::MakeUnique<syncer::EntityData>(); + entity_data->non_unique_name = base::UTF16ToUTF8(entry.key().name()); + sync_pb::AutofillSpecifics* autofill = + entity_data->specifics.mutable_autofill(); + autofill->set_name(base::UTF16ToUTF8(entry.key().name())); + autofill->set_value(base::UTF16ToUTF8(entry.key().value())); + autofill->add_usage_timestamp(entry.date_created().ToInternalValue()); + if (entry.date_created() != entry.date_last_used()) + autofill->add_usage_timestamp(entry.date_last_used().ToInternalValue()); + return entity_data; } } // namespace @@ -95,12 +108,32 @@ StorageKeyList storage_keys, DataCallback callback) { DCHECK(thread_checker_.CalledOnValidThread()); - NOTIMPLEMENTED(); + std::unordered_set<std::string> keys_set; + for (const auto& key : storage_keys) { + keys_set.insert(key); + } + + auto batch = base::MakeUnique<syncer::MutableDataBatch>(); + std::vector<AutofillEntry> entries; + GetAutofillTable()->GetAllAutofillEntries(&entries); + for (const AutofillEntry& entry : entries) { + std::string key = GetStorageKeyFromAutofillEntry(entry); + if (keys_set.find(key) != keys_set.end()) { + batch->Put(key, CreateEntityData(entry)); + } + } + callback.Run(syncer::SyncError(), std::move(batch)); } void AutocompleteSyncBridge::GetAllData(DataCallback callback) { DCHECK(thread_checker_.CalledOnValidThread()); - NOTIMPLEMENTED(); + auto batch = base::MakeUnique<syncer::MutableDataBatch>(); + std::vector<AutofillEntry> entries; + GetAutofillTable()->GetAllAutofillEntries(&entries); + for (const AutofillEntry& entry : entries) { + batch->Put(GetStorageKeyFromAutofillEntry(entry), CreateEntityData(entry)); + } + callback.Run(syncer::SyncError(), std::move(batch)); } std::string AutocompleteSyncBridge::GetClientTag( @@ -126,8 +159,35 @@ DCHECK(thread_checker_.CalledOnValidThread()); } +// static +AutofillEntry AutocompleteSyncBridge::CreateAutofillEntry( + const sync_pb::AutofillSpecifics& autofill_specifics) { + AutofillKey key(base::UTF8ToUTF16(autofill_specifics.name()), + base::UTF8ToUTF16(autofill_specifics.value())); + base::Time date_created, date_last_used; + const google::protobuf::RepeatedField<int64_t>& timestamps = + autofill_specifics.usage_timestamp(); + if (!timestamps.empty()) { + date_created = base::Time::FromInternalValue(*timestamps.begin()); + date_last_used = base::Time::FromInternalValue(*timestamps.rbegin()); + } + return AutofillEntry(key, date_created, date_last_used); +} + AutofillTable* AutocompleteSyncBridge::GetAutofillTable() const { return AutofillTable::FromWebDatabase(web_data_backend_->GetDatabase()); } +std::string AutocompleteSyncBridge::GetStorageKeyFromAutofillEntry( + const autofill::AutofillEntry& entry) { + return FormatStorageKey(base::UTF16ToUTF8(entry.key().name()), + base::UTF16ToUTF8(entry.key().value())); +} + +// static +std::string AutocompleteSyncBridge::FormatStorageKey(const std::string& name, + const std::string& value) { + return net::EscapePath(name) + "|" + net::EscapePath(value); +} + } // namespace autofill
diff --git a/components/autofill/core/browser/webdata/autocomplete_sync_bridge.h b/components/autofill/core/browser/webdata/autocomplete_sync_bridge.h index 2a575ed..00a69f1b 100644 --- a/components/autofill/core/browser/webdata/autocomplete_sync_bridge.h +++ b/components/autofill/core/browser/webdata/autocomplete_sync_bridge.h
@@ -64,10 +64,19 @@ // AutofillWebDataServiceObserverOnDBThread implementation. void AutofillEntriesChanged(const AutofillChangeList& changes) override; + static AutofillEntry CreateAutofillEntry( + const sync_pb::AutofillSpecifics& autofill_specifics); + private: // Returns the table associated with the |web_data_backend_|. AutofillTable* GetAutofillTable() const; + std::string GetStorageKeyFromAutofillEntry( + const autofill::AutofillEntry& entry); + + static std::string FormatStorageKey(const std::string& name, + const std::string& value); + base::ThreadChecker thread_checker_; // AutocompleteSyncBridge is owned by |web_data_backend_| through
diff --git a/components/autofill/core/browser/webdata/autocomplete_sync_bridge_unittest.cc b/components/autofill/core/browser/webdata/autocomplete_sync_bridge_unittest.cc new file mode 100644 index 0000000..de05b01 --- /dev/null +++ b/components/autofill/core/browser/webdata/autocomplete_sync_bridge_unittest.cc
@@ -0,0 +1,174 @@ +// Copyright 2016 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. + +#include "components/autofill/core/browser/webdata/autocomplete_sync_bridge.h" + +#include <memory> + +#include "base/bind.h" +#include "base/files/scoped_temp_dir.h" +#include "base/macros.h" +#include "base/memory/ptr_util.h" +#include "base/run_loop.h" +#include "base/strings/stringprintf.h" +#include "base/strings/utf_string_conversions.h" +#include "base/threading/thread_task_runner_handle.h" +#include "components/autofill/core/browser/webdata/autofill_table.h" +#include "components/autofill/core/browser/webdata/autofill_webdata_backend.h" +#include "components/autofill/core/browser/webdata/autofill_webdata_service.h" +#include "components/sync/model/data_batch.h" +#include "components/sync/model/fake_model_type_change_processor.h" +#include "components/sync/model/metadata_batch.h" +#include "components/webdata/common/web_database.h" +#include "net/base/escape.h" +#include "testing/gtest/include/gtest/gtest.h" + +using sync_pb::AutofillSpecifics; +using syncer::SyncError; + +namespace autofill { + +namespace { + +const char kNameFormat[] = "name %d"; +const char kValueFormat[] = "value %d"; + +void VerifyEqual(const AutofillSpecifics& s1, const AutofillSpecifics& s2) { + EXPECT_EQ(s1.SerializeAsString(), s2.SerializeAsString()); +} + +void VerifyDataBatch(std::map<std::string, AutofillSpecifics> expected, + SyncError error, + std::unique_ptr<syncer::DataBatch> batch) { + EXPECT_FALSE(error.IsSet()); + while (batch->HasNext()) { + const syncer::KeyAndData& pair = batch->Next(); + auto iter = expected.find(pair.first); + ASSERT_NE(iter, expected.end()); + VerifyEqual(iter->second, pair.second->specifics.autofill()); + // Removing allows us to verify we don't see the same item multiple times, + // and that we saw everything we expected. + expected.erase(iter); + } + EXPECT_TRUE(expected.empty()); +} + +std::unique_ptr<syncer::ModelTypeChangeProcessor> +CreateModelTypeChangeProcessor(syncer::ModelType type, + syncer::ModelTypeSyncBridge* bridge) { + return base::MakeUnique<syncer::FakeModelTypeChangeProcessor>(); +} + +class FakeAutofillBackend : public AutofillWebDataBackend { + public: + FakeAutofillBackend() {} + ~FakeAutofillBackend() override {} + WebDatabase* GetDatabase() override { return db_; } + void AddObserver( + autofill::AutofillWebDataServiceObserverOnDBThread* observer) override {} + void RemoveObserver( + autofill::AutofillWebDataServiceObserverOnDBThread* observer) override {} + void RemoveExpiredFormElements() override {} + void NotifyOfMultipleAutofillChanges() override {} + void NotifyThatSyncHasStarted(syncer::ModelType model_type) override {} + void SetWebDatabase(WebDatabase* db) { db_ = db; } + + private: + WebDatabase* db_; +}; + +} // namespace + +class AutocompleteSyncBridgeTest : public testing::Test { + public: + AutocompleteSyncBridgeTest() { + if (temp_dir_.CreateUniqueTempDir()) { + db_.AddTable(&table_); + db_.Init(temp_dir_.GetPath().AppendASCII("SyncTestWebDatabase")); + backend_.SetWebDatabase(&db_); + + bridge_.reset(new AutocompleteSyncBridge( + &backend_, base::Bind(&CreateModelTypeChangeProcessor))); + } + } + ~AutocompleteSyncBridgeTest() override {} + + protected: + AutocompleteSyncBridge* bridge() { return bridge_.get(); } + + void SaveSpecificsToTable( + const std::vector<AutofillSpecifics>& specifics_list) { + std::vector<AutofillEntry> new_entries; + for (const auto& specifics : specifics_list) { + new_entries.push_back( + AutocompleteSyncBridge::CreateAutofillEntry(specifics)); + } + table_.UpdateAutofillEntries(new_entries); + } + + AutofillSpecifics CreateSpecifics(int suffix) { + AutofillSpecifics specifics; + specifics.set_name(base::StringPrintf(kNameFormat, suffix)); + specifics.set_value(base::StringPrintf(kValueFormat, suffix)); + specifics.add_usage_timestamp(0); + return specifics; + } + + std::string GetStorageKey(const AutofillSpecifics& specifics) { + return net::EscapePath(specifics.name()) + "|" + + net::EscapePath(specifics.value()); + } + + private: + base::ScopedTempDir temp_dir_; + base::MessageLoop message_loop_; + FakeAutofillBackend backend_; + AutofillTable table_; + WebDatabase db_; + std::unique_ptr<AutocompleteSyncBridge> bridge_; + + DISALLOW_COPY_AND_ASSIGN(AutocompleteSyncBridgeTest); +}; + +TEST_F(AutocompleteSyncBridgeTest, GetData) { + const AutofillSpecifics specifics1 = CreateSpecifics(1); + const AutofillSpecifics specifics2 = CreateSpecifics(2); + const AutofillSpecifics specifics3 = CreateSpecifics(3); + SaveSpecificsToTable({specifics1, specifics2, specifics3}); + + const std::map<std::string, AutofillSpecifics> expected{ + {GetStorageKey(specifics1), specifics1}, + {GetStorageKey(specifics3), specifics3}}; + bridge()->GetData({GetStorageKey(specifics1), GetStorageKey(specifics3)}, + base::Bind(&VerifyDataBatch, expected)); +} + +TEST_F(AutocompleteSyncBridgeTest, GetDataNotExist) { + const AutofillSpecifics specifics1 = CreateSpecifics(1); + const AutofillSpecifics specifics2 = CreateSpecifics(2); + const AutofillSpecifics specifics3 = CreateSpecifics(3); + SaveSpecificsToTable({specifics1, specifics2}); + + const std::map<std::string, AutofillSpecifics> expected{ + {GetStorageKey(specifics1), specifics1}, + {GetStorageKey(specifics2), specifics2}}; + bridge()->GetData({GetStorageKey(specifics1), GetStorageKey(specifics2), + GetStorageKey(specifics3)}, + base::Bind(&VerifyDataBatch, expected)); +} + +TEST_F(AutocompleteSyncBridgeTest, GetAllData) { + const AutofillSpecifics specifics1 = CreateSpecifics(1); + const AutofillSpecifics specifics2 = CreateSpecifics(2); + const AutofillSpecifics specifics3 = CreateSpecifics(3); + SaveSpecificsToTable({specifics1, specifics2, specifics3}); + + const std::map<std::string, AutofillSpecifics> expected{ + {GetStorageKey(specifics1), specifics1}, + {GetStorageKey(specifics2), specifics2}, + {GetStorageKey(specifics3), specifics3}}; + bridge()->GetAllData(base::Bind(&VerifyDataBatch, expected)); +} + +} // namespace autofill
diff --git a/components/autofill/core/browser/webdata/autocomplete_syncable_service.cc b/components/autofill/core/browser/webdata/autocomplete_syncable_service.cc index 76fb7fb..aff31218 100644 --- a/components/autofill/core/browser/webdata/autocomplete_syncable_service.cc +++ b/components/autofill/core/browser/webdata/autocomplete_syncable_service.cc
@@ -317,7 +317,7 @@ if (it == loaded_data->end()) { // New entry. base::Time date_created, date_last_used; - if (timestamps.size() > 0) { + if (!timestamps.empty()) { date_created = base::Time::FromInternalValue(*timestamps.begin()); date_last_used = base::Time::FromInternalValue(*timestamps.rbegin()); }
diff --git a/components/cryptauth/BUILD.gn b/components/cryptauth/BUILD.gn index ac78303..46d9cdc 100644 --- a/components/cryptauth/BUILD.gn +++ b/components/cryptauth/BUILD.gn
@@ -86,6 +86,8 @@ "fake_secure_message_delegate.h", "mock_cryptauth_client.cc", "mock_cryptauth_client.h", + "mock_eid_generator.cc", + "mock_eid_generator.h", "mock_sync_scheduler.cc", "mock_sync_scheduler.h", "remote_device_test_util.cc",
diff --git a/components/cryptauth/eid_generator.cc b/components/cryptauth/eid_generator.cc index 8155349..d43581d 100644 --- a/components/cryptauth/eid_generator.cc +++ b/components/cryptauth/eid_generator.cc
@@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2016 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.
diff --git a/components/cryptauth/eid_generator.h b/components/cryptauth/eid_generator.h index 6219992..f7f40a4 100644 --- a/components/cryptauth/eid_generator.h +++ b/components/cryptauth/eid_generator.h
@@ -78,26 +78,26 @@ // filter. In the normal case, two DataWithTimestamp values are returned, one // for each EID seed rotation period. If data has not been synced from the // backend recently and EID seeds are unavailable, nullptr is returned. - std::unique_ptr<EidData> GenerateBackgroundScanFilter( + virtual std::unique_ptr<EidData> GenerateBackgroundScanFilter( const std::vector<BeaconSeed>& scanning_device_beacon_seeds) const; // Generates advertisement data for the given EID seeds. If data has not been // synced from the back-end recently and EID seeds are unavailable, nullptr is // returned. - std::unique_ptr<DataWithTimestamp> GenerateAdvertisement( + virtual std::unique_ptr<DataWithTimestamp> GenerateAdvertisement( const std::string& advertising_device_public_key, const std::vector<BeaconSeed>& scanning_device_beacon_seeds) const; // Generates all possible advertisements that could be created by a device // given that device's public key and the beacon seeds of the device which is // intended to scan for the advertisement. - std::vector<std::string> GeneratePossibleAdvertisements( + virtual std::vector<std::string> GeneratePossibleAdvertisements( const std::string& advertising_device_public_key, const std::vector<BeaconSeed>& scanning_device_beacon_seeds) const; // Given a list of RemoteDevices, identifies the device which could have // produced the supplied advertisement service data. - RemoteDevice const* IdentifyRemoteDeviceByAdvertisement( + virtual RemoteDevice const* IdentifyRemoteDeviceByAdvertisement( const std::string& advertisement_service_data, const std::vector<RemoteDevice>& device_list, const std::vector<BeaconSeed>& scanning_device_beacon_seeds) const;
diff --git a/components/cryptauth/mock_eid_generator.cc b/components/cryptauth/mock_eid_generator.cc new file mode 100644 index 0000000..adebf26b --- /dev/null +++ b/components/cryptauth/mock_eid_generator.cc
@@ -0,0 +1,68 @@ +// Copyright 2016 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. + +#include "components/cryptauth/mock_eid_generator.h" + +#include "base/memory/ptr_util.h" + +namespace cryptauth { + +MockEidGenerator::MockEidGenerator() : background_scan_filter_(nullptr), + advertisement_(nullptr), + possible_advertisements_(nullptr), + identified_device_(nullptr) {} + +MockEidGenerator::~MockEidGenerator() {} + +std::unique_ptr<EidGenerator::EidData> +MockEidGenerator::GenerateBackgroundScanFilter( + const std::vector<BeaconSeed>& scanning_device_beacon_seeds) const { + if (!background_scan_filter_) { + return nullptr; + } + + std::unique_ptr<EidGenerator::DataWithTimestamp> adjacent_data; + if (background_scan_filter_->adjacent_data) { + adjacent_data = base::MakeUnique<DataWithTimestamp>( + background_scan_filter_->adjacent_data->data, + background_scan_filter_->adjacent_data->start_timestamp_ms, + background_scan_filter_->adjacent_data->end_timestamp_ms); + } + + return base::MakeUnique<EidData>( + background_scan_filter_->current_data, std::move(adjacent_data)); +} + +std::unique_ptr<EidGenerator::DataWithTimestamp> +MockEidGenerator::GenerateAdvertisement( + const std::string& advertising_device_public_key, + const std::vector<BeaconSeed>& scanning_device_beacon_seeds) const { + if (!advertisement_) { + return nullptr; + } + + return base::MakeUnique<DataWithTimestamp>( + advertisement_->data, + advertisement_->start_timestamp_ms, + advertisement_->end_timestamp_ms); +} + +std::vector<std::string> MockEidGenerator::GeneratePossibleAdvertisements( + const std::string& advertising_device_public_key, + const std::vector<BeaconSeed>& scanning_device_beacon_seeds) const { + if (!possible_advertisements_) { + return std::vector<std::string>(); + } + + return *possible_advertisements_; +} + +RemoteDevice const* MockEidGenerator::IdentifyRemoteDeviceByAdvertisement( + const std::string& advertisement_service_data, + const std::vector<RemoteDevice>& device_list, + const std::vector<BeaconSeed>& scanning_device_beacon_seeds) const { + return identified_device_; +} + +} // namespace cryptauth
diff --git a/components/cryptauth/mock_eid_generator.h b/components/cryptauth/mock_eid_generator.h new file mode 100644 index 0000000..6317200 --- /dev/null +++ b/components/cryptauth/mock_eid_generator.h
@@ -0,0 +1,72 @@ +// Copyright 2016 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 COMPONENTS_CRYPTAUTH_BLE_MOCK_EID_GENERATOR_H_ +#define COMPONENTS_CRYPTAUTH_BLE_MOCK_EID_GENERATOR_H_ + +#include <memory> +#include <string> +#include <vector> + +#include "components/cryptauth/eid_generator.h" + +namespace cryptauth { + +class BeaconSeed; +struct RemoteDevice; + +// Mock class for EidGenerator. Note that GoogleMock cannot be used to mock this +// class because GoogleMock's mock functions cannot return a |std::unique_ptr|. +class MockEidGenerator : public EidGenerator { + public: + MockEidGenerator(); + ~MockEidGenerator() override; + + // Setters for the return values of the overridden functions below. + void set_background_scan_filter( + std::unique_ptr<EidData> background_scan_filter) { + background_scan_filter_ = std::move(background_scan_filter); + } + + void set_advertisement(std::unique_ptr<DataWithTimestamp> advertisement) { + advertisement_ = std::move(advertisement); + } + + void set_possible_advertisements( + std::unique_ptr<std::vector<std::string>> possible_advertisements) { + possible_advertisements_ = std::move(possible_advertisements); + } + + void set_identified_device(RemoteDevice* identified_device) { + identified_device_ = identified_device; + } + + // EidGenerator: + std::unique_ptr<EidData> GenerateBackgroundScanFilter( + const std::vector<BeaconSeed>& scanning_device_beacon_seeds) + const override; + std::unique_ptr<DataWithTimestamp> GenerateAdvertisement( + const std::string& advertising_device_public_key, + const std::vector<BeaconSeed>& scanning_device_beacon_seeds) + const override; + std::vector<std::string> GeneratePossibleAdvertisements( + const std::string& advertising_device_public_key, + const std::vector<BeaconSeed>& scanning_device_beacon_seeds) + const override; + RemoteDevice const* IdentifyRemoteDeviceByAdvertisement( + const std::string& advertisement_service_data, + const std::vector<RemoteDevice>& device_list, + const std::vector<BeaconSeed>& scanning_device_beacon_seeds) + const override; + + private: + std::unique_ptr<EidData> background_scan_filter_; + std::unique_ptr<DataWithTimestamp> advertisement_; + std::unique_ptr<std::vector<std::string>> possible_advertisements_; + const RemoteDevice* identified_device_; +}; + +} // namespace cryptauth + +#endif // COMPONENTS_CRYPTAUTH_BLE_MOCK_EID_GENERATOR_H_
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats.cc index 54f7cd7..c01b4e2 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats.cc
@@ -340,6 +340,8 @@ pref_service_(prefs), delay_(delay), data_usage_map_is_dirty_(false), + session_total_received_(0), + session_total_original_(0), current_data_usage_load_status_(NOT_LOADED), weak_factory_(this) { DCHECK(service); @@ -449,6 +451,8 @@ const scoped_refptr<DataUseGroup>& data_use_group, const std::string& mime_type) { DCHECK(thread_checker_.CalledOnValidThread()); + session_total_received_ += data_used; + session_total_original_ += original_size; std::string data_use_host; if (data_use_group) { data_use_host = data_use_group->GetHostname(); @@ -487,7 +491,7 @@ std::unique_ptr<base::ListValue> pref_value = std::unique_ptr<base::ListValue>( pref_service_->GetList(pref)->DeepCopy()); - list_pref_map_.add(pref, std::move(pref_value)); + list_pref_map_[pref] = std::move(pref_value); } int64_t DataReductionProxyCompressionStats::GetInt64(const char* pref_path) { @@ -521,7 +525,10 @@ return ListPrefUpdate(pref_service_, pref_path).Get(); DelayedWritePrefs(); - return list_pref_map_.get(pref_path); + auto it = list_pref_map_.find(pref_path); + if (it == list_pref_map_.end()) + return nullptr; + return it->second.get(); } void DataReductionProxyCompressionStats::WritePrefs() { @@ -534,9 +541,9 @@ pref_service_->SetInt64(iter->first, iter->second); } - for (DataReductionProxyListPrefMap::iterator iter = list_pref_map_.begin(); - iter != list_pref_map_.end(); ++iter) { - TransferList(*(iter->second), + for (auto iter = list_pref_map_.begin(); iter != list_pref_map_.end(); + ++iter) { + TransferList(*(iter->second.get()), ListPrefUpdate(pref_service_, iter->first).Get()); } } @@ -556,6 +563,19 @@ return std::move(dict); } +std::unique_ptr<base::Value> +DataReductionProxyCompressionStats::SessionNetworkStatsInfoToValue() const { + DCHECK(thread_checker_.CalledOnValidThread()); + + auto dict = base::MakeUnique<base::DictionaryValue>(); + // Use strings to avoid overflow. base::Value only supports 32-bit integers. + dict->SetString("session_received_content_length", + base::Int64ToString(session_total_received_)); + dict->SetString("session_original_content_length", + base::Int64ToString(session_total_original_)); + return std::move(dict); +} + int64_t DataReductionProxyCompressionStats::GetLastUpdateTime() { int64_t last_update_internal = GetInt64(prefs::kDailyHttpContentLengthLastUpdateDate); @@ -670,8 +690,8 @@ data_usage->connection_usage_size() == 1); for (const auto& connection_usage : data_usage->connection_usage()) { for (const auto& site_usage : connection_usage.site_usage()) { - data_usage_map_.set(site_usage.hostname(), - base::MakeUnique<PerSiteDataUsage>(site_usage)); + data_usage_map_[site_usage.hostname()] = + base::MakeUnique<PerSiteDataUsage>(site_usage); } } @@ -701,8 +721,8 @@ pref_service_->ClearPref( prefs::kDailyOriginalContentLengthWithDataReductionProxyEnabled); - for (DataReductionProxyListPrefMap::iterator iter = list_pref_map_.begin(); - iter != list_pref_map_.end(); ++iter) { + for (auto iter = list_pref_map_.begin(); iter != list_pref_map_.end(); + ++iter) { iter->second->Clear(); } } @@ -1125,28 +1145,6 @@ } } -void DataReductionProxyCompressionStats::RecordUserVisibleDataSavings() { - int64_t original_content_length; - int64_t received_content_length; - int64_t last_update_internal; - GetContentLengths(kNumDaysInHistorySummary, &original_content_length, - &received_content_length, &last_update_internal); - - if (original_content_length == 0) - return; - - int64_t user_visible_savings_bytes = - original_content_length - received_content_length; - int user_visible_savings_percent = - user_visible_savings_bytes * 100 / original_content_length; - UMA_HISTOGRAM_PERCENTAGE( - "Net.DailyUserVisibleSavingsPercent_DataReductionProxyEnabled", - user_visible_savings_percent); - UMA_HISTOGRAM_COUNTS( - "Net.DailyUserVisibleSavingsSize_DataReductionProxyEnabled", - user_visible_savings_bytes >> 10); -} - void DataReductionProxyCompressionStats::RecordDataUsage( const std::string& data_usage_host, int64_t data_used, @@ -1164,9 +1162,9 @@ } std::string normalized_host = NormalizeHostname(data_usage_host); - auto j = data_usage_map_.add(normalized_host, - base::MakeUnique<PerSiteDataUsage>()); - PerSiteDataUsage* per_site_usage = j.first->second; + auto j = data_usage_map_.insert( + std::make_pair(normalized_host, base::MakeUnique<PerSiteDataUsage>())); + PerSiteDataUsage* per_site_usage = j.first->second.get(); per_site_usage->set_hostname(normalized_host); per_site_usage->set_original_size(per_site_usage->original_size() + original_size); @@ -1187,7 +1185,7 @@ data_usage_bucket->add_connection_usage(); for (auto i = data_usage_map_.begin(); i != data_usage_map_.end(); ++i) { PerSiteDataUsage* per_site_usage = connection_usage->add_site_usage(); - per_site_usage->CopyFrom(*(i->second)); + per_site_usage->CopyFrom(*(i->second.get())); } service_->StoreCurrentDataUsageBucket(std::move(data_usage_bucket)); }
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats.h b/components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats.h index 236501f..60c0020 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats.h +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats.h
@@ -11,8 +11,8 @@ #include <map> #include <memory> #include <string> +#include <unordered_map> -#include "base/containers/scoped_ptr_hash_map.h" #include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" @@ -45,7 +45,7 @@ // prefs must be stored and read on the UI thread. class DataReductionProxyCompressionStats { public: - typedef base::ScopedPtrHashMap<std::string, std::unique_ptr<PerSiteDataUsage>> + typedef std::unordered_map<std::string, std::unique_ptr<PerSiteDataUsage>> SiteUsageMap; // Collects and store data usage and compression statistics. Basic data usage @@ -79,10 +79,15 @@ const scoped_refptr<DataUseGroup>& data_use_group, const std::string& mime_type); - // Creates a |Value| summary of the persistent state of the network session. + // Creates a |Value| summary of the persistent state of the network + // statistics. // Must be called on the UI thread. std::unique_ptr<base::Value> HistoricNetworkStatsInfoToValue(); + // Creates a |Value| summary of the the session network statistics. + // Must be called on the UI thread. + std::unique_ptr<base::Value> SessionNetworkStatsInfoToValue() const; + // Returns the time in milliseconds since epoch that the last update was made // to the daily original and received content lengths. int64_t GetLastUpdateTime(); @@ -135,7 +140,7 @@ friend class DataReductionProxyCompressionStatsTest; typedef std::map<const char*, int64_t> DataReductionProxyPrefMap; - typedef base::ScopedPtrHashMap<const char*, std::unique_ptr<base::ListValue>> + typedef std::unordered_map<const char*, std::unique_ptr<base::ListValue>> DataReductionProxyListPrefMap; class DailyContentLengthUpdate; @@ -201,11 +206,6 @@ const char* original_size_via_proxy_pref, const char* received_size_via_proxy_pref); - // Record UMA with data savings bytes and percent over the past - // |DataReductionProxy::kNumDaysInHistorySummary| days. These numbers - // are displayed to users as their data savings. - void RecordUserVisibleDataSavings(); - // Record data usage and original size of request broken down by host. |time| // is the time at which the data usage occurred. This method should be called // in real time, so |time| is expected to be |Time::Now()|. @@ -269,6 +269,12 @@ // persisted to storage. bool data_usage_map_is_dirty_; + // Total size of all content that has been received over the network. + int64_t session_total_received_; + + // Total original size of all content before it was proxied. + int64_t session_total_original_; + // Tracks state of loading data usage from storage. CurrentDataUsageLoadStatus current_data_usage_load_status_;
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_delegate_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_delegate_unittest.cc index d3f466b..d95198f8 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_delegate_unittest.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_delegate_unittest.cc
@@ -26,10 +26,13 @@ #include "base/time/time.h" #include "base/values.h" #include "build/build_config.h" +#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats.h" #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_config_test_utils.h" #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_metrics.h" #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_mutable_config_values.h" #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate.h" +#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_service.h" +#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_settings.h" #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_test_utils.h" #include "components/data_reduction_proxy/core/common/data_reduction_proxy_headers_test_utils.h" #include "components/data_reduction_proxy/core/common/data_reduction_proxy_params_test_utils.h" @@ -666,10 +669,12 @@ } int64_t total_received_bytes() const { + test_context_->RunUntilIdle(); return GetSessionNetworkStatsInfoInt64("session_received_content_length"); } int64_t total_original_received_bytes() const { + test_context_->RunUntilIdle(); return GetSessionNetworkStatsInfoInt64("session_original_content_length"); } @@ -693,13 +698,11 @@ private: int64_t GetSessionNetworkStatsInfoInt64(const char* key) const { - const DataReductionProxyNetworkDelegate* drp_network_delegate = - reinterpret_cast<const DataReductionProxyNetworkDelegate*>( - context_.network_delegate()); - std::unique_ptr<base::DictionaryValue> session_network_stats_info = - base::DictionaryValue::From( - drp_network_delegate->SessionNetworkStatsInfoToValue()); + base::DictionaryValue::From(test_context_->settings() + ->data_reduction_proxy_service() + ->compression_stats() + ->SessionNetworkStatsInfoToValue()); EXPECT_TRUE(session_network_stats_info); std::string string_value;
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate.cc index 0a37807..a23f1870 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate.cc
@@ -11,7 +11,6 @@ #include "base/metrics/histogram_macros.h" #include "base/strings/string_number_conversions.h" #include "base/time/time.h" -#include "base/values.h" #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_stats.h" #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_config.h" #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_configurator.h" @@ -175,8 +174,6 @@ DataReductionProxyRequestOptions* request_options, const DataReductionProxyConfigurator* configurator) : LayeredNetworkDelegate(std::move(network_delegate)), - total_received_bytes_(0), - total_original_received_bytes_(0), data_reduction_proxy_config_(config), data_reduction_proxy_bypass_stats_(nullptr), data_reduction_proxy_request_options_(request_options), @@ -199,18 +196,6 @@ data_reduction_proxy_bypass_stats_ = bypass_stats; } -std::unique_ptr<base::Value> -DataReductionProxyNetworkDelegate::SessionNetworkStatsInfoToValue() const { - DCHECK(thread_checker_.CalledOnValidThread()); - auto dict = base::MakeUnique<base::DictionaryValue>(); - // Use strings to avoid overflow. base::Value only supports 32-bit integers. - dict->SetString("session_received_content_length", - base::Int64ToString(total_received_bytes_)); - dict->SetString("session_original_content_length", - base::Int64ToString(total_original_received_bytes_)); - return std::move(dict); -} - void DataReductionProxyNetworkDelegate::OnBeforeURLRequestInternal( net::URLRequest* request, const net::CompletionCallback& callback, @@ -424,8 +409,6 @@ data_used, original_size, data_reduction_proxy_io_data_->IsEnabled(), request_type, data_use_group, mime_type); } - total_received_bytes_ += data_used; - total_original_received_bytes_ += original_size; } void DataReductionProxyNetworkDelegate::RecordContentLength(
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate.h b/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate.h index f0b9a322..41fc92d 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate.h +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate.h
@@ -21,10 +21,6 @@ class GURL; -namespace base { -class Value; -} - namespace net { class HttpRequestHeaders; class NetworkDelegate; @@ -80,9 +76,6 @@ DataReductionProxyIOData* io_data, DataReductionProxyBypassStats* bypass_stats); - // Creates a base::Value summary of the state of the network session. - std::unique_ptr<base::Value> SessionNetworkStatsInfoToValue() const; - void SetDataUseGroupProvider( std::unique_ptr<DataUseGroupProvider> data_use_group_provider); @@ -162,12 +155,6 @@ net::HttpRequestHeaders* request_headers, const net::URLRequest& request) const; - // Total size of all content that has been received over the network. - int64_t total_received_bytes_; - - // Total original size of all content before it was transferred. - int64_t total_original_received_bytes_; - // All raw Data Reduction Proxy pointers must outlive |this|. DataReductionProxyConfig* data_reduction_proxy_config_;
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate_unittest.cc index e5efb87c..d573dd3 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate_unittest.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate_unittest.cc
@@ -405,14 +405,6 @@ request, data_reduction_proxy_info, proxy_retry_info, headers); } - int64_t total_received_bytes() const { - return GetSessionNetworkStatsInfoInt64("session_received_content_length"); - } - - int64_t total_original_received_bytes() const { - return GetSessionNetworkStatsInfoInt64("session_original_content_length"); - } - net::MockClientSocketFactory* mock_socket_factory() { return &mock_socket_factory_; } @@ -438,23 +430,6 @@ TestLoFiDecider* lofi_decider() const { return lofi_decider_; } private: - int64_t GetSessionNetworkStatsInfoInt64(const char* key) const { - const DataReductionProxyNetworkDelegate* drp_network_delegate = - reinterpret_cast<const DataReductionProxyNetworkDelegate*>( - context_.network_delegate()); - - std::unique_ptr<base::DictionaryValue> session_network_stats_info = - base::DictionaryValue::From( - drp_network_delegate->SessionNetworkStatsInfoToValue()); - EXPECT_TRUE(session_network_stats_info); - - std::string string_value; - EXPECT_TRUE(session_network_stats_info->GetString(key, &string_value)); - int64_t value = 0; - EXPECT_TRUE(base::StringToInt64(string_value, &value)); - return value; - } - base::MessageLoopForIO message_loop_; net::MockClientSocketFactory mock_socket_factory_; std::unique_ptr<net::ProxyService> proxy_service_;
diff --git a/components/grpc_support/bidirectional_stream_unittest.cc b/components/grpc_support/bidirectional_stream_unittest.cc index 3ef83ff..84e5cb6 100644 --- a/components/grpc_support/bidirectional_stream_unittest.cc +++ b/components/grpc_support/bidirectional_stream_unittest.cc
@@ -555,7 +555,8 @@ "POST", &kTestHeadersArray, false); test.BlockForDone(); ASSERT_EQ(TestBidirectionalStreamCallback::ON_FAILED, test.response_step); - ASSERT_EQ(net::ERR_QUIC_PROTOCOL_ERROR, test.net_error); + ASSERT_TRUE(test.net_error == net::ERR_QUIC_PROTOCOL_ERROR || + test.net_error == net::ERR_CONNECTION_REFUSED); bidirectional_stream_destroy(test.stream); }
diff --git a/content/browser/accessibility/accessibility_ui.cc b/content/browser/accessibility/accessibility_ui.cc index a8b077a..2d409c6 100644 --- a/content/browser/accessibility/accessibility_ui.cc +++ b/content/browser/accessibility/accessibility_ui.cc
@@ -204,8 +204,10 @@ html_source->SetRequestFilter( base::Bind(&HandleRequestCallback, web_ui->GetWebContents()->GetBrowserContext())); - html_source->DisableI18nAndUseGzipForAllPaths(); - html_source->ExcludePathFromGzip(kDataFile); + + std::unordered_set<std::string> exclude_from_gzip; + exclude_from_gzip.insert(kDataFile); + html_source->UseGzip(exclude_from_gzip); BrowserContext* browser_context = web_ui->GetWebContents()->GetBrowserContext();
diff --git a/content/browser/appcache/appcache_internals_ui.cc b/content/browser/appcache/appcache_internals_ui.cc index 5ed1fe5..89913ca 100644 --- a/content/browser/appcache/appcache_internals_ui.cc +++ b/content/browser/appcache/appcache_internals_ui.cc
@@ -351,7 +351,7 @@ source->AddResourcePath("appcache_internals.js", IDR_APPCACHE_INTERNALS_JS); source->AddResourcePath("appcache_internals.css", IDR_APPCACHE_INTERNALS_CSS); source->SetDefaultResource(IDR_APPCACHE_INTERNALS_HTML); - source->DisableI18nAndUseGzipForAllPaths(); + source->UseGzip(std::unordered_set<std::string>()); WebUIDataSource::Add(browser_context(), source);
diff --git a/content/browser/compositor/software_output_device_win.cc b/content/browser/compositor/software_output_device_win.cc index 2edf325..fd74052 100644 --- a/content/browser/compositor/software_output_device_win.cc +++ b/content/browser/compositor/software_output_device_win.cc
@@ -139,7 +139,7 @@ } } if (can_create_contents) { - contents_ = skia::CreatePlatformCanvas( + contents_ = skia::CreatePlatformCanvasWithSharedSection( viewport_pixel_size_.width(), viewport_pixel_size_.height(), true, shared_section, skia::CRASH_ON_FAILURE); }
diff --git a/content/browser/gpu/gpu_internals_ui.cc b/content/browser/gpu/gpu_internals_ui.cc index 17d924e..793a39c6 100644 --- a/content/browser/gpu/gpu_internals_ui.cc +++ b/content/browser/gpu/gpu_internals_ui.cc
@@ -64,7 +64,7 @@ source->SetJsonPath("strings.js"); source->AddResourcePath("gpu_internals.js", IDR_GPU_INTERNALS_JS); source->SetDefaultResource(IDR_GPU_INTERNALS_HTML); - source->DisableI18nAndUseGzipForAllPaths(); + source->UseGzip(std::unordered_set<std::string>()); return source; }
diff --git a/content/browser/indexed_db/indexed_db_internals_ui.cc b/content/browser/indexed_db/indexed_db_internals_ui.cc index a6e0d7c..c98d88c 100644 --- a/content/browser/indexed_db/indexed_db_internals_ui.cc +++ b/content/browser/indexed_db/indexed_db_internals_ui.cc
@@ -68,7 +68,7 @@ source->AddResourcePath("indexeddb_internals.css", IDR_INDEXED_DB_INTERNALS_CSS); source->SetDefaultResource(IDR_INDEXED_DB_INTERNALS_HTML); - source->DisableI18nAndUseGzipForAllPaths(); + source->UseGzip(std::unordered_set<std::string>()); BrowserContext* browser_context = web_ui->GetWebContents()->GetBrowserContext();
diff --git a/content/browser/media/media_internals_ui.cc b/content/browser/media/media_internals_ui.cc index f85a35c..0e048c0 100644 --- a/content/browser/media/media_internals_ui.cc +++ b/content/browser/media/media_internals_ui.cc
@@ -24,7 +24,7 @@ source->AddResourcePath("media_internals.js", IDR_MEDIA_INTERNALS_JS); source->SetDefaultResource(IDR_MEDIA_INTERNALS_HTML); - source->DisableI18nAndUseGzipForAllPaths(); + source->UseGzip(std::unordered_set<std::string>()); return source; }
diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm index d7c05d3..4f9fa204 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac.mm +++ b/content/browser/renderer_host/render_widget_host_view_mac.mm
@@ -1011,8 +1011,9 @@ GetTextInputManager()->GetTextSelection(focused_view); base::string16 text; - if (selection->GetSelectedText(&text)) - selected_text_ = base::UTF16ToUTF8(text); + if (!selection->GetSelectedText(&text)) + return; + selected_text_ = base::UTF16ToUTF8(text); [cocoa_view_ setSelectedRange:selection->range.ToNSRange()]; // Updates markedRange when there is no marked text so that retrieving
diff --git a/content/browser/renderer_host/render_widget_host_view_mac_unittest.mm b/content/browser/renderer_host/render_widget_host_view_mac_unittest.mm index 5f533ea..a5838a4 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac_unittest.mm +++ b/content/browser/renderer_host/render_widget_host_view_mac_unittest.mm
@@ -305,6 +305,8 @@ RenderWidgetHostView* old_rwhv_; protected: + std::string selected_text() const { return rwhv_mac_->selected_text_; } + RenderWidgetHostViewMac* rwhv_mac_; base::scoped_nsobject<RenderWidgetHostViewCocoa> rwhv_cocoa_; @@ -1328,6 +1330,28 @@ host->ShutdownAndDestroyWidget(true); } +// This test verifies that |selected_text_| is updated accordingly with +// different variations of RWHVMac::SelectChanged updates. +TEST_F(RenderWidgetHostViewMacTest, SelectedText) { + base::string16 sample_text; + base::UTF8ToUTF16("hello world!", 12, &sample_text); + gfx::Range range(6, 11); + + // Send a valid selection for the word 'World'. + rwhv_mac_->SelectionChanged(sample_text, 0U, range); + EXPECT_EQ("world", selected_text()); + + // Make the range cover some of the text and extend more. + range.set_end(100); + rwhv_mac_->SelectionChanged(sample_text, 0U, range); + EXPECT_EQ("world!", selected_text()); + + // Finally, send an empty range. This should clear the selected text. + range.set_start(100); + rwhv_mac_->SelectionChanged(sample_text, 0U, range); + EXPECT_EQ("", selected_text()); +} + // This class is used for IME-related unit tests which verify correctness of IME // for pages with multiple RWHVs. class InputMethodMacTest : public RenderWidgetHostViewMacTest {
diff --git a/content/browser/renderer_host/text_input_manager.cc b/content/browser/renderer_host/text_input_manager.cc index 16897f8..dc7e1b6b 100644 --- a/content/browser/renderer_host/text_input_manager.cc +++ b/content/browser/renderer_host/text_input_manager.cc
@@ -329,14 +329,13 @@ bool TextInputManager::TextSelection::GetSelectedText( base::string16* selected_text) const { if (text.empty() || range.is_empty()) - return false; + return true; size_t pos = range.GetMin() - offset; size_t n = range.length(); if (pos + n > text.length()) { LOG(WARNING) << "The text can not fully cover range (selection's end point " "exceeds text length)."; - return false; } if (pos >= text.length()) {
diff --git a/content/browser/service_worker/service_worker_internals_ui.cc b/content/browser/service_worker/service_worker_internals_ui.cc index ed8ddda..f4b2249 100644 --- a/content/browser/service_worker/service_worker_internals_ui.cc +++ b/content/browser/service_worker/service_worker_internals_ui.cc
@@ -349,7 +349,7 @@ IDR_SERVICE_WORKER_INTERNALS_CSS); source->SetDefaultResource(IDR_SERVICE_WORKER_INTERNALS_HTML); source->DisableDenyXFrameOptions(); - source->DisableI18nAndUseGzipForAllPaths(); + source->UseGzip(std::unordered_set<std::string>()); BrowserContext* browser_context = web_ui->GetWebContents()->GetBrowserContext();
diff --git a/content/browser/webrtc/webrtc_internals_ui.cc b/content/browser/webrtc/webrtc_internals_ui.cc index 9f0d8303..f1c1813 100644 --- a/content/browser/webrtc/webrtc_internals_ui.cc +++ b/content/browser/webrtc/webrtc_internals_ui.cc
@@ -21,7 +21,7 @@ source->SetJsonPath("strings.js"); source->AddResourcePath("webrtc_internals.js", IDR_WEBRTC_INTERNALS_JS); source->SetDefaultResource(IDR_WEBRTC_INTERNALS_HTML); - source->DisableI18nAndUseGzipForAllPaths(); + source->UseGzip(std::unordered_set<std::string>()); return source; }
diff --git a/content/browser/webui/web_ui_data_source_impl.cc b/content/browser/webui/web_ui_data_source_impl.cc index e923236b..a5751c48 100644 --- a/content/browser/webui/web_ui_data_source_impl.cc +++ b/content/browser/webui/web_ui_data_source_impl.cc
@@ -88,7 +88,7 @@ return parent_->deny_xframe_options_; } bool IsGzipped(const std::string& path) const override { - return parent_->use_gzip_for_all_paths_ && + return parent_->use_gzip_ && parent_->excluded_paths_.find(path) == parent_->excluded_paths_.end(); } @@ -107,7 +107,7 @@ deny_xframe_options_(true), add_load_time_data_defaults_(true), replace_existing_source_(true), - use_gzip_for_all_paths_(false) {} + use_gzip_(false) {} WebUIDataSourceImpl::~WebUIDataSourceImpl() { } @@ -165,7 +165,7 @@ DCHECK(!path.empty()); json_path_ = path; - ExcludePathFromGzip(json_path_); + excluded_paths_.insert(json_path_); } void WebUIDataSourceImpl::AddResourcePath(const std::string &path, @@ -186,10 +186,6 @@ replace_existing_source_ = false; } -void WebUIDataSourceImpl::ExcludePathFromGzip(const std::string& path) { - excluded_paths_.insert(path); -} - bool WebUIDataSourceImpl::IsWebUIDataSourceImpl() const { return true; } @@ -220,8 +216,11 @@ deny_xframe_options_ = false; } -void WebUIDataSourceImpl::DisableI18nAndUseGzipForAllPaths() { - use_gzip_for_all_paths_ = true; +void WebUIDataSourceImpl::UseGzip( + const std::unordered_set<std::string>& excluded_paths) { + use_gzip_ = true; + for (const auto& path : excluded_paths) + excluded_paths_.insert(path); } const ui::TemplateReplacements* WebUIDataSourceImpl::GetReplacements() const {
diff --git a/content/browser/webui/web_ui_data_source_impl.h b/content/browser/webui/web_ui_data_source_impl.h index b92363e..2ef7552f 100644 --- a/content/browser/webui/web_ui_data_source_impl.h +++ b/content/browser/webui/web_ui_data_source_impl.h
@@ -9,7 +9,6 @@ #include <map> #include <string> -#include <unordered_set> #include "base/callback.h" #include "base/compiler_specific.h" @@ -49,15 +48,12 @@ void OverrideContentSecurityPolicyObjectSrc(const std::string& data) override; void OverrideContentSecurityPolicyChildSrc(const std::string& data) override; void DisableDenyXFrameOptions() override; - void DisableI18nAndUseGzipForAllPaths() override; + void UseGzip(const std::unordered_set<std::string>& excluded_paths) override; const ui::TemplateReplacements* GetReplacements() const override; // Add the locale to the load time data defaults. May be called repeatedly. void EnsureLoadTimeDataDefaultsAdded(); - // When DisableI18nAndUseGzipForAllPaths is enabled, exclude the given |path|. - void ExcludePathFromGzip(const std::string& path); - bool IsWebUIDataSourceImpl() const override; protected: @@ -116,7 +112,7 @@ bool deny_xframe_options_; bool add_load_time_data_defaults_; bool replace_existing_source_; - bool use_gzip_for_all_paths_; + bool use_gzip_; DISALLOW_COPY_AND_ASSIGN(WebUIDataSourceImpl); };
diff --git a/content/public/android/java/src/org/chromium/content/browser/SelectionPopupController.java b/content/public/android/java/src/org/chromium/content/browser/SelectionPopupController.java index 92e96c0..6c3e698 100644 --- a/content/public/android/java/src/org/chromium/content/browser/SelectionPopupController.java +++ b/content/public/android/java/src/org/chromium/content/browser/SelectionPopupController.java
@@ -200,15 +200,19 @@ return true; } - assert mWebContents != null; - ActionMode actionMode = supportsFloatingActionMode() - ? startFloatingActionMode() - : mView.startActionMode(mCallback); - if (actionMode != null) { - // This is to work around an LGE email issue. See crbug.com/651706 for more details. - LGEmailActionModeWorkaround.runIfNecessary(mContext, actionMode); + if (mView.getParent() != null) { + // On ICS, startActionMode throws an NPE when getParent() is null. + assert mWebContents != null; + ActionMode actionMode = supportsFloatingActionMode() + ? startFloatingActionMode() + : mView.startActionMode(mCallback); + if (actionMode != null) { + // This is to work around an LGE email issue. See crbug.com/651706 for more details. + LGEmailActionModeWorkaround.runIfNecessary(mContext, actionMode); + } + mActionMode = actionMode; } - mActionMode = actionMode; + mUnselectAllOnDismiss = true; return isActionModeValid(); }
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeChildFrameTest.java b/content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeChildFrameTest.java index 245e83a..4abc0c12 100644 --- a/content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeChildFrameTest.java +++ b/content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeChildFrameTest.java
@@ -119,8 +119,6 @@ // of them gets removed. @SmallTest @Feature({"AndroidWebView", "Android-JavaBridge"}) - @DisabledTest(message = "crbug.com/673300") - @RetryOnFailure public void testRemovingTransientObjectHolders() throws Throwable { class Test { private Object mInner = new Object();
diff --git a/content/public/browser/web_ui_data_source.h b/content/public/browser/web_ui_data_source.h index bf2db3b..228245ac 100644 --- a/content/public/browser/web_ui_data_source.h +++ b/content/public/browser/web_ui_data_source.h
@@ -8,6 +8,8 @@ #include <stdint.h> #include <memory> +#include <string> +#include <unordered_set> #include "base/callback.h" #include "base/strings/string16.h" @@ -105,9 +107,10 @@ const std::string& data) = 0; virtual void DisableDenyXFrameOptions() = 0; - // Tells the loading code that resources are gzipped on disk. TODO(dbeam): - // write a streaming $i18n{} replacer and remove the "DisableI18n" part. - virtual void DisableI18nAndUseGzipForAllPaths() = 0; + // Tells the loading code that resources are gzipped on disk. |excluded_paths| + // are uncompressed paths, and therefore should not be decompressed. + virtual void UseGzip(const std::unordered_set<std::string>& excluded_paths) + = 0; }; } // namespace content
diff --git a/docs/clang_tool_refactoring.md b/docs/clang_tool_refactoring.md index 6e22a1b..40a8dae 100644 --- a/docs/clang_tool_refactoring.md +++ b/docs/clang_tool_refactoring.md
@@ -22,7 +22,6 @@ Other minor issues: * Requires a git checkout. -* Requires [some hacks to run on Windows](https://codereview.chromium.org/718873004). ## Prerequisites @@ -117,7 +116,15 @@ that are generated as part of the build: ```shell -ninja -C out/Debug +ninja -C out/Debug # For non-Windows +ninja -d keeprsp -C out/Debug # For Windows +``` + +On Windows, generate the compile DB first, and after making any source changes. +Then omit the `--generate-compdb` in later steps. + +```shell +tools/clang/scripts/generate_win_compdb.py out/Debug ``` Then run the actual tool:
diff --git a/docs/ios_build_instructions.md b/docs/ios_build_instructions.md index 7c8ab1fd..b23138d1 100644 --- a/docs/ios_build_instructions.md +++ b/docs/ios_build_instructions.md
@@ -7,7 +7,6 @@ Are you a Google employee? See [go/building-chrome](https://goto.google.com/building-chrome) instead. -Google employee? See [go/building-chrome](https://goto.google.com/building-chrome) instead. [TOC]
diff --git a/gpu/ipc/common/BUILD.gn b/gpu/ipc/common/BUILD.gn index dd653934..396041e 100644 --- a/gpu/ipc/common/BUILD.gn +++ b/gpu/ipc/common/BUILD.gn
@@ -141,6 +141,7 @@ "capabilities.mojom", "dx_diag_node.mojom", "gpu_info.mojom", + "gpu_preferences.mojom", "mailbox.mojom", "mailbox_holder.mojom", "surface_handle.mojom",
diff --git a/gpu/ipc/common/gpu_preferences.mojom b/gpu/ipc/common/gpu_preferences.mojom new file mode 100644 index 0000000..e1565ec7 --- /dev/null +++ b/gpu/ipc/common/gpu_preferences.mojom
@@ -0,0 +1,53 @@ +// Copyright 2016 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. + +// gpu/command_buffer/service/gpu_preferences.h +module gpu.mojom; + +// gpu::GpuPreferences::VpxDecodeVendors +enum VpxDecodeVendors { + VPX_VENDOR_NONE = 0, + VPX_VENDOR_MICROSOFT = 1, + VPX_VENDOR_AMD = 2, + VPX_VENDOR_ALL = 3, +}; + +// gpu::GpuPreferences +struct GpuPreferences { + bool single_process; + bool in_process_gpu; + bool ui_prioritize_in_gpu_process; + bool disable_accelerated_video_decode; + + bool disable_vaapi_accelerated_video_encode; + + bool disable_web_rtc_hw_encoding; + + VpxDecodeVendors enable_accelerated_vpx_decode; + bool enable_low_latency_dxva; + bool enable_zero_copy_dxgi_video; + bool enable_nv12_dxgi_video; + + bool compile_shader_always_succeeds; + bool disable_gl_error_limit; + bool disable_glsl_translator; + bool disable_gpu_driver_bug_workarounds; + bool disable_shader_name_hashing; + bool enable_gpu_command_logging; + bool enable_gpu_debugging; + bool enable_gpu_service_logging_gpu; + bool enable_gpu_driver_debug_logging; + bool disable_gpu_program_cache; + bool enforce_gl_minimums; + uint32 force_gpu_mem_available; + uint32 gpu_program_cache_size; + bool disable_gpu_shader_disk_cache; + bool enable_threaded_texture_mailboxes; + bool gl_shader_interm_output; + bool emulate_shader_precision; + bool enable_gpu_service_logging; + bool enable_gpu_service_tracing; + bool enable_es3_apis; + bool use_passthrough_cmd_decoder; +};
diff --git a/gpu/ipc/common/gpu_preferences.typemap b/gpu/ipc/common/gpu_preferences.typemap new file mode 100644 index 0000000..0dfa902 --- /dev/null +++ b/gpu/ipc/common/gpu_preferences.typemap
@@ -0,0 +1,16 @@ +# Copyright 2016 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. + +mojom = "//gpu/ipc/common/gpu_preferences.mojom" +public_headers = [ "//gpu/command_buffer/service/gpu_preferences.h" ] +traits_headers = [ "//gpu/ipc/common/gpu_preferences_struct_traits.h" ] +public_deps = [ + "//gpu/command_buffer/service", + "//media:media_features", + "//mojo/common:struct_traits", +] +type_mappings = [ + "gpu.mojom.GpuPreferences=gpu::GpuPreferences", + "gpu.mojom.VpxDecodeVendors=gpu::GpuPreferences::VpxDecodeVendors", +]
diff --git a/gpu/ipc/common/gpu_preferences_struct_traits.h b/gpu/ipc/common/gpu_preferences_struct_traits.h new file mode 100644 index 0000000..0f2a121e --- /dev/null +++ b/gpu/ipc/common/gpu_preferences_struct_traits.h
@@ -0,0 +1,238 @@ +// Copyright 2016 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 GPU_IPC_COMMON_GPU_PREFERENCES_STRUCT_TRAITS_H_ +#define GPU_IPC_COMMON_GPU_PREFERENCES_STRUCT_TRAITS_H_ + +#include "gpu/ipc/common/gpu_preferences.mojom.h" + +namespace mojo { + +template <> +struct EnumTraits<gpu::mojom::VpxDecodeVendors, + gpu::GpuPreferences::VpxDecodeVendors> { + static gpu::mojom::VpxDecodeVendors ToMojom( + gpu::GpuPreferences::VpxDecodeVendors vpx) { + switch (vpx) { + case gpu::GpuPreferences::VPX_VENDOR_NONE: + return gpu::mojom::VpxDecodeVendors::VPX_VENDOR_NONE; + case gpu::GpuPreferences::VPX_VENDOR_MICROSOFT: + return gpu::mojom::VpxDecodeVendors::VPX_VENDOR_MICROSOFT; + case gpu::GpuPreferences::VPX_VENDOR_AMD: + return gpu::mojom::VpxDecodeVendors::VPX_VENDOR_AMD; + case gpu::GpuPreferences::VPX_VENDOR_ALL: + return gpu::mojom::VpxDecodeVendors::VPX_VENDOR_ALL; + } + NOTREACHED(); + return gpu::mojom::VpxDecodeVendors::VPX_VENDOR_NONE; + } + + static bool FromMojom(gpu::mojom::VpxDecodeVendors input, + gpu::GpuPreferences::VpxDecodeVendors* out) { + switch (input) { + case gpu::mojom::VpxDecodeVendors::VPX_VENDOR_NONE: + *out = gpu::GpuPreferences::VPX_VENDOR_NONE; + return true; + case gpu::mojom::VpxDecodeVendors::VPX_VENDOR_MICROSOFT: + *out = gpu::GpuPreferences::VPX_VENDOR_MICROSOFT; + return true; + case gpu::mojom::VpxDecodeVendors::VPX_VENDOR_AMD: + *out = gpu::GpuPreferences::VPX_VENDOR_AMD; + return true; + case gpu::mojom::VpxDecodeVendors::VPX_VENDOR_ALL: + *out = gpu::GpuPreferences::VPX_VENDOR_ALL; + return true; + } + return false; + } +}; + +template <> +struct StructTraits<gpu::mojom::GpuPreferencesDataView, gpu::GpuPreferences> { + static bool Read(gpu::mojom::GpuPreferencesDataView prefs, + gpu::GpuPreferences* out) { + out->single_process = prefs.single_process(); + out->in_process_gpu = prefs.in_process_gpu(); + out->ui_prioritize_in_gpu_process = prefs.ui_prioritize_in_gpu_process(); + out->disable_accelerated_video_decode = + prefs.disable_accelerated_video_decode(); + +#if defined(OS_CHROMEOS) + out->disable_vaapi_accelerated_video_encode = + prefs.disable_vaapi_accelerated_video_encode(); +#endif + +#if BUILDFLAG(ENABLE_WEBRTC) + out->disable_web_rtc_hw_encoding = prefs.disable_web_rtc_hw_encoding(); +#endif + +#if defined(OS_WIN) + if (!prefs.ReadEnableAcceleratedVpxDecode( + &out->enable_accelerated_vpx_decode)) + return false; + out->enable_low_latency_dxva = prefs.enable_low_latency_dxva(); + out->enable_zero_copy_dxgi_video = prefs.enable_zero_copy_dxgi_video(); + out->enable_nv12_dxgi_video = prefs.enable_nv12_dxgi_video(); +#endif + + out->compile_shader_always_succeeds = + prefs.compile_shader_always_succeeds(); + out->disable_gl_error_limit = prefs.disable_gl_error_limit(); + out->disable_glsl_translator = prefs.disable_glsl_translator(); + out->disable_gpu_driver_bug_workarounds = + prefs.disable_gpu_driver_bug_workarounds(); + out->disable_shader_name_hashing = prefs.disable_shader_name_hashing(); + out->enable_gpu_command_logging = prefs.enable_gpu_command_logging(); + out->enable_gpu_debugging = prefs.enable_gpu_debugging(); + out->enable_gpu_service_logging_gpu = + prefs.enable_gpu_service_logging_gpu(); + out->enable_gpu_driver_debug_logging = + prefs.enable_gpu_driver_debug_logging(); + out->disable_gpu_program_cache = prefs.disable_gpu_program_cache(); + out->enforce_gl_minimums = prefs.enforce_gl_minimums(); + out->force_gpu_mem_available = prefs.force_gpu_mem_available(); + out->gpu_program_cache_size = prefs.gpu_program_cache_size(); + out->disable_gpu_shader_disk_cache = prefs.disable_gpu_shader_disk_cache(); + out->enable_threaded_texture_mailboxes = + prefs.enable_threaded_texture_mailboxes(); + out->gl_shader_interm_output = prefs.gl_shader_interm_output(); + out->emulate_shader_precision = prefs.emulate_shader_precision(); + out->enable_gpu_service_logging = prefs.enable_gpu_service_logging(); + out->enable_gpu_service_tracing = prefs.enable_gpu_service_tracing(); + out->enable_es3_apis = prefs.enable_es3_apis(); + out->use_passthrough_cmd_decoder = prefs.use_passthrough_cmd_decoder(); + return true; + } + + static bool single_process(const gpu::GpuPreferences& prefs) { + return prefs.single_process; + } + static bool in_process_gpu(const gpu::GpuPreferences& prefs) { + return prefs.in_process_gpu; + } + static bool ui_prioritize_in_gpu_process(const gpu::GpuPreferences& prefs) { + return prefs.ui_prioritize_in_gpu_process; + } + static bool disable_accelerated_video_decode( + const gpu::GpuPreferences& prefs) { + return prefs.disable_accelerated_video_decode; + } + + static bool disable_vaapi_accelerated_video_encode( + const gpu::GpuPreferences& prefs) { +#if defined(OS_CHROMEOS) + return prefs.disable_vaapi_accelerated_video_encode; +#else + return false; +#endif + } + + static bool disable_web_rtc_hw_encoding(const gpu::GpuPreferences& prefs) { +#if BUILDFLAG(ENABLE_WEBRTC) + return prefs.disable_web_rtc_hw_encoding; +#else + return false; +#endif + } + + static gpu::GpuPreferences::VpxDecodeVendors enable_accelerated_vpx_decode( + const gpu::GpuPreferences& prefs) { +#if defined(OS_WIN) + return prefs.enable_accelerated_vpx_decode; +#else + return gpu::GpuPreferences::VPX_VENDOR_MICROSOFT; +#endif + } + static bool enable_low_latency_dxva(const gpu::GpuPreferences& prefs) { +#if defined(OS_WIN) + return prefs.enable_low_latency_dxva; +#else + return false; +#endif + } + static bool enable_zero_copy_dxgi_video(const gpu::GpuPreferences& prefs) { +#if defined(OS_WIN) + return prefs.enable_zero_copy_dxgi_video; +#else + return false; +#endif + } + static bool enable_nv12_dxgi_video(const gpu::GpuPreferences& prefs) { +#if defined(OS_WIN) + return prefs.enable_nv12_dxgi_video; +#else + return false; +#endif + } + static bool compile_shader_always_succeeds(const gpu::GpuPreferences& prefs) { + return prefs.compile_shader_always_succeeds; + } + static bool disable_gl_error_limit(const gpu::GpuPreferences& prefs) { + return prefs.disable_gl_error_limit; + } + static bool disable_glsl_translator(const gpu::GpuPreferences& prefs) { + return prefs.disable_glsl_translator; + } + static bool disable_gpu_driver_bug_workarounds( + const gpu::GpuPreferences& prefs) { + return prefs.disable_gpu_driver_bug_workarounds; + } + static bool disable_shader_name_hashing(const gpu::GpuPreferences& prefs) { + return prefs.disable_shader_name_hashing; + } + static bool enable_gpu_command_logging(const gpu::GpuPreferences& prefs) { + return prefs.enable_gpu_command_logging; + } + static bool enable_gpu_debugging(const gpu::GpuPreferences& prefs) { + return prefs.enable_gpu_debugging; + } + static bool enable_gpu_service_logging_gpu(const gpu::GpuPreferences& prefs) { + return prefs.enable_gpu_service_logging_gpu; + } + static bool enable_gpu_driver_debug_logging( + const gpu::GpuPreferences& prefs) { + return prefs.enable_gpu_driver_debug_logging; + } + static bool disable_gpu_program_cache(const gpu::GpuPreferences& prefs) { + return prefs.disable_gpu_program_cache; + } + static bool enforce_gl_minimums(const gpu::GpuPreferences& prefs) { + return prefs.enforce_gl_minimums; + } + static uint32_t force_gpu_mem_available(const gpu::GpuPreferences& prefs) { + return prefs.force_gpu_mem_available; + } + static uint32_t gpu_program_cache_size(const gpu::GpuPreferences& prefs) { + return prefs.gpu_program_cache_size; + } + static bool disable_gpu_shader_disk_cache(const gpu::GpuPreferences& prefs) { + return prefs.disable_gpu_shader_disk_cache; + } + static bool enable_threaded_texture_mailboxes( + const gpu::GpuPreferences& prefs) { + return prefs.enable_threaded_texture_mailboxes; + } + static bool gl_shader_interm_output(const gpu::GpuPreferences& prefs) { + return prefs.gl_shader_interm_output; + } + static bool emulate_shader_precision(const gpu::GpuPreferences& prefs) { + return prefs.emulate_shader_precision; + } + static bool enable_gpu_service_logging(const gpu::GpuPreferences& prefs) { + return prefs.enable_gpu_service_logging; + } + static bool enable_gpu_service_tracing(const gpu::GpuPreferences& prefs) { + return prefs.enable_gpu_service_tracing; + } + static bool enable_es3_apis(const gpu::GpuPreferences& prefs) { + return prefs.enable_es3_apis; + } + static bool use_passthrough_cmd_decoder(const gpu::GpuPreferences& prefs) { + return prefs.use_passthrough_cmd_decoder; + } +}; + +} // namespace mojo + +#endif // GPU_IPC_COMMON_GPU_PREFERENCES_STRUCT_TRAITS_H_
diff --git a/gpu/ipc/common/struct_traits_unittest.cc b/gpu/ipc/common/struct_traits_unittest.cc index f77dcdb..2223921 100644 --- a/gpu/ipc/common/struct_traits_unittest.cc +++ b/gpu/ipc/common/struct_traits_unittest.cc
@@ -74,6 +74,11 @@ callback.Run(v); } + void EchoGpuPreferences(const GpuPreferences& prefs, + const EchoGpuPreferencesCallback& callback) override { + callback.Run(prefs); + } + base::MessageLoop loop_; mojo::BindingSet<TraitsTestService> traits_test_bindings_; @@ -423,4 +428,28 @@ EXPECT_EQ(max_framerate_denominator, output.max_framerate_denominator); } +TEST_F(StructTraitsTest, GpuPreferences) { + GpuPreferences prefs; + prefs.single_process = true; + prefs.in_process_gpu = true; + prefs.ui_prioritize_in_gpu_process = true; +#if defined(OS_WIN) + const GpuPreferences::VpxDecodeVendors vendor = + GpuPreferences::VPX_VENDOR_AMD; + prefs.enable_accelerated_vpx_decode = vendor; +#endif + prefs.enable_gpu_driver_debug_logging = true; + + mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy(); + GpuPreferences echo; + proxy->EchoGpuPreferences(prefs, &echo); + EXPECT_TRUE(echo.single_process); + EXPECT_TRUE(echo.in_process_gpu); + EXPECT_TRUE(echo.ui_prioritize_in_gpu_process); + EXPECT_TRUE(echo.enable_gpu_driver_debug_logging); +#if defined(OS_WIN) + EXPECT_EQ(vendor, echo.enable_accelerated_vpx_decode); +#endif +} + } // namespace gpu
diff --git a/gpu/ipc/common/traits_test_service.mojom b/gpu/ipc/common/traits_test_service.mojom index bd7a961..f2d911d3 100644 --- a/gpu/ipc/common/traits_test_service.mojom +++ b/gpu/ipc/common/traits_test_service.mojom
@@ -6,6 +6,7 @@ import "gpu/ipc/common/dx_diag_node.mojom"; import "gpu/ipc/common/gpu_info.mojom"; +import "gpu/ipc/common/gpu_preferences.mojom"; import "gpu/ipc/common/mailbox.mojom"; import "gpu/ipc/common/mailbox_holder.mojom"; import "gpu/ipc/common/sync_token.mojom"; @@ -46,4 +47,7 @@ EchoVideoEncodeAcceleratorSupportedProfile( VideoEncodeAcceleratorSupportedProfile v) => (VideoEncodeAcceleratorSupportedProfile pass); + + [Sync] + EchoGpuPreferences(GpuPreferences prefs) => (GpuPreferences pass); };
diff --git a/gpu/ipc/common/typemaps.gni b/gpu/ipc/common/typemaps.gni index 5f353e0a2..23acc1f 100644 --- a/gpu/ipc/common/typemaps.gni +++ b/gpu/ipc/common/typemaps.gni
@@ -5,6 +5,7 @@ typemaps = [ "//gpu/ipc/common/capabilities.typemap", "//gpu/ipc/common/gpu_info.typemap", + "//gpu/ipc/common/gpu_preferences.typemap", "//gpu/ipc/common/dx_diag_node.typemap", "//gpu/ipc/common/mailbox.typemap", "//gpu/ipc/common/mailbox_holder.typemap",
diff --git a/ios/chrome/app/application_delegate/url_opener_unittest.mm b/ios/chrome/app/application_delegate/url_opener_unittest.mm index 60ff610..481213c 100644 --- a/ios/chrome/app/application_delegate/url_opener_unittest.mm +++ b/ios/chrome/app/application_delegate/url_opener_unittest.mm
@@ -182,19 +182,22 @@ } TEST_F(URLOpenerTest, HandleOpenURLWithOpenTabs) { - // The URL should be routed to the main BVC; the OTR BVC shouldn't get calls. NSURL* url = [NSURL URLWithString:@"chromium://www.google.com"]; - id otrBVCMock = [OCMockObject mockForClass:[BrowserViewController class]]; - base::scoped_nsobject<id> bvcMock([[URLOpenerMockBVC alloc] init]); - TestChromeBrowserState::Builder mainBrowserStateBuilder; + base::scoped_nsobject<URLOpenerMockBVC> bvc_mock( + [[URLOpenerMockBVC alloc] init]); + base::scoped_nsobject<URLOpenerMockBVC> otr_bvc_mock( + [[URLOpenerMockBVC alloc] init]); + TestChromeBrowserState::Builder main_browser_state_builder; std::unique_ptr<TestChromeBrowserState> chrome_browser_state = - mainBrowserStateBuilder.Build(); - ((URLOpenerMockBVC*)bvcMock).browserState = chrome_browser_state.get(); + main_browser_state_builder.Build(); + bvc_mock.get().browserState = chrome_browser_state.get(); // Setup main controller. MainController* controller = GetMainController(); - controller.browserViewInformation.mainBVC = bvcMock; - controller.browserViewInformation.otrBVC = otrBVCMock; + controller.browserViewInformation.mainBVC = + static_cast<BrowserViewController*>(bvc_mock.get()); + controller.browserViewInformation.otrBVC = + static_cast<BrowserViewController*>(otr_bvc_mock.get()); NSDictionary<NSString*, id>* options = nil; [URLOpener openURL:url @@ -203,13 +206,12 @@ tabOpener:controller startupInformation:controller]; - EXPECT_EQ(GURL("http://www.google.com/"), - [(URLOpenerMockBVC*)bvcMock tabURL]); - EXPECT_EQ(NSNotFound, - static_cast<NSInteger>([(URLOpenerMockBVC*)bvcMock position])); - EXPECT_TRUE(PageTransitionCoreTypeIs([(URLOpenerMockBVC*)bvcMock transition], + EXPECT_EQ(GURL("http://www.google.com/"), [bvc_mock tabURL]); + EXPECT_EQ(NSNotFound, static_cast<NSInteger>([bvc_mock position])); + EXPECT_TRUE(PageTransitionCoreTypeIs([bvc_mock transition], ui::PAGE_TRANSITION_LINK)); - EXPECT_OCMOCK_VERIFY(otrBVCMock); + + EXPECT_FALSE([otr_bvc_mock tabURL].is_valid()); } TEST_F(URLOpenerTest, HandleOpenURL) {
diff --git a/ios/chrome/app/main_controller.mm b/ios/chrome/app/main_controller.mm index a2ac1bc..ccd1cbd 100644 --- a/ios/chrome/app/main_controller.mm +++ b/ios/chrome/app/main_controller.mm
@@ -400,8 +400,9 @@ // Disables browsing and purges web views if |enabled| is NO. // Must be called only on the main thread. - (void)setWebUsageEnabled:(BOOL)enabled; -// Activates self.currentBVC iff the self.currentBVC can be made active. -- (void)activateCurrentBVC; +// Activates |mainBVC| and |otrBVC| and sets |currentBVC| as primary iff +// |currentBVC| can be made active. +- (void)activateBVCAndMakeCurrentBVCPrimary; // Sets |currentBVC| as the root view controller for the window. - (void)displayCurrentBVC; // Shows the settings UI. @@ -840,12 +841,13 @@ ios::ChromeBrowserState* otrBrowserState = _mainBrowserState->GetOffTheRecordChromeBrowserState(); int removeAllMask = ~0; + void (^completion)() = ^{ + [self activateBVCAndMakeCurrentBVCPrimary]; + }; [self.browsingDataRemovalController removeIOSSpecificIncognitoBrowsingDataFromBrowserState:otrBrowserState mask:removeAllMask - completionHandler:^{ - [self activateCurrentBVC]; - }]; + completionHandler:completion]; } - (void)deleteIncognitoBrowserState { @@ -868,7 +870,7 @@ deleteIncognitoTabModelState:self.browsingDataRemovalController]; if (otrBVCIsCurrent) { - [self activateCurrentBVC]; + [self activateBVCAndMakeCurrentBVCPrimary]; } // Always set the new otr tab model on iPad with tab switcher enabled. @@ -888,18 +890,21 @@ - (void)setWebUsageEnabled:(BOOL)enabled { DCHECK([NSThread isMainThread]); if (enabled) { - [self activateCurrentBVC]; + [self activateBVCAndMakeCurrentBVCPrimary]; } else { - [self.currentBVC setActive:enabled]; + [self.mainBVC setActive:NO]; + [self.otrBVC setActive:NO]; } } -- (void)activateCurrentBVC { +- (void)activateBVCAndMakeCurrentBVCPrimary { // If there are pending removal operations, the activation will be deferred // until the callback for |removeBrowsingDataFromBrowserState:| is received. if (![self.browsingDataRemovalController hasPendingRemovalOperations:self.currentBrowserState]) { - [self.currentBVC setActive:YES]; + [self.mainBVC setActive:YES]; + [self.otrBVC setActive:YES]; + [self.currentBVC setPrimary:YES]; } } @@ -1738,7 +1743,7 @@ [self displayCurrentBVC]; // Tell the BVC that was made current that it can use the web. - [self activateCurrentBVC]; + [self activateBVCAndMakeCurrentBVCPrimary]; } #pragma mark - Tab closure handlers @@ -2045,8 +2050,7 @@ completionHandler:(ProceduralBlock)completionHandler { // TODO(crbug.com/632772): Remove web usage disabling once // https://bugs.webkit.org/show_bug.cgi?id=149079 has been fixed. - if (browserState == self.currentBrowserState && - (mask & IOSChromeBrowsingDataRemover::REMOVE_COOKIES)) { + if (mask & IOSChromeBrowsingDataRemover::REMOVE_SITE_DATA) { [self setWebUsageEnabled:NO]; }
diff --git a/ios/chrome/browser/ui/history/BUILD.gn b/ios/chrome/browser/ui/history/BUILD.gn index ba1c361c..31702128 100644 --- a/ios/chrome/browser/ui/history/BUILD.gn +++ b/ios/chrome/browser/ui/history/BUILD.gn
@@ -158,11 +158,17 @@ "//components/prefs", "//components/strings", "//ios/chrome/app/strings", + "//ios/chrome/browser", "//ios/chrome/browser/browser_state", "//ios/chrome/browser/ui/history", "//ios/chrome/browser/ui/settings", + "//ios/chrome/browser/ui/tools_menu", + "//ios/chrome/browser/ui/util", + "//ios/chrome/common", "//ios/chrome/test/app:test_support", "//ios/chrome/test/earl_grey:test_support", + "//ios/public/provider/chrome/browser/signin:signin", + "//ios/public/provider/chrome/browser/signin:test_support", "//ios/testing:ios_test_support", "//ios/third_party/earl_grey", "//ios/web:test_support",
diff --git a/ios/chrome/browser/ui/history/history_collection_view_controller.mm b/ios/chrome/browser/ui/history/history_collection_view_controller.mm index efa969a..b394babf 100644 --- a/ios/chrome/browser/ui/history/history_collection_view_controller.mm +++ b/ios/chrome/browser/ui/history/history_collection_view_controller.mm
@@ -100,7 +100,7 @@ // YES if there are no more history entries to load. @property(nonatomic, assign, getter=hasFinishedLoading) BOOL finishedLoading; // YES if the collection should be filtered by the next received query result. -@property(nonatomic, assign) BOOL filterForNextQueryResult; +@property(nonatomic, assign) BOOL filterQueryResult; // Fetches history prior to |time| for search text |query|. If |query| is nil or // the empty string, all history is fetched. @@ -141,7 +141,7 @@ _shouldShowNoticeAboutOtherFormsOfBrowsingHistory; @synthesize loading = _loading; @synthesize finishedLoading = _finishedLoading; -@synthesize filterForNextQueryResult = _filterForNextQueryResult; +@synthesize filterQueryResult = _filterQueryResult; - (instancetype)initWithLoader:(id<UrlLoader>)loader browserState:(ios::ChromeBrowserState*)browserState @@ -246,7 +246,7 @@ - (void)historyEntriesStatusItem:(HistoryEntriesStatusItem*)item didRequestOpenURL:(const GURL&)URL { - [self openURL:URL]; + [self openURLInNewTab:URL]; } #pragma mark - HistoryEntryInserterDelegate @@ -355,7 +355,7 @@ // loading indicator removal will not be observed. [self updateEntriesStatusMessage]; - __block base::scoped_nsobject<NSMutableArray> searchResults( + __block base::scoped_nsobject<NSMutableArray> filterResults( [[NSMutableArray array] retain]); __block base::scoped_nsobject<NSString> searchQuery( [base::SysUTF16ToNSString(result.query) copy]); @@ -369,8 +369,8 @@ browserState:_browserState delegate:self] autorelease]; [self.entryInserter insertHistoryEntryItem:item]; - if ([self isSearching]) { - [searchResults addObject:item]; + if ([self isSearching] || self.filterQueryResult) { + [filterResults addObject:item]; } } [self.delegate historyCollectionViewControllerDidChangeEntries:self]; @@ -378,11 +378,11 @@ completion:^(BOOL) { if (([self isSearching] && [searchQuery length] > 0 && [self.currentQuery isEqualToString:searchQuery]) || - self.filterForNextQueryResult) { + self.filterQueryResult) { // If in search mode, filter out entries that are not // part of the search result. - [self filterForHistoryEntries:searchResults]; - self.filterForNextQueryResult = NO; + [self filterForHistoryEntries:filterResults]; + self.filterQueryResult = NO; } }]; } @@ -390,6 +390,10 @@ - (void)historyServiceFacade:(HistoryServiceFacade*)facade shouldShowNoticeAboutOtherFormsOfBrowsingHistory:(BOOL)shouldShowNotice { self.shouldShowNoticeAboutOtherFormsOfBrowsingHistory = shouldShowNotice; + // Update the history entries status message if there is no query in progress. + if (!self.isLoading) { + [self updateEntriesStatusMessage]; + } } - (void)historyServiceFacadeDidObserveHistoryDeletion: @@ -397,7 +401,7 @@ // If history has been deleted, reload history filtering for the current // results. This only observes local changes to history, i.e. removing // history via the clear browsing data page. - self.filterForNextQueryResult = YES; + self.filterQueryResult = YES; [self showHistoryMatchingQuery:nil]; }
diff --git a/ios/chrome/browser/ui/history/history_ui_egtest.mm b/ios/chrome/browser/ui/history/history_ui_egtest.mm index 79819ea9..9a64de07 100644 --- a/ios/chrome/browser/ui/history/history_ui_egtest.mm +++ b/ios/chrome/browser/ui/history/history_ui_egtest.mm
@@ -11,8 +11,14 @@ #include "components/prefs/pref_service.h" #include "components/strings/grit/components_strings.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" +#include "ios/chrome/browser/chrome_url_constants.h" #import "ios/chrome/browser/ui/history/history_entry_item.h" #import "ios/chrome/browser/ui/settings/clear_browsing_data_collection_view_controller.h" +#import "ios/chrome/browser/ui/settings/settings_collection_view_controller.h" +#import "ios/chrome/browser/ui/tools_menu/tools_menu_view_controller.h" +#import "ios/chrome/browser/ui/tools_menu/tools_popup_controller.h" +#import "ios/chrome/browser/ui/util/transparent_link_button.h" +#include "ios/chrome/common/string_util.h" #include "ios/chrome/grit/ios_strings.h" #import "ios/chrome/test/app/chrome_test_util.h" #import "ios/chrome/test/earl_grey/accessibility_util.h" @@ -21,6 +27,9 @@ #import "ios/chrome/test/earl_grey/chrome_earl_grey_ui.h" #import "ios/chrome/test/earl_grey/chrome_matchers.h" #import "ios/chrome/test/earl_grey/chrome_test_case.h" +#import "ios/public/provider/chrome/browser/signin/chrome_identity.h" +#import "ios/public/provider/chrome/browser/signin/fake_chrome_identity.h" +#import "ios/public/provider/chrome/browser/signin/fake_chrome_identity_service.h" #import "ios/testing/wait_util.h" #import "ios/web/public/test/http_server.h" #import "ios/web/public/test/http_server_util.h" @@ -107,6 +116,43 @@ return buttonWithAccessibilityLabelId(IDS_IOS_CLEAR_BUTTON); } +// Sign in with a mock identity. +void MockSignIn() { + // Set up a mock identity. + ChromeIdentity* identity = + [FakeChromeIdentity identityWithEmail:@"foo@gmail.com" + gaiaID:@"fooID" + name:@"Fake Foo"]; + ios::FakeChromeIdentityService::GetInstanceFromChromeProvider()->AddIdentity( + identity); + + [ChromeEarlGreyUI openToolsMenu]; + [[[EarlGrey + selectElementWithMatcher:grey_accessibilityID(kToolsMenuSettingsId)] + usingSearchAction:grey_scrollToContentEdge(kGREYContentEdgeBottom) + onElementWithMatcher:grey_accessibilityID(kToolsMenuTableViewId)] + performAction:grey_tap()]; + + [[EarlGrey + selectElementWithMatcher:grey_accessibilityID(kSettingsSignInCellId)] + performAction:grey_tap()]; + [[EarlGrey + selectElementWithMatcher:chrome_test_util::buttonWithAccessibilityLabel( + identity.userEmail)] + performAction:grey_tap()]; + [[EarlGrey selectElementWithMatcher: + chrome_test_util::buttonWithAccessibilityLabelId( + IDS_IOS_ACCOUNT_CONSISTENCY_SETUP_SIGNIN_BUTTON)] + performAction:grey_tap()]; + [[EarlGrey selectElementWithMatcher: + chrome_test_util::buttonWithAccessibilityLabelId( + IDS_IOS_ACCOUNT_CONSISTENCY_CONFIRMATION_OK_BUTTON)] + performAction:grey_tap()]; + [[EarlGrey + selectElementWithMatcher:chrome_test_util::buttonWithAccessibilityLabelId( + IDS_IOS_NAVIGATION_BAR_DONE_BUTTON)] + performAction:grey_tap()]; +} } // namespace // History UI tests. @@ -198,6 +244,41 @@ assertWithMatcher:grey_notNil()]; } +// Test that history displays a message about entries only if the user is logged +// in, and that tapping on the link in the message opens a new tab with the sync +// help page. +- (void)testHistoryEntriesStatusCell { + [self loadTestURLs]; + [self openHistoryPanel]; + // Assert that no message is shown when the user is not signed in. + NSRange range; + NSString* entriesMessage = ParseStringWithLink( + l10n_util::GetNSString(IDS_IOS_HISTORY_NO_SYNCED_RESULTS), &range); + [[EarlGrey selectElementWithMatcher:grey_text(entriesMessage)] + assertWithMatcher:grey_nil()]; + [[EarlGrey selectElementWithMatcher:navigationDoneButton()] + performAction:grey_tap()]; + + // Sign in and assert that the page indicates what type of history entries + // are shown. + MockSignIn(); + [self openHistoryPanel]; + // Assert that message about entries is shown. The "history is showing local + // entries" message will be shown because sync is not set up for this test. + [[EarlGrey selectElementWithMatcher:grey_text(entriesMessage)] + assertWithMatcher:grey_notNil()]; + + // Tap on "Learn more" link and assert that new tab with the link is opened. + [[EarlGrey + selectElementWithMatcher:grey_kindOfClass([TransparentLinkButton class])] + performAction:grey_tap()]; + chrome_test_util::AssertMainTabCount(2); + id<GREYMatcher> webViewMatcher = chrome_test_util::webViewContainingText( + "Sync and view tabs and history across devices"); + [[EarlGrey selectElementWithMatcher:webViewMatcher] + assertWithMatcher:grey_notNil()]; +} + // Tests that searching history displays only entries matching the search term. - (void)testSearchHistory { [self loadTestURLs];
diff --git a/ios/web/shell/Info.plist b/ios/web/shell/Info.plist index 5638f86b..d1c6ccf 100644 --- a/ios/web/shell/Info.plist +++ b/ios/web/shell/Info.plist
@@ -29,6 +29,8 @@ <key>NSAllowsArbitraryLoads</key> <true/> </dict> + <key>UIFileSharingEnabled</key> + <true/> <key>UIRequiredDeviceCapabilities</key> <array> <string>armv7</string>
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/interface_declaration.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/interface_declaration.tmpl index c8298d9..a90d8ac 100644 --- a/mojo/public/tools/bindings/generators/cpp_templates/interface_declaration.tmpl +++ b/mojo/public/tools/bindings/generators/cpp_templates/interface_declaration.tmpl
@@ -29,6 +29,13 @@ using ResponseValidator_ = mojo::PassThroughFilter; {%- endif %} +{#--- Metadata #} + enum MethodMinVersions : uint32_t { +{%- for method in interface.methods %} + k{{method.name}}MinVersion = {{method.min_version|default(0, true)}}, +{%- endfor %} + }; + {#--- Enums #} {%- for enum in interface.enums %} using {{enum.name}} = {{enum|get_name_for_kind(flatten_nested_kind=True)}};
diff --git a/net/cert/ev_root_ca_metadata.cc b/net/cert/ev_root_ca_metadata.cc index 1370f17..c77192a 100644 --- a/net/cert/ev_root_ca_metadata.cc +++ b/net/cert/ev_root_ca_metadata.cc
@@ -114,6 +114,34 @@ 0x55, 0x6c, 0x11, 0xa4, 0x37, 0xca, 0xeb, 0xff, 0xc3, 0xbb}}, {"1.3.6.1.4.1.34697.2.4", ""}, }, + // Amazon Root CA 1 + // https://good.sca1a.amazontrust.com/ + { + {{0x8d, 0xa7, 0xf9, 0x65, 0xec, 0x5e, 0xfc, 0x37, 0x91, 0x0f, + 0x1c, 0x6e, 0x59, 0xfd, 0xc1, 0xcc, 0x6a, 0x6e, 0xde, 0x16}}, + {"2.23.140.1.1", ""}, + }, + // Amazon Root CA 2 + // https://good.sca2a.amazontrust.com/ + { + {{0x5a, 0x8c, 0xef, 0x45, 0xd7, 0xa6, 0x98, 0x59, 0x76, 0x7a, + 0x8c, 0x8b, 0x44, 0x96, 0xb5, 0x78, 0xcf, 0x47, 0x4b, 0x1a}}, + {"2.23.140.1.1", ""}, + }, + // Amazon Root CA 3 + // https://good.sca3a.amazontrust.com/ + { + {{0x0d, 0x44, 0xdd, 0x8c, 0x3c, 0x8c, 0x1a, 0x1a, 0x58, 0x75, + 0x64, 0x81, 0xe9, 0x0f, 0x2e, 0x2a, 0xff, 0xb3, 0xd2, 0x6e}}, + {"2.23.140.1.1", ""}, + }, + // Amazon Root CA 4 + // https://good.sca4a.amazontrust.com/ + { + {{0xf6, 0x10, 0x84, 0x07, 0xd6, 0xf8, 0xbb, 0x67, 0x98, 0x0c, + 0xc2, 0xe2, 0x44, 0xc2, 0xeb, 0xae, 0x1c, 0xef, 0x63, 0xbe}}, + {"2.23.140.1.1", ""}, + }, // Autoridad de Certificacion Firmaprofesional CIF A62634068 // https://publifirma.firmaprofesional.com/ {{{0xae, 0xc5, 0xfb, 0x3f, 0xc8, 0xe1, 0xbf, 0xc4, 0xe5, 0x4f, @@ -168,6 +196,13 @@ 0x06, 0x28, 0xa2, 0x59, 0x3a, 0x19, 0xa7, 0x0f, 0x06, 0x9e}}, {"1.2.616.1.113527.2.5.1.1", ""}, }, + // CFCA EV ROOT + // https://www.erenepu.com/ + { + {{0xe2, 0xb8, 0x29, 0x4b, 0x55, 0x84, 0xab, 0x6b, 0x58, 0xc2, + 0x90, 0x46, 0x6c, 0xac, 0x3f, 0xb8, 0x39, 0x8f, 0x84, 0x83}}, + {"2.16.156.112554.3", ""}, + }, // China Internet Network Information Center EV Certificates Root // https://evdemo.cnnic.cn/ { @@ -239,6 +274,13 @@ 0xdc, 0x37, 0xd4, 0x4d, 0xf5, 0xd4, 0x67, 0x49, 0x52, 0xf9}}, {"2.16.840.1.114028.10.1.2", ""}, }, + // Entrust Root Certification Authority – G2 + // https://validg2.entrust.net + { + {{0x8c, 0xf4, 0x27, 0xfd, 0x79, 0x0c, 0x3a, 0xd1, 0x66, 0x06, + 0x8d, 0xe8, 0x1e, 0x57, 0xef, 0xbb, 0x93, 0x22, 0x72, 0xd4}}, + {"2.16.840.1.114028.10.1.2", ""}, + }, // Equifax Secure Certificate Authority (GeoTrust) // https://www.geotrust.com/ { @@ -343,6 +385,13 @@ 0x3f, 0xf8, 0xbc, 0xf8, 0x15, 0xb0, 0x82, 0xf9, 0xae, 0xfd}}, {"1.3.6.1.4.1.14777.6.1.1", "1.3.6.1.4.1.14777.6.1.2"}, }, + // LuxTrust Global Root 2 + // https://ltsslca5.trustme.lu/ + { + {{0x1e, 0x0e, 0x56, 0x19, 0x0a, 0xd1, 0x8b, 0x25, 0x98, 0xb2, + 0x04, 0x44, 0xff, 0x66, 0x8a, 0x04, 0x17, 0x99, 0x5f, 0x3f}}, + {"1.3.171.1.1.10.5.2", ""}, + }, // Network Solutions Certificate Authority // https://www.networksolutions.com/website-packages/index.jsp { @@ -358,6 +407,13 @@ 0xc0, 0x71, 0xf8, 0xf7, 0x33, 0xb1, 0x83, 0x85, 0x63, 0x32}}, {"1.3.6.1.4.1.782.1.2.1.8.1", ""}, }, + // OISTE WISeKey Global Root GB CA + // https://goodevssl.wisekey.com + { + {{0x0f, 0xf9, 0x40, 0x76, 0x18, 0xd3, 0xd7, 0x6a, 0x4b, 0x98, + 0xf0, 0xa8, 0x35, 0x9e, 0x0c, 0xfd, 0x27, 0xac, 0xcc, 0xed}}, + {"2.16.756.5.14.7.4.8", ""}, + }, // QuoVadis Root CA 2 // https://www.quovadis.bm/ { @@ -440,7 +496,7 @@ { {{0x92, 0x5a, 0x8f, 0x8d, 0x2c, 0x6d, 0x04, 0xe0, 0x66, 0x5f, 0x59, 0x6a, 0xff, 0x22, 0xd8, 0x63, 0xe8, 0x25, 0x6f, 0x3f}}, - {"2.16.840.1.114414.1.7.24.3", ""}, + {"2.16.840.1.114414.1.7.24.3", "2.23.140.1.1"}, }, // SwissSign Gold CA - G2 // https://testevg2.swisssign.net/
diff --git a/net/cert/ocsp_verify_result.h b/net/cert/ocsp_verify_result.h index a4dc71e..3a0bd7c2 100644 --- a/net/cert/ocsp_verify_result.h +++ b/net/cert/ocsp_verify_result.h
@@ -27,6 +27,9 @@ bool operator==(const OCSPVerifyResult& other) const; enum ResponseStatus { + // OCSP verification was not checked on this connection. + NOT_CHECKED, + // No OCSPResponse was stapled. MISSING, @@ -56,7 +59,7 @@ }; - ResponseStatus response_status = MISSING; + ResponseStatus response_status = NOT_CHECKED; // The strictest CertStatus matching the certificate (REVOKED > UNKNOWN > // GOOD). Only valid if |response_status| = PROVIDED.
diff --git a/net/http/transport_security_state.cc b/net/http/transport_security_state.cc index 9b42feb..ce16cca 100644 --- a/net/http/transport_security_state.cc +++ b/net/http/transport_security_state.cc
@@ -645,6 +645,10 @@ std::string SerializeExpectStapleResponseStatus( OCSPVerifyResult::ResponseStatus status) { switch (status) { + case OCSPVerifyResult::NOT_CHECKED: + // Reports shouldn't be sent for this response status. + NOTREACHED(); + return "NOT_CHECKED"; case OCSPVerifyResult::MISSING: return "MISSING"; case OCSPVerifyResult::PROVIDED: @@ -662,6 +666,7 @@ case OCSPVerifyResult::PARSE_RESPONSE_DATA_ERROR: return "PARSE_RESPONSE_DATA_ERROR"; } + NOTREACHED(); return std::string(); } @@ -803,7 +808,11 @@ if (!GetStaticExpectStapleState(host_port_pair.host(), &expect_staple_state)) return; - // No report needed if a stapled OCSP response was provided. + // No report needed if OCSP details were not checked on this connection. + if (ssl_info.ocsp_result.response_status == OCSPVerifyResult::NOT_CHECKED) + return; + + // No report needed if a stapled OCSP response was provided and it was valid. if (ssl_info.ocsp_result.response_status == OCSPVerifyResult::PROVIDED && ssl_info.ocsp_result.revocation_status == OCSPRevocationStatus::GOOD) { return;
diff --git a/net/quic/chromium/crypto_test_utils_chromium.cc b/net/quic/chromium/crypto_test_utils_chromium.cc index 1e01dc5..8f7f7e1 100644 --- a/net/quic/chromium/crypto_test_utils_chromium.cc +++ b/net/quic/chromium/crypto_test_utils_chromium.cc
@@ -92,8 +92,7 @@ } // static -std::unique_ptr<ProofVerifier> ProofVerifierForTestingInternal( - bool use_real_proof_verifier) { +std::unique_ptr<ProofVerifier> CryptoTestUtils::ProofVerifierForTesting() { // TODO(rch): use a real cert verifier? std::unique_ptr<MockCertVerifier> cert_verifier(new MockCertVerifier()); net::CertVerifyResult verify_result; @@ -105,12 +104,6 @@ GetTestCertsDirectory(), "quic_test_ecc.example.com.crt"); cert_verifier->AddResultForCertAndHost(verify_result.verified_cert.get(), "test.example.com", verify_result, OK); - if (use_real_proof_verifier) { - return base::MakeUnique<TestProofVerifierChromium>( - std::move(cert_verifier), base::WrapUnique(new TransportSecurityState), - base::WrapUnique(new MultiLogCTVerifier), - base::WrapUnique(new CTPolicyEnforcer), "quic_root.crt"); - } return base::MakeUnique<TestProofVerifierChromium>( std::move(cert_verifier), base::WrapUnique(new TransportSecurityState), base::WrapUnique(new MultiLogCTVerifier), @@ -118,16 +111,6 @@ } // static -std::unique_ptr<ProofVerifier> CryptoTestUtils::ProofVerifierForTesting() { - return ProofVerifierForTestingInternal(/*use_real_proof_verifier=*/false); -} - -// static -std::unique_ptr<ProofVerifier> CryptoTestUtils::RealProofVerifierForTesting() { - return ProofVerifierForTestingInternal(/*use_real_proof_verifier=*/true); -} - -// static ProofVerifyContext* CryptoTestUtils::ProofVerifyContextForTesting() { return new ProofVerifyContextChromium(/*cert_verify_flags=*/0, NetLogWithSource());
diff --git a/net/quic/chromium/quic_network_transaction_unittest.cc b/net/quic/chromium/quic_network_transaction_unittest.cc index f55e667..b79bee3 100644 --- a/net/quic/chromium/quic_network_transaction_unittest.cc +++ b/net/quic/chromium/quic_network_transaction_unittest.cc
@@ -2781,7 +2781,7 @@ } TEST_P(QuicNetworkTransactionTest, QuicForceHolBlocking) { - FLAGS_quic_enable_version_36_v3 = true; + FLAGS_quic_reloadable_flag_quic_enable_version_36_v3 = true; params_.quic_force_hol_blocking = true; params_.origins_to_force_quic_on.insert( HostPortPair::FromString("mail.example.org:443"));
diff --git a/net/quic/core/congestion_control/bbr_sender.cc b/net/quic/core/congestion_control/bbr_sender.cc index 3145d03..0d1a0fd5 100644 --- a/net/quic/core/congestion_control/bbr_sender.cc +++ b/net/quic/core/congestion_control/bbr_sender.cc
@@ -99,7 +99,8 @@ recovery_state_(NOT_IN_RECOVERY), end_recovery_at_(0), recovery_window_(max_congestion_window_), - enforce_startup_pacing_rate_increase_(FLAGS_quic_bbr_faster_startup) { + enforce_startup_pacing_rate_increase_( + FLAGS_quic_reloadable_flag_quic_bbr_faster_startup) { EnterStartupMode(); }
diff --git a/net/quic/core/congestion_control/bbr_sender.h b/net/quic/core/congestion_control/bbr_sender.h index ac32949..04b71a2 100644 --- a/net/quic/core/congestion_control/bbr_sender.h +++ b/net/quic/core/congestion_control/bbr_sender.h
@@ -271,7 +271,7 @@ QuicByteCount recovery_window_; // Indicates whether to always only increase the pacing rate during startup. - // Latches |FLAGS_quic_bbr_faster_startup|. + // Latches |FLAGS_quic_reloadable_flag_quic_bbr_faster_startup|. bool enforce_startup_pacing_rate_increase_; DISALLOW_COPY_AND_ASSIGN(BbrSender);
diff --git a/net/quic/core/congestion_control/bbr_sender_test.cc b/net/quic/core/congestion_control/bbr_sender_test.cc index 0079d49..08026e7 100644 --- a/net/quic/core/congestion_control/bbr_sender_test.cc +++ b/net/quic/core/congestion_control/bbr_sender_test.cc
@@ -78,7 +78,7 @@ "BBR sender", Perspective::IS_SERVER, 42) { - FLAGS_quic_bbr_faster_startup = true; + FLAGS_quic_reloadable_flag_quic_bbr_faster_startup = true; rtt_stats_ = bbr_sender_.connection()->sent_packet_manager().GetRttStats(); sender_ = new BbrSender(rtt_stats_,
diff --git a/net/quic/core/congestion_control/cubic.cc b/net/quic/core/congestion_control/cubic.cc index f93f91cc..c19caf3 100644 --- a/net/quic/core/congestion_control/cubic.cc +++ b/net/quic/core/congestion_control/cubic.cc
@@ -124,8 +124,9 @@ QuicTime event_time) { acked_packets_count_ += 1; // Packets acked. epoch_packets_count_ += 1; - QuicTime current_time = - FLAGS_quic_use_event_time ? event_time : clock_->ApproximateNow(); + QuicTime current_time = FLAGS_quic_reloadable_flag_quic_use_event_time + ? event_time + : clock_->ApproximateNow(); // Cubic is "independent" of RTT, the update is limited by the time elapsed. if (last_congestion_window_ == current_congestion_window &&
diff --git a/net/quic/core/congestion_control/cubic_bytes.cc b/net/quic/core/congestion_control/cubic_bytes.cc index d546afc..b39564c 100644 --- a/net/quic/core/congestion_control/cubic_bytes.cc +++ b/net/quic/core/congestion_control/cubic_bytes.cc
@@ -141,8 +141,9 @@ QuicTime::Delta delay_min, QuicTime event_time) { acked_bytes_count_ += acked_bytes; - QuicTime current_time = - FLAGS_quic_use_event_time ? event_time : clock_->ApproximateNow(); + QuicTime current_time = FLAGS_quic_reloadable_flag_quic_use_event_time + ? event_time + : clock_->ApproximateNow(); // Cubic is "independent" of RTT, the update is limited by the time elapsed. if (last_congestion_window_ == current_congestion_window &&
diff --git a/net/quic/core/congestion_control/cubic_bytes_test.cc b/net/quic/core/congestion_control/cubic_bytes_test.cc index 80f6b57..8b70e8f8 100644 --- a/net/quic/core/congestion_control/cubic_bytes_test.cc +++ b/net/quic/core/congestion_control/cubic_bytes_test.cc
@@ -29,9 +29,11 @@ : one_ms_(QuicTime::Delta::FromMilliseconds(1)), hundred_ms_(QuicTime::Delta::FromMilliseconds(100)), cubic_(&clock_) { - cubic_.SetFixConvexMode(FLAGS_quic_fix_cubic_convex_mode); - cubic_.SetFixCubicQuantization(FLAGS_quic_fix_cubic_bytes_quantization); - cubic_.SetFixBetaLastMax(FLAGS_quic_fix_beta_last_max); + cubic_.SetFixConvexMode( + FLAGS_quic_reloadable_flag_quic_fix_cubic_convex_mode); + cubic_.SetFixCubicQuantization( + FLAGS_quic_reloadable_flag_quic_fix_cubic_bytes_quantization); + cubic_.SetFixBetaLastMax(FLAGS_quic_reloadable_flag_quic_fix_beta_last_max); } QuicByteCount RenoCwndInBytes(QuicByteCount current_cwnd) { @@ -52,7 +54,7 @@ const int64_t offset = ((elapsed_time + rtt).ToMicroseconds() << 10) / 1000000; const QuicByteCount delta_congestion_window = - FLAGS_quic_fix_cubic_bytes_quantization + FLAGS_quic_reloadable_flag_quic_fix_cubic_bytes_quantization ? ((410 * offset * offset * offset) * kDefaultTCPMSS >> 40) : ((410 * offset * offset * offset) >> 40) * kDefaultTCPMSS; const QuicByteCount cubic_cwnd = initial_cwnd + delta_congestion_window; @@ -74,7 +76,7 @@ // deploying the fix for convex mode. Once cubic convex is deployed, // replace "AboveOrigin" with this test. TEST_F(CubicBytesTest, AboveOriginWithTighterBounds) { - if (!FLAGS_quic_fix_cubic_convex_mode) { + if (!FLAGS_quic_reloadable_flag_quic_fix_cubic_convex_mode) { // Without convex mode fixed, the behavior of the algorithm is so // far from expected, there's no point in doing a tighter test. return; @@ -97,7 +99,7 @@ // The maximum number of expected Reno RTTs is calculated by // finding the point where the cubic curve and the reno curve meet. const int max_reno_rtts = - FLAGS_quic_fix_cubic_bytes_quantization + FLAGS_quic_reloadable_flag_quic_fix_cubic_bytes_quantization ? std::sqrt(kNConnectionAlpha / (.4 * rtt_min_s * rtt_min_s * rtt_min_s)) - 2 @@ -129,7 +131,7 @@ clock_.AdvanceTime(hundred_ms_); } - if (!FLAGS_quic_fix_cubic_bytes_quantization) { + if (!FLAGS_quic_reloadable_flag_quic_fix_cubic_bytes_quantization) { // Because our byte-wise Reno under-estimates the cwnd, we switch to // conservative increases for a few acks before switching to true // cubic increases. @@ -166,8 +168,8 @@ } TEST_F(CubicBytesTest, AboveOrigin) { - if (!FLAGS_quic_fix_cubic_convex_mode && - FLAGS_quic_fix_cubic_bytes_quantization) { + if (!FLAGS_quic_reloadable_flag_quic_fix_cubic_convex_mode && + FLAGS_quic_reloadable_flag_quic_fix_cubic_bytes_quantization) { // Without convex mode fixed, the behavior of the algorithm does // not fit the exact pattern of this test. // TODO(jokulik): Once the convex mode fix becomes default, this @@ -180,9 +182,10 @@ QuicByteCount current_cwnd = 10 * kDefaultTCPMSS; // Without the signed-integer, cubic-convex fix, we start out in the // wrong mode. - QuicPacketCount expected_cwnd = FLAGS_quic_fix_cubic_convex_mode - ? RenoCwndInBytes(current_cwnd) - : ConservativeCwndInBytes(current_cwnd); + QuicPacketCount expected_cwnd = + FLAGS_quic_reloadable_flag_quic_fix_cubic_convex_mode + ? RenoCwndInBytes(current_cwnd) + : ConservativeCwndInBytes(current_cwnd); // Initialize the state. clock_.AdvanceTime(one_ms_); ASSERT_EQ(expected_cwnd, @@ -203,7 +206,7 @@ clock_.AdvanceTime(hundred_ms_); current_cwnd = cubic_.CongestionWindowAfterAck( kDefaultTCPMSS, current_cwnd, rtt_min, clock_.ApproximateNow()); - if (FLAGS_quic_fix_cubic_convex_mode) { + if (FLAGS_quic_reloadable_flag_quic_fix_cubic_convex_mode) { // When we fix convex mode and the uint64 arithmetic, we // increase the expected_cwnd only after after the first 100ms, // rather than after the initial 1ms. @@ -234,7 +237,7 @@ initial_cwnd / kDefaultTCPMSS + (elapsed_time_s * elapsed_time_s * elapsed_time_s * 410) / 1024; // Without the convex mode fix, the result is off by one. - if (!FLAGS_quic_fix_cubic_convex_mode) { + if (!FLAGS_quic_reloadable_flag_quic_fix_cubic_convex_mode) { ++expected_cwnd; } EXPECT_EQ(expected_cwnd, current_cwnd / kDefaultTCPMSS); @@ -250,8 +253,8 @@ // - Sets an artificially large initial cwnd to prevent Reno from the // convex increases on every ack. TEST_F(CubicBytesTest, AboveOriginFineGrainedCubing) { - if (!FLAGS_quic_fix_cubic_convex_mode || - !FLAGS_quic_fix_cubic_bytes_quantization) { + if (!FLAGS_quic_reloadable_flag_quic_fix_cubic_convex_mode || + !FLAGS_quic_reloadable_flag_quic_fix_cubic_bytes_quantization) { // Without these two fixes, this test cannot pass. return; } @@ -296,9 +299,10 @@ QuicByteCount current_cwnd = 422 * kDefaultTCPMSS; // Without the signed-integer, cubic-convex fix, we mistakenly // increment cwnd after only one_ms_ and a single ack. - QuicPacketCount expected_cwnd = FLAGS_quic_fix_cubic_convex_mode - ? RenoCwndInBytes(current_cwnd) - : current_cwnd + kDefaultTCPMSS / 2; + QuicPacketCount expected_cwnd = + FLAGS_quic_reloadable_flag_quic_fix_cubic_convex_mode + ? RenoCwndInBytes(current_cwnd) + : current_cwnd + kDefaultTCPMSS / 2; // Initialize the state. clock_.AdvanceTime(one_ms_); EXPECT_EQ(expected_cwnd, @@ -326,11 +330,11 @@ current_cwnd = expected_cwnd; EXPECT_GT(pre_loss_cwnd, LastMaxCongestionWindow()); QuicByteCount expected_last_max = - FLAGS_quic_fix_beta_last_max + FLAGS_quic_reloadable_flag_quic_fix_beta_last_max ? static_cast<QuicByteCount>(pre_loss_cwnd * kNConnectionBetaLastMax) : static_cast<QuicByteCount>(pre_loss_cwnd * kBetaLastMax); EXPECT_EQ(expected_last_max, LastMaxCongestionWindow()); - if (FLAGS_quic_fix_beta_last_max) { + if (FLAGS_quic_reloadable_flag_quic_fix_beta_last_max) { EXPECT_LT(expected_cwnd, LastMaxCongestionWindow()); } else { // If we don't scale kLastBetaMax, the current window is exactly @@ -341,7 +345,7 @@ // Simulate an increase, and check that we are below the origin. current_cwnd = cubic_.CongestionWindowAfterAck( kDefaultTCPMSS, current_cwnd, rtt_min, clock_.ApproximateNow()); - if (FLAGS_quic_fix_beta_last_max) { + if (FLAGS_quic_reloadable_flag_quic_fix_beta_last_max) { EXPECT_GT(LastMaxCongestionWindow(), current_cwnd); } else { // Without the bug fix, we will be at or above the origin. @@ -356,7 +360,7 @@ EXPECT_EQ(expected_cwnd, cubic_.CongestionWindowAfterPacketLoss(current_cwnd)); expected_last_max = - FLAGS_quic_fix_beta_last_max + FLAGS_quic_reloadable_flag_quic_fix_beta_last_max ? pre_loss_cwnd : static_cast<QuicByteCount>(pre_loss_cwnd * kBetaLastMax); ASSERT_EQ(expected_last_max, LastMaxCongestionWindow()); @@ -368,9 +372,10 @@ QuicByteCount current_cwnd = 422 * kDefaultTCPMSS; // Without the signed-integer, cubic-convex fix, we mistakenly // increment cwnd after only one_ms_ and a single ack. - QuicPacketCount expected_cwnd = FLAGS_quic_fix_cubic_convex_mode - ? RenoCwndInBytes(current_cwnd) - : current_cwnd + kDefaultTCPMSS / 2; + QuicPacketCount expected_cwnd = + FLAGS_quic_reloadable_flag_quic_fix_cubic_convex_mode + ? RenoCwndInBytes(current_cwnd) + : current_cwnd + kDefaultTCPMSS / 2; // Initialize the state. clock_.AdvanceTime(one_ms_); EXPECT_EQ(expected_cwnd,
diff --git a/net/quic/core/congestion_control/cubic_test.cc b/net/quic/core/congestion_control/cubic_test.cc index 7020b48..c753f1f9 100644 --- a/net/quic/core/congestion_control/cubic_test.cc +++ b/net/quic/core/congestion_control/cubic_test.cc
@@ -33,7 +33,7 @@ cubic_(&clock_) { fix_convex_mode_ = GetParam(); cubic_.SetFixConvexMode(fix_convex_mode_); - cubic_.SetFixBetaLastMax(FLAGS_quic_fix_beta_last_max); + cubic_.SetFixBetaLastMax(FLAGS_quic_reloadable_flag_quic_fix_beta_last_max); } QuicByteCount LastMaxCongestionWindow() { @@ -150,12 +150,12 @@ current_cwnd = expected_cwnd; EXPECT_GT(pre_loss_cwnd, LastMaxCongestionWindow()); QuicByteCount expected_last_max = - FLAGS_quic_fix_beta_last_max + FLAGS_quic_reloadable_flag_quic_fix_beta_last_max ? static_cast<QuicPacketCount>(pre_loss_cwnd * kNConnectionBetaLastMax) : static_cast<QuicPacketCount>(pre_loss_cwnd * kBetaLastMax); EXPECT_EQ(expected_last_max, LastMaxCongestionWindow()); - if (FLAGS_quic_fix_beta_last_max) { + if (FLAGS_quic_reloadable_flag_quic_fix_beta_last_max) { EXPECT_LT(expected_cwnd, LastMaxCongestionWindow()); } else { // If we don't scale kLastBetaMax, the current window is exactly @@ -166,7 +166,7 @@ // Simulate an increase, and check that we are below the origin. current_cwnd = cubic_.CongestionWindowAfterAck(current_cwnd, rtt_min, clock_.ApproximateNow()); - if (FLAGS_quic_fix_beta_last_max) { + if (FLAGS_quic_reloadable_flag_quic_fix_beta_last_max) { EXPECT_GT(LastMaxCongestionWindow(), current_cwnd); } else { // Without the bug fix, we will be at or above the origin.
diff --git a/net/quic/core/congestion_control/general_loss_algorithm.cc b/net/quic/core/congestion_control/general_loss_algorithm.cc index 2694c95..db20db55 100644 --- a/net/quic/core/congestion_control/general_loss_algorithm.cc +++ b/net/quic/core/congestion_control/general_loss_algorithm.cc
@@ -100,7 +100,7 @@ // there are retransmittable packets in flight. // This also implements a timer-protected variant of FACK. if ((!it->retransmittable_frames.empty() && - (FLAGS_quic_largest_sent_retransmittable + (FLAGS_quic_reloadable_flag_quic_largest_sent_retransmittable ? unacked_packets.largest_sent_retransmittable_packet() : unacked_packets.largest_sent_packet()) <= largest_newly_acked) ||
diff --git a/net/quic/core/congestion_control/general_loss_algorithm_test.cc b/net/quic/core/congestion_control/general_loss_algorithm_test.cc index 02bf24f4..4c0c8718 100644 --- a/net/quic/core/congestion_control/general_loss_algorithm_test.cc +++ b/net/quic/core/congestion_control/general_loss_algorithm_test.cc
@@ -193,7 +193,7 @@ } TEST_F(GeneralLossAlgorithmTest, EarlyRetransmitWithLargerUnackablePackets) { - FLAGS_quic_largest_sent_retransmittable = true; + FLAGS_quic_reloadable_flag_quic_largest_sent_retransmittable = true; // Transmit 2 data packets and one ack. SendDataPacket(1); SendDataPacket(2);
diff --git a/net/quic/core/congestion_control/send_algorithm_interface.cc b/net/quic/core/congestion_control/send_algorithm_interface.cc index badfd2b1..ede3c7e 100644 --- a/net/quic/core/congestion_control/send_algorithm_interface.cc +++ b/net/quic/core/congestion_control/send_algorithm_interface.cc
@@ -27,7 +27,7 @@ QuicPacketCount max_congestion_window = kDefaultMaxCongestionWindowPackets; switch (congestion_control_type) { case kBBR: - if (FLAGS_quic_allow_new_bbr) { + if (FLAGS_quic_reloadable_flag_quic_allow_new_bbr) { return new BbrSender(rtt_stats, unacked_packets, initial_congestion_window, max_congestion_window, random);
diff --git a/net/quic/core/congestion_control/send_algorithm_test.cc b/net/quic/core/congestion_control/send_algorithm_test.cc index c5e5324..f93100a7 100644 --- a/net/quic/core/congestion_control/send_algorithm_test.cc +++ b/net/quic/core/congestion_control/send_algorithm_test.cc
@@ -186,16 +186,16 @@ void SetExperimentalOptionsInServerConfig() { QuicConfig client_config; QuicTagVector options; - if (FLAGS_quic_fix_cubic_convex_mode) { + if (FLAGS_quic_reloadable_flag_quic_fix_cubic_convex_mode) { options.push_back(kCCVX); } - if (FLAGS_quic_fix_cubic_convex_mode && - FLAGS_quic_fix_cubic_bytes_quantization) { + if (FLAGS_quic_reloadable_flag_quic_fix_cubic_convex_mode && + FLAGS_quic_reloadable_flag_quic_fix_cubic_bytes_quantization) { options.push_back(kCCVX); options.push_back(kCBQT); } - if (FLAGS_quic_fix_beta_last_max) { + if (FLAGS_quic_reloadable_flag_quic_fix_beta_last_max) { options.push_back(kBLMX); }
diff --git a/net/quic/core/congestion_control/tcp_cubic_sender_bytes.cc b/net/quic/core/congestion_control/tcp_cubic_sender_bytes.cc index 8499143..851718c 100644 --- a/net/quic/core/congestion_control/tcp_cubic_sender_bytes.cc +++ b/net/quic/core/congestion_control/tcp_cubic_sender_bytes.cc
@@ -47,17 +47,18 @@ void TcpCubicSenderBytes::SetFromConfig(const QuicConfig& config, Perspective perspective) { TcpCubicSenderBase::SetFromConfig(config, perspective); - if (FLAGS_quic_fix_cubic_convex_mode && + if (FLAGS_quic_reloadable_flag_quic_fix_cubic_convex_mode && config.HasReceivedConnectionOptions() && ContainsQuicTag(config.ReceivedConnectionOptions(), kCCVX)) { cubic_.SetFixConvexMode(true); } - if (FLAGS_quic_fix_cubic_bytes_quantization && + if (FLAGS_quic_reloadable_flag_quic_fix_cubic_bytes_quantization && config.HasReceivedConnectionOptions() && ContainsQuicTag(config.ReceivedConnectionOptions(), kCBQT)) { cubic_.SetFixCubicQuantization(true); } - if (FLAGS_quic_fix_beta_last_max && config.HasReceivedConnectionOptions() && + if (FLAGS_quic_reloadable_flag_quic_fix_beta_last_max && + config.HasReceivedConnectionOptions() && ContainsQuicTag(config.ReceivedConnectionOptions(), kBLMX)) { cubic_.SetFixBetaLastMax(true); }
diff --git a/net/quic/core/congestion_control/tcp_cubic_sender_packets.cc b/net/quic/core/congestion_control/tcp_cubic_sender_packets.cc index 7089a5b..b4f579ad2 100644 --- a/net/quic/core/congestion_control/tcp_cubic_sender_packets.cc +++ b/net/quic/core/congestion_control/tcp_cubic_sender_packets.cc
@@ -44,12 +44,13 @@ void TcpCubicSenderPackets::SetFromConfig(const QuicConfig& config, Perspective perspective) { TcpCubicSenderBase::SetFromConfig(config, perspective); - if (FLAGS_quic_fix_cubic_convex_mode && + if (FLAGS_quic_reloadable_flag_quic_fix_cubic_convex_mode && config.HasReceivedConnectionOptions() && ContainsQuicTag(config.ReceivedConnectionOptions(), kCCVX)) { cubic_.SetFixConvexMode(true); } - if (FLAGS_quic_fix_beta_last_max && config.HasReceivedConnectionOptions() && + if (FLAGS_quic_reloadable_flag_quic_fix_beta_last_max && + config.HasReceivedConnectionOptions() && ContainsQuicTag(config.ReceivedConnectionOptions(), kBLMX)) { cubic_.SetFixBetaLastMax(true); }
diff --git a/net/quic/core/crypto/aead_base_encrypter.cc b/net/quic/core/crypto/aead_base_encrypter.cc index b6916b9..3d8c24e 100644 --- a/net/quic/core/crypto/aead_base_encrypter.cc +++ b/net/quic/core/crypto/aead_base_encrypter.cc
@@ -6,6 +6,7 @@ #include <string> +#include "net/quic/core/quic_types.h" #include "net/quic/core/quic_utils.h" #include "third_party/boringssl/src/include/openssl/err.h" #include "third_party/boringssl/src/include/openssl/evp.h" @@ -83,9 +84,7 @@ StringPiece associated_data, StringPiece plaintext, unsigned char* output) { - if (nonce.size() != nonce_prefix_size_ + sizeof(QuicPacketNumber)) { - return false; - } + DCHECK_EQ(nonce.size(), nonce_prefix_size_ + sizeof(QuicPacketNumber)); size_t ciphertext_len; if (!EVP_AEAD_CTX_seal( @@ -117,7 +116,7 @@ // TODO(ianswett): Introduce a check to ensure that we don't encrypt with the // same packet number twice. const size_t nonce_size = nonce_prefix_size_ + sizeof(packet_number); - ALIGNAS(4) char nonce_buffer[kMaxNonceSize]; + QUIC_ALIGNED(4) char nonce_buffer[kMaxNonceSize]; memcpy(nonce_buffer, nonce_prefix_, nonce_prefix_size_); uint64_t path_id_packet_number = QuicUtils::PackPathIdAndPacketNumber(path_id, packet_number);
diff --git a/net/quic/core/crypto/crypto_framer.cc b/net/quic/core/crypto/crypto_framer.cc index c24c72db..73b567a0 100644 --- a/net/quic/core/crypto/crypto_framer.cc +++ b/net/quic/core/crypto/crypto_framer.cc
@@ -4,12 +4,11 @@ #include "net/quic/core/crypto/crypto_framer.h" -#include <memory> - #include "base/strings/stringprintf.h" #include "net/quic/core/crypto/crypto_protocol.h" #include "net/quic/core/quic_data_reader.h" #include "net/quic/core/quic_data_writer.h" +#include "net/quic/core/quic_packets.h" using base::StringPiece;
diff --git a/net/quic/core/crypto/crypto_framer.h b/net/quic/core/crypto/crypto_framer.h index 2ed2f32..bd316fd 100644 --- a/net/quic/core/crypto/crypto_framer.h +++ b/net/quic/core/crypto/crypto_framer.h
@@ -7,6 +7,7 @@ #include <cstddef> #include <cstdint> +#include <memory> #include <utility> #include <vector>
diff --git a/net/quic/core/crypto/crypto_protocol.h b/net/quic/core/crypto/crypto_protocol.h index 8ea145e..e426832 100644 --- a/net/quic/core/crypto/crypto_protocol.h +++ b/net/quic/core/crypto/crypto_protocol.h
@@ -116,12 +116,10 @@ // Retransmissions. const QuicTag kLFAK = TAG('L', 'F', 'A', 'K'); // Don't invoke FACK on the // first ack. - // TODO(fayang): Remove this connection option in QUIC_VERSION_37, in which // MAX_HEADER_LIST_SIZE settings frame should be supported. const QuicTag kSMHL = TAG('S', 'M', 'H', 'L'); // Support MAX_HEADER_LIST_SIZE // settings frame. - const QuicTag kCCVX = TAG('C', 'C', 'V', 'X'); // Fix Cubic convex bug. const QuicTag kCBQT = TAG('C', 'B', 'Q', 'T'); // Fix CubicBytes quantization. const QuicTag kBLMX = TAG('B', 'L', 'M', 'X'); // Fix Cubic BetaLastMax bug.
diff --git a/net/quic/core/crypto/crypto_server_test.cc b/net/quic/core/crypto/crypto_server_test.cc index 5d0e30c..cac8d6b 100644 --- a/net/quic/core/crypto/crypto_server_test.cc +++ b/net/quic/core/crypto/crypto_server_test.cc
@@ -118,7 +118,7 @@ client_version_string_ = QuicTagToString(QuicVersionToQuicTag(client_version_)); - FLAGS_enable_quic_stateless_reject_support = + FLAGS_quic_reloadable_flag_enable_quic_stateless_reject_support = GetParam().enable_stateless_rejects; use_stateless_rejects_ = GetParam().use_stateless_rejects; }
diff --git a/net/quic/core/crypto/curve25519_key_exchange.cc b/net/quic/core/crypto/curve25519_key_exchange.cc index d2e0082..ecbcd21 100644 --- a/net/quic/core/crypto/curve25519_key_exchange.cc +++ b/net/quic/core/crypto/curve25519_key_exchange.cc
@@ -25,6 +25,7 @@ // We don't want to #include the BoringSSL headers in the public header file, // so we use literals for the sizes of private_key_ and public_key_. Here we // assert that those values are equal to the values from the BoringSSL + // header. static_assert(sizeof(ka->private_key_) == X25519_PRIVATE_KEY_LEN, "header out of sync"); static_assert(sizeof(ka->public_key_) == X25519_PUBLIC_VALUE_LEN,
diff --git a/net/quic/core/crypto/null_decrypter.cc b/net/quic/core/crypto/null_decrypter.cc index b6e7e538..0178335f 100644 --- a/net/quic/core/crypto/null_decrypter.cc +++ b/net/quic/core/crypto/null_decrypter.cc
@@ -6,6 +6,7 @@ #include <cstdint> +#include "net/base/int128.h" #include "net/quic/core/quic_bug_tracker.h" #include "net/quic/core/quic_data_reader.h" #include "net/quic/core/quic_utils.h" @@ -87,9 +88,7 @@ if (!reader->ReadUInt64(&lo) || !reader->ReadUInt32(&hi)) { return false; } - *hash = hi; - *hash <<= 64; - *hash += lo; + *hash = MakeUint128(hi, lo); return true; }
diff --git a/net/quic/core/crypto/quic_compressed_certs_cache_test.cc b/net/quic/core/crypto/quic_compressed_certs_cache_test.cc index 0b61b95e..7757364 100644 --- a/net/quic/core/crypto/quic_compressed_certs_cache_test.cc +++ b/net/quic/core/crypto/quic_compressed_certs_cache_test.cc
@@ -49,6 +49,7 @@ std::vector<string> certs = {"leaf cert", "intermediate cert", "root cert"}; QuicReferenceCountedPointer<ProofSource::Chain> chain( new ProofSource::Chain(certs)); + string common_certs = "common certs"; string cached_certs = "cached certs"; string compressed = "compressed cert";
diff --git a/net/quic/core/crypto/quic_crypto_client_config.cc b/net/quic/core/crypto/quic_crypto_client_config.cc index 7a71f259..e13ec71d 100644 --- a/net/quic/core/crypto/quic_crypto_client_config.cc +++ b/net/quic/core/crypto/quic_crypto_client_config.cc
@@ -24,9 +24,9 @@ #include "net/quic/core/crypto/quic_encrypter.h" #include "net/quic/core/crypto/quic_random.h" #include "net/quic/core/quic_bug_tracker.h" -#include "net/quic/core/quic_flags.h" #include "net/quic/core/quic_utils.h" +using base::ContainsKey; using base::StringPiece; using std::string; @@ -962,7 +962,7 @@ QuicServerId suffix_server_id(canonical_suffixes_[i], server_id.port(), server_id.privacy_mode()); - if (!base::ContainsKey(canonical_server_map_, suffix_server_id)) { + if (!ContainsKey(canonical_server_map_, suffix_server_id)) { // This is the first host we've seen which matches the suffix, so make it // canonical. canonical_server_map_[suffix_server_id] = server_id;
diff --git a/net/quic/core/crypto/quic_crypto_server_config.cc b/net/quic/core/crypto/quic_crypto_server_config.cc index 1e30ff3..95782da25 100644 --- a/net/quic/core/crypto/quic_crypto_server_config.cc +++ b/net/quic/core/crypto/quic_crypto_server_config.cc
@@ -689,7 +689,7 @@ if (client_hello.GetTaglist(kCOPT, &tag_ptr, &num_tags) == QUIC_NO_ERROR) { connection_options.assign(tag_ptr, tag_ptr + num_tags); } - if (FLAGS_enable_async_get_proof) { + if (FLAGS_quic_reloadable_flag_enable_async_get_proof) { std::unique_ptr<ProcessClientHelloCallback> cb( new ProcessClientHelloCallback( this, validate_chlo_result, reject_only, connection_id, @@ -773,7 +773,7 @@ use_stateless_rejects, server_designated_connection_id, rand, compressed_certs_cache, params, *signed_config, total_framing_overhead, chlo_packet_size, out.get()); - if (FLAGS_quic_export_rej_for_all_rejects && + if (FLAGS_quic_reloadable_flag_quic_export_rej_for_all_rejects && rejection_observer_ != nullptr) { rejection_observer_->OnRejectionBuilt(info.reject_reasons, out.get()); } @@ -998,7 +998,7 @@ out->SetVector(kVER, supported_version_tags); out->SetStringPiece( kSourceAddressTokenTag, - NewSourceAddressToken(*requested_config.get(), info.source_address_tokens, + NewSourceAddressToken(*requested_config, info.source_address_tokens, client_address.host(), rand, info.now, nullptr)); QuicSocketAddressCoder address_coder(client_address); out->SetStringPiece(kCADR, address_coder.Encode()); @@ -1055,7 +1055,7 @@ } if (configs.empty()) { - if (primary_config_.get()) { + if (primary_config_ != nullptr) { QUIC_BUG << "No valid QUIC server config. Keeping the current config."; } else { QUIC_BUG << "No valid QUIC server config."; @@ -1213,7 +1213,8 @@ HandshakeFailureReason source_address_token_error = MAX_FAILURE_REASON; StringPiece srct; if (client_hello.GetStringPiece(kSourceAddressTokenTag, &srct)) { - Config& config = requested_config ? *requested_config : *primary_config; + Config& config = + requested_config != nullptr ? *requested_config : *primary_config; source_address_token_error = ParseSourceAddressToken(config, srct, &info->source_address_tokens); @@ -1266,7 +1267,7 @@ if (client_hello.GetTaglist(kCOPT, &tag_ptr, &num_tags) == QUIC_NO_ERROR) { connection_options.assign(tag_ptr, tag_ptr + num_tags); } - if (FLAGS_enable_async_get_proof) { + if (FLAGS_quic_reloadable_flag_enable_async_get_proof) { if (need_proof) { // Make an async call to GetProof and setup the callback to trampoline // back into EvaluateClientHelloAfterGetProof @@ -1342,7 +1343,8 @@ DVLOG(1) << "No 0-RTT replay protection in QUIC_VERSION_33 and higher."; // If the server nonce is empty and we're requiring handshake confirmation // for DoS reasons then we must reject the CHLO. - if (FLAGS_quic_require_handshake_confirmation && info->server_nonce.empty()) { + if (FLAGS_quic_reloadable_flag_quic_require_handshake_confirmation && + info->server_nonce.empty()) { info->reject_reasons.push_back(SERVER_NONCE_REQUIRED_FAILURE); } helper.ValidationComplete(QUIC_NO_ERROR, "", std::move(proof_source_details)); @@ -1539,7 +1541,8 @@ QuicByteCount total_framing_overhead, QuicByteCount chlo_packet_size, CryptoHandshakeMessage* out) const { - if (FLAGS_enable_quic_stateless_reject_support && use_stateless_rejects) { + if (FLAGS_quic_reloadable_flag_enable_quic_stateless_reject_support && + use_stateless_rejects) { DVLOG(1) << "QUIC Crypto server config returning stateless reject " << "with server-designated connection ID " << server_designated_connection_id; @@ -1717,8 +1720,7 @@ << orbit.size() << " want " << kOrbitSize; return nullptr; } - static_assert(sizeof(config->orbit) == kOrbitSize, - "orbit has incorrect size"); + static_assert(sizeof(config->orbit) == kOrbitSize, "incorrect orbit size"); memcpy(config->orbit, orbit.data(), sizeof(config->orbit)); if (kexs_len != protobuf->key_size()) { @@ -1896,12 +1898,11 @@ // Some clients might still be using the old source token format so // attempt to parse that format. // TODO(rch): remove this code once the new format is ubiquitous. - SourceAddressToken source_address_token; - if (!source_address_token.ParseFromArray(plaintext.data(), - plaintext.size())) { + SourceAddressToken token; + if (!token.ParseFromArray(plaintext.data(), plaintext.size())) { return SOURCE_ADDRESS_TOKEN_PARSE_FAILURE; } - *tokens->add_tokens() = source_address_token; + *tokens->add_tokens() = token; } return HANDSHAKE_OK;
diff --git a/net/quic/core/crypto/quic_crypto_server_config.h b/net/quic/core/crypto/quic_crypto_server_config.h index 4a6026f..d8e0e409 100644 --- a/net/quic/core/crypto/quic_crypto_server_config.h +++ b/net/quic/core/crypto/quic_crypto_server_config.h
@@ -334,7 +334,8 @@ // // |cached_network_params| is optional, and can be nullptr. // - // TODO(gredner): remove this when --FLAGS_enable_async_get_proof is removed. + // TODO(gredner): remove this when + // FLAGS_quic_reloadable_flag_enable_async_get_proof is removed. bool BuildServerConfigUpdateMessage( QuicVersion version, base::StringPiece chlo_hash,
diff --git a/net/quic/core/quic_alarm.h b/net/quic/core/quic_alarm.h index f3e0b052..bfb803ad 100644 --- a/net/quic/core/quic_alarm.h +++ b/net/quic/core/quic_alarm.h
@@ -5,8 +5,6 @@ #ifndef NET_QUIC_CORE_QUIC_ALARM_H_ #define NET_QUIC_CORE_QUIC_ALARM_H_ -#include <memory> - #include "base/macros.h" #include "net/quic/core/quic_arena_scoped_ptr.h" #include "net/quic/core/quic_time.h"
diff --git a/net/quic/core/quic_arena_scoped_ptr.h b/net/quic/core/quic_arena_scoped_ptr.h index 320bfa3..4b8ce6a 100644 --- a/net/quic/core/quic_arena_scoped_ptr.h +++ b/net/quic/core/quic_arena_scoped_ptr.h
@@ -15,7 +15,7 @@ #include "base/logging.h" #include "base/macros.h" -#include "net/quic/core/quic_utils.h" +#include "net/quic/core/quic_types.h" namespace net { @@ -117,8 +117,7 @@ } template <typename T> -QuicArenaScopedPtr<T>::QuicArenaScopedPtr() - : value_(nullptr) {} +QuicArenaScopedPtr<T>::QuicArenaScopedPtr() : value_(nullptr) {} template <typename T> QuicArenaScopedPtr<T>::QuicArenaScopedPtr(T* value)
diff --git a/net/quic/core/quic_bandwidth.h b/net/quic/core/quic_bandwidth.h index 3d5d2f5..4e11d5f 100644 --- a/net/quic/core/quic_bandwidth.h +++ b/net/quic/core/quic_bandwidth.h
@@ -7,9 +7,8 @@ #ifndef NET_QUIC_CORE_QUIC_BANDWIDTH_H_ #define NET_QUIC_CORE_QUIC_BANDWIDTH_H_ -#include <stdint.h> - #include <cmath> +#include <cstdint> #include <ostream> #include "base/compiler_specific.h"
diff --git a/net/quic/core/quic_blocked_writer_interface.h b/net/quic/core/quic_blocked_writer_interface.h index 9751de9d..ea6bd47 100644 --- a/net/quic/core/quic_blocked_writer_interface.h +++ b/net/quic/core/quic_blocked_writer_interface.h
@@ -9,7 +9,7 @@ #ifndef NET_QUIC_CORE_QUIC_BLOCKED_WRITER_INTERFACE_H_ #define NET_QUIC_CORE_QUIC_BLOCKED_WRITER_INTERFACE_H_ -#include <stddef.h> +#include <cstddef> #include "net/quic/platform/api/quic_export.h"
diff --git a/net/quic/core/quic_buffered_packet_store.cc b/net/quic/core/quic_buffered_packet_store.cc index 779a9ff..b680cb7e 100644 --- a/net/quic/core/quic_buffered_packet_store.cc +++ b/net/quic/core/quic_buffered_packet_store.cc
@@ -4,17 +4,17 @@ #include "net/quic/core/quic_buffered_packet_store.h" -#include <list> - #include "base/stl_util.h" #include "net/quic/core/quic_bug_tracker.h" #include "net/quic/core/quic_flags.h" +using base::ContainsKey; + namespace net { typedef QuicBufferedPacketStore::BufferedPacket BufferedPacket; -typedef QuicBufferedPacketStore::EnqueuePacketResult EnqueuePacketResult; typedef QuicBufferedPacketStore::BufferedPacketList BufferedPacketList; +typedef QuicBufferedPacketStore::EnqueuePacketResult EnqueuePacketResult; // Max number of connections this store can keep track. static const size_t kDefaultMaxConnectionsInStore = 100; @@ -85,20 +85,19 @@ bool is_chlo) { QUIC_BUG_IF(!FLAGS_quic_allow_chlo_buffering) << "Shouldn't buffer packets if disabled via flag."; - QUIC_BUG_IF(is_chlo && - base::ContainsKey(connections_with_chlo_, connection_id)) + QUIC_BUG_IF(is_chlo && ContainsKey(connections_with_chlo_, connection_id)) << "Shouldn't buffer duplicated CHLO on connection " << connection_id; - if (!base::ContainsKey(undecryptable_packets_, connection_id) && + if (!ContainsKey(undecryptable_packets_, connection_id) && ShouldBufferPacket(is_chlo)) { // Drop the packet if the upper limit of undecryptable packets has been // reached or the whole capacity of the store has been reached. return TOO_MANY_CONNECTIONS; - } else if (!base::ContainsKey(undecryptable_packets_, connection_id)) { + } else if (!ContainsKey(undecryptable_packets_, connection_id)) { undecryptable_packets_.emplace( std::make_pair(connection_id, BufferedPacketList())); } - CHECK(base::ContainsKey(undecryptable_packets_, connection_id)); + CHECK(ContainsKey(undecryptable_packets_, connection_id)); BufferedPacketList& queue = undecryptable_packets_.find(connection_id)->second; @@ -106,7 +105,7 @@ // If current packet is not CHLO, it might not be buffered because store // only buffers certain number of undecryptable packets per connection. size_t num_non_chlo_packets = - base::ContainsKey(connections_with_chlo_, connection_id) + ContainsKey(connections_with_chlo_, connection_id) ? (queue.buffered_packets.size() - 1) : queue.buffered_packets.size(); if (num_non_chlo_packets >= kDefaultMaxUndecryptablePackets) { @@ -139,7 +138,7 @@ bool QuicBufferedPacketStore::HasBufferedPackets( QuicConnectionId connection_id) const { - return base::ContainsKey(undecryptable_packets_, connection_id); + return ContainsKey(undecryptable_packets_, connection_id); } bool QuicBufferedPacketStore::HasChlosBuffered() const { @@ -171,7 +170,7 @@ } QuicConnectionId connection_id = entry.first; visitor_->OnExpiredPackets(connection_id, std::move(entry.second)); - undecryptable_packets_.erase(undecryptable_packets_.begin()); + undecryptable_packets_.pop_front(); connections_with_chlo_.erase(connection_id); } if (!undecryptable_packets_.empty()) { @@ -196,7 +195,7 @@ size_t num_connections_without_chlo = undecryptable_packets_.size() - connections_with_chlo_.size(); bool reach_non_chlo_limit = - FLAGS_quic_limit_num_new_sessions_per_epoll_loop && + FLAGS_quic_reloadable_flag_quic_limit_num_new_sessions_per_epoll_loop && num_connections_without_chlo >= kMaxConnectionsWithoutCHLO; return is_store_full || reach_non_chlo_limit; @@ -210,7 +209,7 @@ return std::list<BufferedPacket>(); } *connection_id = connections_with_chlo_.front().first; - connections_with_chlo_.erase(connections_with_chlo_.begin()); + connections_with_chlo_.pop_front(); std::list<BufferedPacket> packets = DeliverPackets(*connection_id); DCHECK(!packets.empty()) << "Try to deliver connectons without CHLO"; @@ -219,7 +218,7 @@ bool QuicBufferedPacketStore::HasChloForConnection( QuicConnectionId connection_id) { - return base::ContainsKey(connections_with_chlo_, connection_id); + return ContainsKey(connections_with_chlo_, connection_id); } } // namespace net
diff --git a/net/quic/core/quic_buffered_packet_store.h b/net/quic/core/quic_buffered_packet_store.h index 481b879..d6794ae 100644 --- a/net/quic/core/quic_buffered_packet_store.h +++ b/net/quic/core/quic_buffered_packet_store.h
@@ -115,9 +115,9 @@ // Delivers buffered packets for next connection with CHLO to open. // Return connection id for next connection in |connection_id| // and all buffered packets including CHLO. - // The returned std::list should at least has one packet(CHLO) if + // The returned list should at least has one packet(CHLO) if // store does have any connection to open. If no connection in the store has - // received CHLO yet, empty std::list will be returned. + // received CHLO yet, empty list will be returned. std::list<BufferedPacket> DeliverPacketsForNextConnection( QuicConnectionId* connection_id);
diff --git a/net/quic/core/quic_buffered_packet_store_test.cc b/net/quic/core/quic_buffered_packet_store_test.cc index fd5a1a24..49a558ee 100644 --- a/net/quic/core/quic_buffered_packet_store_test.cc +++ b/net/quic/core/quic_buffered_packet_store_test.cc
@@ -126,7 +126,7 @@ // buffered. size_t num_packets = kDefaultMaxUndecryptablePackets + 1; QuicConnectionId connection_id = 1; - if (FLAGS_quic_limit_num_new_sessions_per_epoll_loop) { + if (FLAGS_quic_reloadable_flag_quic_limit_num_new_sessions_per_epoll_loop) { // Arrived CHLO packet shouldn't affect how many non-CHLO pacekts store can // keep. EXPECT_EQ(QuicBufferedPacketStore::SUCCESS, @@ -146,16 +146,19 @@ // Only first |kDefaultMaxUndecryptablePackets| non-CHLO packets and CHLO are // buffered. - EXPECT_EQ(kDefaultMaxUndecryptablePackets + - (FLAGS_quic_limit_num_new_sessions_per_epoll_loop ? 1 : 0), - store_.DeliverPackets(connection_id).size()); + EXPECT_EQ( + kDefaultMaxUndecryptablePackets + + (FLAGS_quic_reloadable_flag_quic_limit_num_new_sessions_per_epoll_loop + ? 1 + : 0), + store_.DeliverPackets(connection_id).size()); } TEST_F(QuicBufferedPacketStoreTest, ReachNonChloConnectionUpperLimit) { // Tests that store can only keep early arrived packets for limited number of // connections. const size_t kNumConnections = - (FLAGS_quic_limit_num_new_sessions_per_epoll_loop + (FLAGS_quic_reloadable_flag_quic_limit_num_new_sessions_per_epoll_loop ? kMaxConnectionsWithoutCHLO : kDefaultMaxConnectionsInStore) + 1; @@ -163,9 +166,10 @@ ++connection_id) { EnqueuePacketResult result = store_.EnqueuePacket( connection_id, packet_, server_address_, client_address_, false); - if (connection_id <= (FLAGS_quic_limit_num_new_sessions_per_epoll_loop - ? kMaxConnectionsWithoutCHLO - : kDefaultMaxConnectionsInStore)) { + if (connection_id <= + (FLAGS_quic_reloadable_flag_quic_limit_num_new_sessions_per_epoll_loop + ? kMaxConnectionsWithoutCHLO + : kDefaultMaxConnectionsInStore)) { EXPECT_EQ(EnqueuePacketResult::SUCCESS, result); } else { EXPECT_EQ(EnqueuePacketResult::TOO_MANY_CONNECTIONS, result); @@ -175,9 +179,10 @@ for (size_t connection_id = 1; connection_id <= kNumConnections; ++connection_id) { std::list<BufferedPacket> queue = store_.DeliverPackets(connection_id); - if (connection_id <= (FLAGS_quic_limit_num_new_sessions_per_epoll_loop - ? kMaxConnectionsWithoutCHLO - : kDefaultMaxConnectionsInStore)) { + if (connection_id <= + (FLAGS_quic_reloadable_flag_quic_limit_num_new_sessions_per_epoll_loop + ? kMaxConnectionsWithoutCHLO + : kDefaultMaxConnectionsInStore)) { EXPECT_EQ(1u, queue.size()); } else { EXPECT_EQ(0u, queue.size()); @@ -187,7 +192,7 @@ TEST_F(QuicBufferedPacketStoreTest, FullStoreFailToBufferDataPacketOnNewConnection) { - FLAGS_quic_limit_num_new_sessions_per_epoll_loop = true; + FLAGS_quic_reloadable_flag_quic_limit_num_new_sessions_per_epoll_loop = true; // Send enough CHLOs so that store gets full before number of connections // without CHLO reaches its upper limit. size_t num_chlos = @@ -213,7 +218,7 @@ } TEST_F(QuicBufferedPacketStoreTest, EnqueueChloOnTooManyDifferentConnections) { - FLAGS_quic_limit_num_new_sessions_per_epoll_loop = true; + FLAGS_quic_reloadable_flag_quic_limit_num_new_sessions_per_epoll_loop = true; // Buffer data packets on different connections upto limit. for (QuicConnectionId conn_id = 1; conn_id <= kMaxConnectionsWithoutCHLO; ++conn_id) { @@ -266,7 +271,7 @@ } TEST_F(QuicBufferedPacketStoreTest, PacketQueueExpiredBeforeDelivery1) { - FLAGS_quic_limit_num_new_sessions_per_epoll_loop = false; + FLAGS_quic_reloadable_flag_quic_limit_num_new_sessions_per_epoll_loop = false; QuicConnectionId connection_id = 1; store_.EnqueuePacket(connection_id, packet_, server_address_, client_address_, false); @@ -318,11 +323,11 @@ // Tests that store expires long-staying connections appropriately for // connections both with and without CHLOs. TEST_F(QuicBufferedPacketStoreTest, PacketQueueExpiredBeforeDelivery2) { - FLAGS_quic_limit_num_new_sessions_per_epoll_loop = true; + FLAGS_quic_reloadable_flag_quic_limit_num_new_sessions_per_epoll_loop = true; QuicConnectionId connection_id = 1; store_.EnqueuePacket(connection_id, packet_, server_address_, client_address_, false); - if (FLAGS_quic_limit_num_new_sessions_per_epoll_loop) { + if (FLAGS_quic_reloadable_flag_quic_limit_num_new_sessions_per_epoll_loop) { EXPECT_EQ(EnqueuePacketResult::SUCCESS, store_.EnqueuePacket(connection_id, packet_, server_address_, client_address_, true));
diff --git a/net/quic/core/quic_config.cc b/net/quic/core/quic_config.cc index c0b313b..50914e6 100644 --- a/net/quic/core/quic_config.cc +++ b/net/quic/core/quic_config.cc
@@ -626,7 +626,7 @@ SetInitialStreamFlowControlWindowToSend(kMinimumFlowControlSendWindow); SetInitialSessionFlowControlWindowToSend(kMinimumFlowControlSendWindow); - if (FLAGS_quic_send_max_header_list_size) { + if (FLAGS_quic_reloadable_flag_quic_send_max_header_list_size) { SetSupportMaxHeaderListSize(); } }
diff --git a/net/quic/core/quic_connection.cc b/net/quic/core/quic_connection.cc index 7822020..fdb1297 100644 --- a/net/quic/core/quic_connection.cc +++ b/net/quic/core/quic_connection.cc
@@ -275,11 +275,11 @@ DVLOG(1) << ENDPOINT << "Created connection with connection_id: " << connection_id; framer_.set_visitor(this); - if (!FLAGS_quic_receive_packet_once_decrypted) { + if (!FLAGS_quic_reloadable_flag_quic_receive_packet_once_decrypted) { last_stop_waiting_frame_.least_unacked = 0; } stats_.connection_creation_time = clock_->ApproximateNow(); - if (FLAGS_quic_enable_multipath) { + if (FLAGS_quic_reloadable_flag_quic_enable_multipath) { sent_packet_manager_.reset(new QuicMultipathSentPacketManager( sent_packet_manager_.release(), this)); } @@ -320,7 +320,8 @@ idle_timeout_connection_close_behavior_ = ConnectionCloseBehavior::SILENT_CLOSE; } - if (FLAGS_quic_enable_multipath && config.MultipathEnabled()) { + if (FLAGS_quic_reloadable_flag_quic_enable_multipath && + config.MultipathEnabled()) { multipath_enabled_ = true; } } else { @@ -361,7 +362,7 @@ } if (config.HasClientSentConnectionOption(k5RTO, perspective_)) { if (perspective_ == Perspective::IS_CLIENT || - !FLAGS_quic_only_5rto_client_side) { + !FLAGS_quic_reloadable_flag_quic_only_5rto_client_side) { close_connection_after_five_rtos_ = true; } } @@ -645,7 +646,7 @@ --stats_.packets_dropped; DVLOG(1) << ENDPOINT << "Received packet header: " << header; last_header_ = header; - if (FLAGS_quic_receive_packet_once_decrypted) { + if (FLAGS_quic_reloadable_flag_quic_receive_packet_once_decrypted) { // An ack will be sent if a missing retransmittable packet was received; was_last_packet_missing_ = received_packet_manager_.IsMissing(last_header_.packet_number); @@ -764,7 +765,7 @@ debug_visitor_->OnStopWaitingFrame(frame); } - if (FLAGS_quic_receive_packet_once_decrypted) { + if (FLAGS_quic_reloadable_flag_quic_receive_packet_once_decrypted) { ProcessStopWaitingFrame(frame); } else { last_stop_waiting_frame_ = frame; @@ -946,7 +947,7 @@ DVLOG(1) << ENDPOINT << "Got packet " << last_header_.packet_number << " for " << last_header_.public_header.connection_id; - if (FLAGS_quic_receive_packet_once_decrypted) { + if (FLAGS_quic_reloadable_flag_quic_receive_packet_once_decrypted) { // An ack will be sent if a missing retransmittable packet was received; const bool was_missing = should_last_packet_instigate_acks_ && was_last_packet_missing_; @@ -1049,7 +1050,7 @@ void QuicConnection::ClearLastFrames() { should_last_packet_instigate_acks_ = false; - if (!FLAGS_quic_receive_packet_once_decrypted) { + if (!FLAGS_quic_reloadable_flag_quic_receive_packet_once_decrypted) { last_stop_waiting_frame_.least_unacked = 0; } } @@ -1246,7 +1247,7 @@ ++stats_.packets_received; // Ensure the time coming from the packet reader is within a minute of now. - if (FLAGS_quic_allow_large_send_deltas && + if (FLAGS_quic_reloadable_flag_quic_allow_large_send_deltas && std::abs((packet.receipt_time() - clock_->ApproximateNow()).ToSeconds()) > 60) { QUIC_BUG << "Packet receipt time:"
diff --git a/net/quic/core/quic_connection.h b/net/quic/core/quic_connection.h index fda3d63..be1d740 100644 --- a/net/quic/core/quic_connection.h +++ b/net/quic/core/quic_connection.h
@@ -897,7 +897,8 @@ EncryptionLevel last_decrypted_packet_level_; QuicPacketHeader last_header_; // TODO(ianswett): Remove last_stop_waiting_frame_ once - // FLAGS_quic_receive_packet_once_decrypted is deprecated. + // FLAGS_quic_reloadable_flag_quic_receive_packet_once_decrypted is + // deprecated. QuicStopWaitingFrame last_stop_waiting_frame_; bool should_last_packet_instigate_acks_; // Whether the most recent packet was missing before it was received.
diff --git a/net/quic/core/quic_connection_test.cc b/net/quic/core/quic_connection_test.cc index e89b563..d90cba32 100644 --- a/net/quic/core/quic_connection_test.cc +++ b/net/quic/core/quic_connection_test.cc
@@ -2045,7 +2045,7 @@ // Ensure that if the only data in flight is non-retransmittable, the // retransmission alarm is not set. TEST_P(QuicConnectionTest, CancelRetransmissionAlarmAfterResetStream) { - FLAGS_quic_more_conservative_retransmission_alarm = true; + FLAGS_quic_reloadable_flag_quic_more_conservative_retransmission_alarm = true; QuicStreamId stream_id = 2; QuicPacketNumber last_data_packet; SendStreamDataToPeer(stream_id, "foo", 0, !kFin, &last_data_packet); @@ -2290,8 +2290,9 @@ writer_->SetWritable(); connection_.OnCanWrite(); // There is now a pending packet, but with no retransmittable frames. - EXPECT_EQ(FLAGS_quic_more_conservative_retransmission_alarm, - !connection_.GetRetransmissionAlarm()->IsSet()); + EXPECT_EQ( + FLAGS_quic_reloadable_flag_quic_more_conservative_retransmission_alarm, + !connection_.GetRetransmissionAlarm()->IsSet()); EXPECT_FALSE(QuicConnectionPeer::HasRetransmittableFrames(&connection_, ack.path_id, 2)); } @@ -3504,7 +3505,7 @@ } TEST_P(QuicConnectionTest, TimeoutAfter5ServerRTOs) { - FLAGS_quic_only_5rto_client_side = true; + FLAGS_quic_reloadable_flag_quic_only_5rto_client_side = true; connection_.SetMaxTailLossProbes(kDefaultPathId, 2); set_perspective(Perspective::IS_SERVER); QuicFramerPeer::SetPerspective(QuicConnectionPeer::GetFramer(&connection_), @@ -4151,7 +4152,7 @@ } TEST_P(QuicConnectionTest, BundleAckForSecondCHLOTwoPacketReject) { - FLAGS_quic_receive_packet_once_decrypted = true; + FLAGS_quic_reloadable_flag_quic_receive_packet_once_decrypted = true; EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); EXPECT_FALSE(connection_.GetAckAlarm()->IsSet()); @@ -4782,7 +4783,7 @@ TEST_P(QuicConnectionTest, Pacing) { // static_cast here does not work if using multipath_sent_packet_manager. - FLAGS_quic_enable_multipath = false; + FLAGS_quic_reloadable_flag_quic_enable_multipath = false; TestConnection server(connection_id_, kSelfAddress, helper_.get(), alarm_factory_.get(), writer_.get(), Perspective::IS_SERVER, version()); @@ -4916,7 +4917,7 @@ TEST_P(QuicConnectionTest, EnableMultipathNegotiation) { // Test multipath negotiation during crypto handshake. Multipath is enabled // when both endpoints enable multipath. - FLAGS_quic_enable_multipath = true; + FLAGS_quic_reloadable_flag_quic_enable_multipath = true; EXPECT_TRUE(connection_.connected()); EXPECT_FALSE(QuicConnectionPeer::IsMultipathEnabled(&connection_)); EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
diff --git a/net/quic/core/quic_crypto_client_stream.cc b/net/quic/core/quic_crypto_client_stream.cc index 98a64ab..2d9ba1554 100644 --- a/net/quic/core/quic_crypto_client_stream.cc +++ b/net/quic/core/quic_crypto_client_stream.cc
@@ -326,7 +326,7 @@ // If the server nonce is empty, copy over the server nonce from a previous // SREJ, if there is one. - if (FLAGS_enable_quic_stateless_reject_support && + if (FLAGS_quic_reloadable_flag_enable_quic_stateless_reject_support && crypto_negotiated_params_->server_nonce.empty() && cached->has_server_nonce()) { crypto_negotiated_params_->server_nonce = cached->GetNextServerNonce();
diff --git a/net/quic/core/quic_crypto_client_stream_test.cc b/net/quic/core/quic_crypto_client_stream_test.cc index 75dedfcb..bbc2f372 100644 --- a/net/quic/core/quic_crypto_client_stream_test.cc +++ b/net/quic/core/quic_crypto_client_stream_test.cc
@@ -230,9 +230,10 @@ reinterpret_cast<char*>(scfg), arraysize(scfg)); QuicStreamSequencer* sequencer = QuicStreamPeer::sequencer(stream()); - EXPECT_NE(FLAGS_quic_release_crypto_stream_buffer && - FLAGS_quic_reduce_sequencer_buffer_memory_life_time, // NOLINT - QuicStreamSequencerPeer::IsUnderlyingBufferAllocated(sequencer)); + EXPECT_NE( + FLAGS_quic_reloadable_flag_quic_release_crypto_stream_buffer && + FLAGS_quic_reloadable_flag_quic_reduce_sequencer_buffer_memory_life_time, // NOLINT + QuicStreamSequencerPeer::IsUnderlyingBufferAllocated(sequencer)); } TEST_F(QuicCryptoClientStreamTest, ServerConfigUpdateWithCert) { @@ -376,7 +377,7 @@ CryptoTestUtils::SetupCryptoServerConfigForTest( server_connection_->clock(), server_connection_->random_generator(), &server_crypto_config_, options); - FLAGS_enable_quic_stateless_reject_support = true; + FLAGS_quic_reloadable_flag_enable_quic_stateless_reject_support = true; } QuicFlagSaver flags_; // Save/restore all QUIC flag values. @@ -398,7 +399,7 @@ }; TEST_F(QuicCryptoClientStreamStatelessTest, StatelessReject) { - FLAGS_enable_quic_stateless_reject_support = true; + FLAGS_quic_reloadable_flag_enable_quic_stateless_reject_support = true; QuicCryptoClientConfig::CachedState* client_state = client_crypto_config_.LookupOrCreate(server_id_);
diff --git a/net/quic/core/quic_crypto_server_stream.cc b/net/quic/core/quic_crypto_server_stream.cc index 38d5312..f1b6041 100644 --- a/net/quic/core/quic_crypto_server_stream.cc +++ b/net/quic/core/quic_crypto_server_stream.cc
@@ -283,7 +283,7 @@ return; } - if (FLAGS_enable_async_get_proof) { + if (FLAGS_quic_reloadable_flag_enable_async_get_proof) { if (send_server_config_update_cb_ != nullptr) { DVLOG(1) << "Skipped server config update since one is already in progress";
diff --git a/net/quic/core/quic_crypto_server_stream_test.cc b/net/quic/core/quic_crypto_server_stream_test.cc index 5c43cde..e9450454 100644 --- a/net/quic/core/quic_crypto_server_stream_test.cc +++ b/net/quic/core/quic_crypto_server_stream_test.cc
@@ -67,7 +67,7 @@ QuicCompressedCertsCache::kQuicCompressedCertsCacheSize), server_id_(kServerHostname, kServerPort, PRIVACY_MODE_DISABLED), client_crypto_config_(CryptoTestUtils::ProofVerifierForTesting()) { - FLAGS_enable_quic_stateless_reject_support = false; + FLAGS_quic_reloadable_flag_enable_quic_stateless_reject_support = false; } void Initialize() { InitializeServer(); } @@ -225,7 +225,7 @@ } TEST_P(QuicCryptoServerStreamTest, StatelessRejectAfterCHLO) { - FLAGS_enable_quic_stateless_reject_support = true; + FLAGS_quic_reloadable_flag_enable_quic_stateless_reject_support = true; Initialize(); @@ -259,7 +259,7 @@ } TEST_P(QuicCryptoServerStreamTest, ConnectedAfterStatelessHandshake) { - FLAGS_enable_quic_stateless_reject_support = true; + FLAGS_quic_reloadable_flag_enable_quic_stateless_reject_support = true; Initialize(); @@ -303,7 +303,7 @@ } TEST_P(QuicCryptoServerStreamTest, NoStatelessRejectIfNoClientSupport) { - FLAGS_enable_quic_stateless_reject_support = true; + FLAGS_quic_reloadable_flag_enable_quic_stateless_reject_support = true; Initialize(); @@ -421,7 +421,7 @@ // CryptoTestUtils::MovePackets stops processing parsing following packets. // Actually, crypto stream test should use QuicSession instead of // QuicSpdySession (b/32366134). - FLAGS_quic_send_max_header_list_size = false; + FLAGS_quic_reloadable_flag_quic_send_max_header_list_size = false; Initialize(); InitializeFakeClient(/* supports_stateless_rejects= */ false);
diff --git a/net/quic/core/quic_crypto_stream.cc b/net/quic/core/quic_crypto_stream.cc index 9c4488f..fc6a4ce 100644 --- a/net/quic/core/quic_crypto_stream.cc +++ b/net/quic/core/quic_crypto_stream.cc
@@ -73,7 +73,7 @@ } sequencer()->MarkConsumed(iov.iov_len); if (handshake_confirmed_ && crypto_framer_.InputBytesRemaining() == 0 && - FLAGS_quic_release_crypto_stream_buffer) { + FLAGS_quic_reloadable_flag_quic_release_crypto_stream_buffer) { // If the handshake is complete and the current message has been fully // processed then no more handshake messages are likely to arrive soon // so release the memory in the stream sequencer.
diff --git a/net/quic/core/quic_flags_list.h b/net/quic/core/quic_flags_list.h index e6aab7e..c73676f 100644 --- a/net/quic/core/quic_flags_list.h +++ b/net/quic/core/quic_flags_list.h
@@ -9,7 +9,7 @@ // If true, QUIC BBR congestion control may be enabled via Finch and/or via QUIC // connection options. -QUIC_FLAG(bool, FLAGS_quic_allow_new_bbr, true) +QUIC_FLAG(bool, FLAGS_quic_reloadable_flag_quic_allow_new_bbr, true) // Time period for which a given connection_id should live in the time-wait // state. @@ -27,107 +27,146 @@ QUIC_FLAG(int64_t, FLAGS_quic_time_wait_list_max_connections, 600000) // Enables server-side support for QUIC stateless rejects. -QUIC_FLAG(bool, FLAGS_enable_quic_stateless_reject_support, true) +QUIC_FLAG(bool, + FLAGS_quic_reloadable_flag_enable_quic_stateless_reject_support, + true) // This flag is not in use, just to keep consistency for shared code. -QUIC_FLAG(bool, FLAGS_quic_always_log_bugs_for_tests, true) +QUIC_FLAG(bool, FLAGS_quic_reloadable_flag_quic_always_log_bugs_for_tests, true) // If true, multipath is enabled for the connection. -QUIC_FLAG(bool, FLAGS_quic_enable_multipath, false) +QUIC_FLAG(bool, FLAGS_quic_reloadable_flag_quic_enable_multipath, false) // If true, require handshake confirmation for QUIC connections, functionally // disabling 0-rtt handshakes. // TODO(rtenneti): Enable this flag after CryptoServerTest's are fixed. -QUIC_FLAG(bool, FLAGS_quic_require_handshake_confirmation, false) +QUIC_FLAG(bool, + FLAGS_quic_reloadable_flag_quic_require_handshake_confirmation, + false) // If true, disable pacing in QUIC. QUIC_FLAG(bool, FLAGS_quic_disable_pacing_for_perf_tests, false) // If true, QUIC public reset packets will have the \"pre-v33\" public header // flags. -QUIC_FLAG(bool, FLAGS_quic_use_old_public_reset_packets, true) +QUIC_FLAG(bool, + FLAGS_quic_reloadable_flag_quic_use_old_public_reset_packets, + true) // If true, QUIC will use cheap stateless rejects without creating a full // connection. -QUIC_FLAG(bool, FLAGS_quic_use_cheap_stateless_rejects, true) +QUIC_FLAG(bool, + FLAGS_quic_reloadable_flag_quic_use_cheap_stateless_rejects, + true) // If true, QUIC respect HTTP2 SETTINGS frame rather than always close the // connection. -QUIC_FLAG(bool, FLAGS_quic_respect_http2_settings_frame, true) +QUIC_FLAG(bool, + FLAGS_quic_reloadable_flag_quic_respect_http2_settings_frame, + true) // If true, re-enables QUIC_VERSION_36. -QUIC_FLAG(bool, FLAGS_quic_enable_version_36_v3, true) +QUIC_FLAG(bool, FLAGS_quic_reloadable_flag_quic_enable_version_36_v3, true) // If true, use async codepaths to invoke ProofSource::GetProof. -QUIC_FLAG(bool, FLAGS_enable_async_get_proof, false) +QUIC_FLAG(bool, FLAGS_quic_reloadable_flag_enable_async_get_proof, false) // If true, only open limited number of quic sessions per epoll event. Leave the // rest to next event. -QUIC_FLAG(bool, FLAGS_quic_limit_num_new_sessions_per_epoll_loop, true) +QUIC_FLAG(bool, + FLAGS_quic_reloadable_flag_quic_limit_num_new_sessions_per_epoll_loop, + true) // Only close the connection on the 5th RTO client side when the 5RTO option // is enabled. -QUIC_FLAG(bool, FLAGS_quic_only_5rto_client_side, false) +QUIC_FLAG(bool, FLAGS_quic_reloadable_flag_quic_only_5rto_client_side, false) // If true, QUIC server push will enabled by default. -QUIC_FLAG(bool, FLAGS_quic_enable_server_push_by_default, true) +QUIC_FLAG(bool, + FLAGS_quic_reloadable_flag_quic_enable_server_push_by_default, + true) // If true, export reject reasons for all rejects, i.e., rejects, // stateless rejects and cheap stateless rejects. -QUIC_FLAG(bool, FLAGS_quic_export_rej_for_all_rejects, true) +QUIC_FLAG(bool, + FLAGS_quic_reloadable_flag_quic_export_rej_for_all_rejects, + true) // Allow large send deltas to be used as RTT samples. -QUIC_FLAG(bool, FLAGS_quic_allow_large_send_deltas, true) +QUIC_FLAG(bool, FLAGS_quic_reloadable_flag_quic_allow_large_send_deltas, true) // Engage early retransmit anytime the largest acked is greater than // or equal to the largest retransmittable packet. -QUIC_FLAG(bool, FLAGS_quic_largest_sent_retransmittable, true) +QUIC_FLAG(bool, + FLAGS_quic_reloadable_flag_quic_largest_sent_retransmittable, + true) // If true, release QuicCryptoStream\'s read buffer when stream are less // frequently used. -QUIC_FLAG(bool, FLAGS_quic_release_crypto_stream_buffer, true) +QUIC_FLAG(bool, + FLAGS_quic_reloadable_flag_quic_release_crypto_stream_buffer, + true) // Use a more conservative backoff of 2x instead of 1.5x for handshake // retransmissions, as well as a larger minimum. -QUIC_FLAG(bool, FLAGS_quic_conservative_handshake_retransmits, false) +QUIC_FLAG(bool, + FLAGS_quic_reloadable_flag_quic_conservative_handshake_retransmits, + false) // If true, buffer packets while parsing public headers instead of parsing down // if CHLO is already buffered. -QUIC_FLAG(bool, FLAGS_quic_buffer_packets_after_chlo, false) +QUIC_FLAG(bool, + FLAGS_quic_reloadable_flag_quic_buffer_packets_after_chlo, + false) // Previously QUIC didn't register a packet as received until it was fully // processed, but now that flow control is implemented, it can be received once // decrypted. -QUIC_FLAG(bool, FLAGS_quic_receive_packet_once_decrypted, false) +QUIC_FLAG(bool, + FLAGS_quic_reloadable_flag_quic_receive_packet_once_decrypted, + false) // If true, enable the Lazy FACK style loss detection in QUIC. -QUIC_FLAG(bool, FLAGS_quic_enable_lazy_fack, false) +QUIC_FLAG(bool, FLAGS_quic_reloadable_flag_quic_enable_lazy_fack, false) // If true, do not override a connection in global map if exists. Only create // QUIC session if it is successfully inserted to the global map. Toss the // packet if insertion fails. -QUIC_FLAG(bool, FLAGS_quic_create_session_after_insertion, false) +QUIC_FLAG(bool, + FLAGS_quic_reloadable_flag_quic_create_session_after_insertion, + false) // If true, rejected packet number is removed from public reset packet. -QUIC_FLAG(bool, FLAGS_quic_remove_packet_number_from_public_reset, false) +QUIC_FLAG( + bool, + FLAGS_quic_reloadable_flag_quic_remove_packet_number_from_public_reset, + false) // If true, v33 QUIC client uses 1 bit to specify 8-byte connection id in // public flag. -QUIC_FLAG(bool, FLAGS_quic_remove_v33_hacks2, false) +QUIC_FLAG(bool, FLAGS_quic_reloadable_flag_quic_remove_v33_hacks2, false) // If true, limits QUIC uncompressed headers to 16K. -QUIC_FLAG(bool, FLAGS_quic_limit_uncompressed_headers, false) +QUIC_FLAG(bool, + FLAGS_quic_reloadable_flag_quic_limit_uncompressed_headers, + false) // If true, release headers stream\'s sequencer buffer when there is no active // stream. -QUIC_FLAG(bool, FLAGS_quic_headers_stream_release_sequencer_buffer, true) +QUIC_FLAG( + bool, + FLAGS_quic_reloadable_flag_quic_headers_stream_release_sequencer_buffer, + true) // Set the retransmission alarm only when there are unacked // retransmittable packets. -QUIC_FLAG(bool, FLAGS_quic_more_conservative_retransmission_alarm, true) +QUIC_FLAG( + bool, + FLAGS_quic_reloadable_flag_quic_more_conservative_retransmission_alarm, + true) // Enable QUIC force HOL blocking experiment. -QUIC_FLAG(bool, FLAGS_quic_enable_force_hol_blocking, true) +QUIC_FLAG(bool, FLAGS_quic_reloadable_flag_quic_enable_force_hol_blocking, true) // If true, allows packets to be buffered in anticipation of a future CHLO, and // allow CHLO packets to be buffered until next iteration of the event loop. @@ -135,46 +174,51 @@ // If true, fix version manager bug, in which version flag does not really // help. -QUIC_FLAG(bool, FLAGS_quic_fix_version_manager, false) +QUIC_FLAG(bool, FLAGS_quic_reloadable_flag_quic_fix_version_manager, false) // Add a new client connection options field to QuicOptions which is only used // to configure client side features, such as congestion control. -QUIC_FLAG(bool, FLAGS_quic_client_connection_options, true) +QUIC_FLAG(bool, FLAGS_quic_reloadable_flag_quic_client_connection_options, true) // If true, fix some casts that were causing off-by-one errors in QUIC's cubic // "convex" increases. -QUIC_FLAG(bool, FLAGS_quic_fix_cubic_convex_mode, false) +QUIC_FLAG(bool, FLAGS_quic_reloadable_flag_quic_fix_cubic_convex_mode, false) // Ensure that BBR startup pacing rate does not drop below the initial one. -QUIC_FLAG(bool, FLAGS_quic_bbr_faster_startup, true) +QUIC_FLAG(bool, FLAGS_quic_reloadable_flag_quic_bbr_faster_startup, true) // If true, GFE sends SETTINGS_MAX_HEADER_LIST_SIZE to the client at the // beginning of a connection. -QUIC_FLAG(bool, FLAGS_quic_send_max_header_list_size, true) +QUIC_FLAG(bool, FLAGS_quic_reloadable_flag_quic_send_max_header_list_size, true) // If true, fix quantization of CubicBytes while performing convex increases. -QUIC_FLAG(bool, FLAGS_quic_fix_cubic_bytes_quantization, false) +QUIC_FLAG(bool, + FLAGS_quic_reloadable_flag_quic_fix_cubic_bytes_quantization, + false) // If true, QUIC cubic code will use the event time when adjusting CWND after an // ACK instead of the clock\'s current approximate time. -QUIC_FLAG(bool, FLAGS_quic_use_event_time, false) +QUIC_FLAG(bool, FLAGS_quic_reloadable_flag_quic_use_event_time, false) // If true, lazy allocate and early release memeory used in // QuicStreamSequencerBuffer to buffer incoming data. -QUIC_FLAG(bool, FLAGS_quic_reduce_sequencer_buffer_memory_life_time, true) +QUIC_FLAG( + bool, + FLAGS_quic_reloadable_flag_quic_reduce_sequencer_buffer_memory_life_time, + true) // If true, Makes GFE respect the connection options for initial flow control // window larger than 32 KB. -QUIC_FLAG(bool, FLAGS_quic_large_ifw_options, false) +QUIC_FLAG(bool, FLAGS_quic_reloadable_flag_quic_large_ifw_options, false) // If true, fix Cubic\'s use of kBetaLastMax for n-connection emulation. -QUIC_FLAG(bool, FLAGS_quic_fix_beta_last_max, false) +QUIC_FLAG(bool, FLAGS_quic_reloadable_flag_quic_fix_beta_last_max, false) // If true, enable QUIC v37. -QUIC_FLAG(bool, FLAGS_quic_enable_version_37, false) +QUIC_FLAG(bool, FLAGS_quic_reloadable_flag_quic_enable_version_37, false) // If true, disables QUIC v34. -QUIC_FLAG(bool, FLAGS_quic_disable_version_34, false) +QUIC_FLAG(bool, FLAGS_quic_reloadable_flag_quic_disable_version_34, false) // Allow quic to properly support proxying 100 Continue responses. -QUIC_FLAG(bool, FLAGS_quic_supports_100_continue, false) +QUIC_FLAG(bool, FLAGS_quic_restart_flag_quic_supports_100_continue, false)
diff --git a/net/quic/core/quic_framer.cc b/net/quic/core/quic_framer.cc index 5eff49d..3909a74 100644 --- a/net/quic/core/quic_framer.cc +++ b/net/quic/core/quic_framer.cc
@@ -426,7 +426,7 @@ CryptoHandshakeMessage reset; reset.set_tag(kPRST); reset.SetValue(kRNON, packet.nonce_proof); - if (!FLAGS_quic_remove_packet_number_from_public_reset) { + if (!FLAGS_quic_reloadable_flag_quic_remove_packet_number_from_public_reset) { reset.SetValue(kRSEQ, packet.rejected_packet_number); } if (packet.client_address.host().address_family() != @@ -448,7 +448,7 @@ uint8_t flags = static_cast<uint8_t>(PACKET_PUBLIC_FLAGS_RST | PACKET_PUBLIC_FLAGS_8BYTE_CONNECTION_ID); - if (FLAGS_quic_use_old_public_reset_packets) { + if (FLAGS_quic_reloadable_flag_quic_use_old_public_reset_packets) { // TODO(rch): Remove this QUIC_VERSION_32 is retired. flags |= static_cast<uint8_t>(PACKET_PUBLIC_FLAGS_8BYTE_CONNECTION_ID_OLD); } @@ -685,7 +685,7 @@ break; case PACKET_8BYTE_CONNECTION_ID: public_flags |= PACKET_PUBLIC_FLAGS_8BYTE_CONNECTION_ID; - if (!FLAGS_quic_remove_v33_hacks2 && + if (!FLAGS_quic_reloadable_flag_quic_remove_v33_hacks2 && perspective_ == Perspective::IS_CLIENT) { public_flags |= PACKET_PUBLIC_FLAGS_8BYTE_CONNECTION_ID_OLD; }
diff --git a/net/quic/core/quic_framer_test.cc b/net/quic/core/quic_framer_test.cc index 7401a054..ff9bc91 100644 --- a/net/quic/core/quic_framer_test.cc +++ b/net/quic/core/quic_framer_test.cc
@@ -2770,7 +2770,7 @@ unsigned char packet[] = { // public flags (version, 8 byte connection_id) static_cast<unsigned char>( - FLAGS_quic_remove_v33_hacks2 ? 0x39 : 0x3D), + FLAGS_quic_reloadable_flag_quic_remove_v33_hacks2 ? 0x39 : 0x3D), // connection_id 0x10, 0x32, 0x54, 0x76, 0x98, 0xBA, 0xDC, 0xFE, // version tag @@ -2863,7 +2863,7 @@ unsigned char packet[] = { // public flags (8 byte connection_id) static_cast<unsigned char>( - FLAGS_quic_remove_v33_hacks2 ? 0x79 : 0x7D), + FLAGS_quic_reloadable_flag_quic_remove_v33_hacks2 ? 0x79 : 0x7D), // connection_id 0x10, 0x32, 0x54, 0x76, 0x98, 0xBA, 0xDC, 0xFE, @@ -3519,7 +3519,7 @@ } TEST_P(QuicFramerTest, BuildPublicResetPacketOld) { - FLAGS_quic_use_old_public_reset_packets = true; + FLAGS_quic_reloadable_flag_quic_use_old_public_reset_packets = true; QuicPublicResetPacket reset_packet; reset_packet.public_header.connection_id = kConnectionId; reset_packet.public_header.reset_flag = true; @@ -3576,7 +3576,7 @@ std::unique_ptr<QuicEncryptedPacket> data( framer_.BuildPublicResetPacket(reset_packet)); ASSERT_TRUE(data != nullptr); - if (FLAGS_quic_remove_packet_number_from_public_reset) { + if (FLAGS_quic_reloadable_flag_quic_remove_packet_number_from_public_reset) { test::CompareCharArraysWithHexError( "constructed packet", data->data(), data->length(), AsChars(packet_no_rejected_packet_number), @@ -3589,7 +3589,7 @@ } TEST_P(QuicFramerTest, BuildPublicResetPacket) { - FLAGS_quic_use_old_public_reset_packets = false; + FLAGS_quic_reloadable_flag_quic_use_old_public_reset_packets = false; QuicPublicResetPacket reset_packet; reset_packet.public_header.connection_id = kConnectionId; reset_packet.public_header.reset_flag = true; @@ -3647,7 +3647,7 @@ framer_.BuildPublicResetPacket(reset_packet)); ASSERT_TRUE(data != nullptr); - if (FLAGS_quic_remove_packet_number_from_public_reset) { + if (FLAGS_quic_reloadable_flag_quic_remove_packet_number_from_public_reset) { test::CompareCharArraysWithHexError( "constructed packet", data->data(), data->length(), AsChars(packet_no_rejected_packet_number), @@ -3660,7 +3660,7 @@ } TEST_P(QuicFramerTest, BuildPublicResetPacketWithClientAddress) { - FLAGS_quic_use_old_public_reset_packets = false; + FLAGS_quic_reloadable_flag_quic_use_old_public_reset_packets = false; QuicPublicResetPacket reset_packet; reset_packet.public_header.connection_id = kConnectionId; reset_packet.public_header.reset_flag = true; @@ -3736,7 +3736,7 @@ framer_.BuildPublicResetPacket(reset_packet)); ASSERT_TRUE(data != nullptr); - if (FLAGS_quic_remove_packet_number_from_public_reset) { + if (FLAGS_quic_reloadable_flag_quic_remove_packet_number_from_public_reset) { test::CompareCharArraysWithHexError( "constructed packet", data->data(), data->length(), AsChars(packet_no_rejected_packet_number),
diff --git a/net/quic/core/quic_header_list.cc b/net/quic/core/quic_header_list.cc index 269b439..0612791 100644 --- a/net/quic/core/quic_header_list.cc +++ b/net/quic/core/quic_header_list.cc
@@ -34,7 +34,7 @@ void QuicHeaderList::OnHeader(base::StringPiece name, base::StringPiece value) { // Avoid infinte buffering of headers. No longer store headers // once the current headers are over the limit. - if (!FLAGS_quic_limit_uncompressed_headers || + if (!FLAGS_quic_reloadable_flag_quic_limit_uncompressed_headers || uncompressed_header_bytes_ == 0 || !header_list_.empty()) { header_list_.emplace_back(name.as_string(), value.as_string()); } @@ -48,7 +48,7 @@ size_t compressed_header_bytes) { uncompressed_header_bytes_ = uncompressed_header_bytes; compressed_header_bytes_ = compressed_header_bytes; - if (FLAGS_quic_limit_uncompressed_headers && + if (FLAGS_quic_reloadable_flag_quic_limit_uncompressed_headers && uncompressed_header_bytes_ > max_uncompressed_header_bytes_) { Clear(); }
diff --git a/net/quic/core/quic_header_list_test.cc b/net/quic/core/quic_header_list_test.cc index 54fa9cb..920c464 100644 --- a/net/quic/core/quic_header_list_test.cc +++ b/net/quic/core/quic_header_list_test.cc
@@ -25,7 +25,7 @@ TEST(QuicHeaderListTest, TooLarge) { test::QuicFlagSaver flags; - FLAGS_quic_limit_uncompressed_headers = true; + FLAGS_quic_reloadable_flag_quic_limit_uncompressed_headers = true; QuicHeaderList headers; string key = "key"; string value(1 << 18, '1');
diff --git a/net/quic/core/quic_headers_stream.cc b/net/quic/core/quic_headers_stream.cc index 0ea432a..c39c94a 100644 --- a/net/quic/core/quic_headers_stream.cc +++ b/net/quic/core/quic_headers_stream.cc
@@ -169,7 +169,7 @@ } void OnSetting(SpdySettingsIds id, uint32_t value) override { - if (!FLAGS_quic_respect_http2_settings_frame) { + if (!FLAGS_quic_reloadable_flag_quic_respect_http2_settings_frame) { CloseConnection("SPDY SETTINGS frame received."); return; } @@ -178,7 +178,7 @@ stream_->UpdateHeaderEncoderTableSize(value); break; case SETTINGS_ENABLE_PUSH: - if (FLAGS_quic_enable_server_push_by_default && + if (FLAGS_quic_reloadable_flag_quic_enable_server_push_by_default && stream_->session()->perspective() == Perspective::IS_SERVER) { // See rfc7540, Section 6.5.2. if (value > 1) { @@ -196,7 +196,7 @@ // TODO(fayang): Need to support SETTINGS_MAX_HEADER_LIST_SIZE when // clients are actually sending it. case SETTINGS_MAX_HEADER_LIST_SIZE: - if (FLAGS_quic_send_max_header_list_size) { + if (FLAGS_quic_reloadable_flag_quic_send_max_header_list_size) { break; } default: @@ -206,13 +206,13 @@ } void OnSettingsAck() override { - if (!FLAGS_quic_respect_http2_settings_frame) { + if (!FLAGS_quic_reloadable_flag_quic_respect_http2_settings_frame) { CloseConnection("SPDY SETTINGS frame received."); } } void OnSettingsEnd() override { - if (!FLAGS_quic_respect_http2_settings_frame) { + if (!FLAGS_quic_reloadable_flag_quic_respect_http2_settings_frame) { CloseConnection("SPDY SETTINGS frame received."); } } @@ -582,7 +582,7 @@ } void QuicHeadersStream::MaybeReleaseSequencerBuffer() { - if (FLAGS_quic_headers_stream_release_sequencer_buffer && + if (FLAGS_quic_reloadable_flag_quic_headers_stream_release_sequencer_buffer && spdy_session_->ShouldReleaseHeadersStreamSequencerBuffer()) { sequencer()->ReleaseBufferIfEmpty(); }
diff --git a/net/quic/core/quic_headers_stream_test.cc b/net/quic/core/quic_headers_stream_test.cc index 73ca0a93..d27c08b 100644 --- a/net/quic/core/quic_headers_stream_test.cc +++ b/net/quic/core/quic_headers_stream_test.cc
@@ -533,8 +533,8 @@ } TEST_P(QuicHeadersStreamTest, ProcessPushPromiseDisabledSetting) { - FLAGS_quic_respect_http2_settings_frame = true; - FLAGS_quic_enable_server_push_by_default = true; + FLAGS_quic_reloadable_flag_quic_respect_http2_settings_frame = true; + FLAGS_quic_reloadable_flag_quic_enable_server_push_by_default = true; session_.OnConfigNegotiated(); SpdySettingsIR data; // Respect supported settings frames SETTINGS_ENABLE_PUSH. @@ -731,7 +731,7 @@ } TEST_P(QuicHeadersStreamTest, ProcessSpdySettingsFrame) { - FLAGS_quic_respect_http2_settings_frame = false; + FLAGS_quic_reloadable_flag_quic_respect_http2_settings_frame = false; SpdySettingsIR data; data.AddSetting(SETTINGS_HEADER_TABLE_SIZE, 0); SpdySerializedFrame frame(framer_->SerializeFrame(data)); @@ -745,8 +745,8 @@ } TEST_P(QuicHeadersStreamTest, RespectHttp2SettingsFrameSupportedFields) { - FLAGS_quic_respect_http2_settings_frame = true; - FLAGS_quic_send_max_header_list_size = true; + FLAGS_quic_reloadable_flag_quic_respect_http2_settings_frame = true; + FLAGS_quic_reloadable_flag_quic_send_max_header_list_size = true; const uint32_t kTestHeaderTableSize = 1000; SpdySettingsIR data; // Respect supported settings frames SETTINGS_HEADER_TABLE_SIZE, @@ -763,8 +763,8 @@ } TEST_P(QuicHeadersStreamTest, RespectHttp2SettingsFrameUnsupportedFields) { - FLAGS_quic_respect_http2_settings_frame = true; - FLAGS_quic_send_max_header_list_size = true; + FLAGS_quic_reloadable_flag_quic_respect_http2_settings_frame = true; + FLAGS_quic_reloadable_flag_quic_send_max_header_list_size = true; SpdySettingsIR data; // Does not support SETTINGS_MAX_CONCURRENT_STREAMS, // SETTINGS_INITIAL_WINDOW_SIZE, SETTINGS_ENABLE_PUSH and @@ -786,7 +786,7 @@ "Unsupported field of HTTP/2 SETTINGS frame: " + base::IntToString(SETTINGS_INITIAL_WINDOW_SIZE), _)); - if (!FLAGS_quic_enable_server_push_by_default || + if (!FLAGS_quic_reloadable_flag_quic_enable_server_push_by_default || session_.perspective() == Perspective::IS_CLIENT) { EXPECT_CALL(*connection_, CloseConnection(QUIC_INVALID_HEADERS_STREAM_DATA,
diff --git a/net/quic/core/quic_packets.h b/net/quic/core/quic_packets.h index a923121..9b34792 100644 --- a/net/quic/core/quic_packets.h +++ b/net/quic/core/quic_packets.h
@@ -99,7 +99,7 @@ QuicPacketPublicHeader public_header; QuicPublicResetNonceProof nonce_proof; // TODO(fayang): remove rejected_packet_number when deprecating - // FLAGS_quic_remove_packet_number_from_public_reset. + // FLAGS_quic_reloadable_flag_quic_remove_packet_number_from_public_reset. QuicPacketNumber rejected_packet_number; QuicSocketAddress client_address; };
diff --git a/net/quic/core/quic_sent_packet_manager.cc b/net/quic/core/quic_sent_packet_manager.cc index 022ce3ec..a00d680 100644 --- a/net/quic/core/quic_sent_packet_manager.cc +++ b/net/quic/core/quic_sent_packet_manager.cc
@@ -109,9 +109,9 @@ } // Configure congestion control. const bool enable_client_connection_options = - FLAGS_quic_client_connection_options; + FLAGS_quic_reloadable_flag_quic_client_connection_options; if (enable_client_connection_options) { - if (FLAGS_quic_allow_new_bbr && + if (FLAGS_quic_reloadable_flag_quic_allow_new_bbr && config.HasClientRequestedIndependentOption(kTBBR, perspective_)) { SetSendAlgorithm(kBBR); } @@ -126,7 +126,8 @@ SetSendAlgorithm(kCubic); } } else { - if (FLAGS_quic_allow_new_bbr && config.HasReceivedConnectionOptions() && + if (FLAGS_quic_reloadable_flag_quic_allow_new_bbr && + config.HasReceivedConnectionOptions() && ContainsQuicTag(config.ReceivedConnectionOptions(), kTBBR)) { SetSendAlgorithm(kBBR); } @@ -167,7 +168,7 @@ if (config.HasClientRequestedIndependentOption(kATIM, perspective_)) { general_loss_algorithm_.SetLossDetectionType(kAdaptiveTime); } - if (FLAGS_quic_enable_lazy_fack && + if (FLAGS_quic_reloadable_flag_quic_enable_lazy_fack && config.HasClientRequestedIndependentOption(kLFAK, perspective_)) { general_loss_algorithm_.SetLossDetectionType(kLazyFack); } @@ -180,7 +181,8 @@ ContainsQuicTag(config.ReceivedConnectionOptions(), kATIM)) { general_loss_algorithm_.SetLossDetectionType(kAdaptiveTime); } - if (FLAGS_quic_enable_lazy_fack && config.HasReceivedConnectionOptions() && + if (FLAGS_quic_reloadable_flag_quic_enable_lazy_fack && + config.HasReceivedConnectionOptions() && ContainsQuicTag(config.ReceivedConnectionOptions(), kLFAK)) { general_loss_algorithm_.SetLossDetectionType(kLazyFack); } @@ -188,7 +190,7 @@ if (config.HasClientSentConnectionOption(kUNDO, perspective_)) { undo_pending_retransmits_ = true; } - if (FLAGS_quic_conservative_handshake_retransmits && + if (FLAGS_quic_reloadable_flag_quic_conservative_handshake_retransmits && config.HasClientSentConnectionOption(kCONH, perspective_)) { conservative_handshake_retransmits_ = true; } @@ -759,7 +761,7 @@ QuicTime::Delta send_delta = ack_receive_time - transmission_info.sent_time; const int kMaxSendDeltaSeconds = 30; - if (!FLAGS_quic_allow_large_send_deltas && + if (!FLAGS_quic_reloadable_flag_quic_allow_large_send_deltas && send_delta.ToSeconds() > kMaxSendDeltaSeconds) { // send_delta can be very high if local clock is changed mid-connection. LOG(WARNING) << "Excessive send delta: " << send_delta.ToSeconds() @@ -802,7 +804,7 @@ pending_timer_transmission_count_ > 0) { return QuicTime::Zero(); } - if (FLAGS_quic_more_conservative_retransmission_alarm && + if (FLAGS_quic_reloadable_flag_quic_more_conservative_retransmission_alarm && !unacked_packets_.HasUnackedRetransmittableFrames()) { return QuicTime::Zero(); }
diff --git a/net/quic/core/quic_sent_packet_manager_test.cc b/net/quic/core/quic_sent_packet_manager_test.cc index bc6d0e1..df5e2fb 100644 --- a/net/quic/core/quic_sent_packet_manager_test.cc +++ b/net/quic/core/quic_sent_packet_manager_test.cc
@@ -1130,7 +1130,7 @@ TEST_F(QuicSentPacketManagerTest, GetConservativeTransmissionTimeCryptoHandshake) { - FLAGS_quic_conservative_handshake_retransmits = true; + FLAGS_quic_reloadable_flag_quic_conservative_handshake_retransmits = true; QuicConfig config; QuicTagVector options; options.push_back(kCONH); @@ -1388,7 +1388,7 @@ } TEST_F(QuicSentPacketManagerTest, NegotiateCongestionControlFromOptions) { - FLAGS_quic_allow_new_bbr = true; + FLAGS_quic_reloadable_flag_quic_allow_new_bbr = true; QuicConfig config; QuicTagVector options; @@ -1426,8 +1426,8 @@ } TEST_F(QuicSentPacketManagerTest, NegotiateClientCongestionControlFromOptions) { - FLAGS_quic_allow_new_bbr = true; - FLAGS_quic_client_connection_options = true; + FLAGS_quic_reloadable_flag_quic_allow_new_bbr = true; + FLAGS_quic_reloadable_flag_quic_client_connection_options = true; QuicConfig config; QuicTagVector options;
diff --git a/net/quic/core/quic_server_session_base.cc b/net/quic/core/quic_server_session_base.cc index 0b4f3b5..3414a06 100644 --- a/net/quic/core/quic_server_session_base.cc +++ b/net/quic/core/quic_server_session_base.cc
@@ -55,7 +55,7 @@ bandwidth_resumption_enabled_ = last_bandwidth_resumption || max_bandwidth_resumption; - if (!FLAGS_quic_enable_server_push_by_default || + if (!FLAGS_quic_reloadable_flag_quic_enable_server_push_by_default || connection()->version() < QUIC_VERSION_35) { set_server_push_enabled( ContainsQuicTag(config()->ReceivedConnectionOptions(), kSPSH));
diff --git a/net/quic/core/quic_server_session_base_test.cc b/net/quic/core/quic_server_session_base_test.cc index 3b92d1e4..7335256 100644 --- a/net/quic/core/quic_server_session_base_test.cc +++ b/net/quic/core/quic_server_session_base_test.cc
@@ -107,7 +107,8 @@ QuicCompressedCertsCache* compressed_certs_cache) override { return new QuicCryptoServerStream( crypto_config, compressed_certs_cache, - FLAGS_enable_quic_stateless_reject_support, this, stream_helper()); + FLAGS_quic_reloadable_flag_enable_quic_stateless_reject_support, this, + stream_helper()); } private: @@ -185,7 +186,7 @@ QuicServerSessionBaseTest, ::testing::ValuesIn(AllSupportedVersions())); TEST_P(QuicServerSessionBaseTest, ServerPushDisabledByDefault) { - FLAGS_quic_enable_server_push_by_default = true; + FLAGS_quic_reloadable_flag_quic_enable_server_push_by_default = true; // Without the client explicitly sending kSPSH, server push will be disabled // at the server, until version 35 when it is enabled by default. EXPECT_FALSE( @@ -348,10 +349,10 @@ } // TODO(ckrasic): remove this when -// FLAGS_quic_enable_server_push_by_default is +// FLAGS_quic_reloadable_flag_quic_enable_server_push_by_default is // deprecated. TEST_P(QuicServerSessionBaseTest, EnableServerPushThroughConnectionOption) { - FLAGS_quic_enable_server_push_by_default = false; + FLAGS_quic_reloadable_flag_quic_enable_server_push_by_default = false; // Assume server received server push connection option. QuicTagVector copt; copt.push_back(kSPSH); @@ -382,11 +383,12 @@ QuicCompressedCertsCache* compressed_certs_cache, QuicServerSessionBase* session, QuicCryptoServerStream::Helper* helper) - : QuicCryptoServerStream(crypto_config, - compressed_certs_cache, - FLAGS_enable_quic_stateless_reject_support, - session, - helper) {} + : QuicCryptoServerStream( + crypto_config, + compressed_certs_cache, + FLAGS_quic_reloadable_flag_enable_quic_stateless_reject_support, + session, + helper) {} ~MockQuicCryptoServerStream() override {} MOCK_METHOD1(SendServerConfigUpdate, @@ -598,10 +600,10 @@ // ProofSource::GetProof. Delay the completion of the operation until after the // stream has been destroyed, and verify that there are no memory bugs. TEST_P(StreamMemberLifetimeTest, Basic) { - FLAGS_enable_async_get_proof = true; - FLAGS_enable_quic_stateless_reject_support = true; - FLAGS_quic_use_cheap_stateless_rejects = true; - FLAGS_quic_create_session_after_insertion = true; + FLAGS_quic_reloadable_flag_enable_async_get_proof = true; + FLAGS_quic_reloadable_flag_enable_quic_stateless_reject_support = true; + FLAGS_quic_reloadable_flag_quic_use_cheap_stateless_rejects = true; + FLAGS_quic_reloadable_flag_quic_create_session_after_insertion = true; const QuicClock* clock = helper_.GetClock(); QuicVersion version = AllSupportedVersions().front();
diff --git a/net/quic/core/quic_session.cc b/net/quic/core/quic_session.cc index 3f8e578..cb75fe68 100644 --- a/net/quic/core/quic_session.cc +++ b/net/quic/core/quic_session.cc
@@ -439,7 +439,8 @@ max_streams = config_.MaxStreamsPerConnection(); } set_max_open_outgoing_streams(max_streams); - if (FLAGS_quic_large_ifw_options && perspective() == Perspective::IS_SERVER) { + if (FLAGS_quic_reloadable_flag_quic_large_ifw_options && + perspective() == Perspective::IS_SERVER) { if (config_.HasReceivedConnectionOptions()) { // The following variations change the initial receive flow control // window sizes.
diff --git a/net/quic/core/quic_session_test.cc b/net/quic/core/quic_session_test.cc index 660e2d8..23a2b50 100644 --- a/net/quic/core/quic_session_test.cc +++ b/net/quic/core/quic_session_test.cc
@@ -522,7 +522,7 @@ CryptoHandshakeMessage msg; MockPacketWriter* writer = static_cast<MockPacketWriter*>( QuicConnectionPeer::GetWriter(session_.connection())); - if (FLAGS_quic_send_max_header_list_size) { + if (FLAGS_quic_reloadable_flag_quic_send_max_header_list_size) { EXPECT_CALL(*writer, WritePacket(_, _, _, _, _)) .WillOnce(Return(WriteResult(WRITE_STATUS_OK, 0))); } @@ -1100,7 +1100,7 @@ // Test negotiation of custom server initial flow control window. TEST_P(QuicSessionTestServer, CustomFlowControlWindow) { - FLAGS_quic_large_ifw_options = true; + FLAGS_quic_reloadable_flag_quic_large_ifw_options = true; QuicTagVector copt; copt.push_back(kIFW7); QuicConfigPeer::SetReceivedConnectionOptions(session_.config(), copt);
diff --git a/net/quic/core/quic_spdy_session.cc b/net/quic/core/quic_spdy_session.cc index 646bd0e8..e3fd1ea8 100644 --- a/net/quic/core/quic_spdy_session.cc +++ b/net/quic/core/quic_spdy_session.cc
@@ -105,8 +105,8 @@ void QuicSpdySession::OnCryptoHandshakeEvent(CryptoHandshakeEvent event) { QuicSession::OnCryptoHandshakeEvent(event); - if (FLAGS_quic_send_max_header_list_size && event == HANDSHAKE_CONFIRMED && - config()->SupportMaxHeaderListSize()) { + if (FLAGS_quic_reloadable_flag_quic_send_max_header_list_size && + event == HANDSHAKE_CONFIRMED && config()->SupportMaxHeaderListSize()) { headers_stream()->SendMaxHeaderListSize(kDefaultMaxUncompressedHeaderSize); } } @@ -127,8 +127,8 @@ headers_stream_->DisableHpackDynamicTable(); } const QuicVersion version = connection()->version(); - if (FLAGS_quic_enable_force_hol_blocking && version > QUIC_VERSION_35 && - config()->ForceHolBlocking(perspective())) { + if (FLAGS_quic_reloadable_flag_quic_enable_force_hol_blocking && + version > QUIC_VERSION_35 && config()->ForceHolBlocking(perspective())) { force_hol_blocking_ = true; // Since all streams are tunneled through the headers stream, it // is important that headers stream never flow control blocks. @@ -142,7 +142,8 @@ } if (version > QUIC_VERSION_34) { - server_push_enabled_ = FLAGS_quic_enable_server_push_by_default; + server_push_enabled_ = + FLAGS_quic_reloadable_flag_quic_enable_server_push_by_default; } }
diff --git a/net/quic/core/quic_spdy_stream.cc b/net/quic/core/quic_spdy_stream.cc index 592c03d..b55ca87 100644 --- a/net/quic/core/quic_spdy_stream.cc +++ b/net/quic/core/quic_spdy_stream.cc
@@ -168,7 +168,8 @@ // be reset. // TODO(rch): Use an explicit "headers too large" signal. An empty header list // might be acceptable if it corresponds to a trailing header frame. - if (FLAGS_quic_limit_uncompressed_headers && header_list.empty()) { + if (FLAGS_quic_reloadable_flag_quic_limit_uncompressed_headers && + header_list.empty()) { OnHeadersTooLarge(); if (IsDoneReading()) { return;
diff --git a/net/quic/core/quic_spdy_stream_test.cc b/net/quic/core/quic_spdy_stream_test.cc index 386f4b2..284ed86 100644 --- a/net/quic/core/quic_spdy_stream_test.cc +++ b/net/quic/core/quic_spdy_stream_test.cc
@@ -144,7 +144,7 @@ } TEST_P(QuicSpdyStreamTest, ProcessTooLargeHeaderList) { - FLAGS_quic_limit_uncompressed_headers = true; + FLAGS_quic_reloadable_flag_quic_limit_uncompressed_headers = true; Initialize(kShouldProcessData); QuicHeaderList headers;
diff --git a/net/quic/core/quic_stream_sequencer_buffer.cc b/net/quic/core/quic_stream_sequencer_buffer.cc index 9b866a1..4b61a34 100644 --- a/net/quic/core/quic_stream_sequencer_buffer.cc +++ b/net/quic/core/quic_stream_sequencer_buffer.cc
@@ -50,7 +50,7 @@ ceil(static_cast<double>(max_capacity_bytes) / kBlockSizeBytes)), total_bytes_read_(0), reduce_sequencer_buffer_memory_life_time_( - FLAGS_quic_reduce_sequencer_buffer_memory_life_time), // NOLINT + FLAGS_quic_reloadable_flag_quic_reduce_sequencer_buffer_memory_life_time), // NOLINT blocks_(reduce_sequencer_buffer_memory_life_time_ ? nullptr : new BufferBlock*[blocks_count_]()),
diff --git a/net/quic/core/quic_stream_sequencer_buffer_test.cc b/net/quic/core/quic_stream_sequencer_buffer_test.cc index 855fe16..9f4054c 100644 --- a/net/quic/core/quic_stream_sequencer_buffer_test.cc +++ b/net/quic/core/quic_stream_sequencer_buffer_test.cc
@@ -110,7 +110,7 @@ } TEST_F(QuicStreamSequencerBufferTest, OnStreamDataWithinBlock) { - if (FLAGS_quic_reduce_sequencer_buffer_memory_life_time) { // NOLINT + if (FLAGS_quic_reloadable_flag_quic_reduce_sequencer_buffer_memory_life_time) { // NOLINT EXPECT_FALSE(helper_->IsBufferAllocated()); } string source(1024, 'a'); @@ -471,7 +471,7 @@ TEST_F(QuicStreamSequencerBufferTest, ReleaseWholeBuffer) { // Tests that buffer is not deallocated unless ReleaseWholeBuffer() is called. - if (!FLAGS_quic_reduce_sequencer_buffer_memory_life_time) { // NOLINT + if (!FLAGS_quic_reloadable_flag_quic_reduce_sequencer_buffer_memory_life_time) { // NOLINT // Won't release buffer when flag is off. return; }
diff --git a/net/quic/core/quic_types.h b/net/quic/core/quic_types.h index 9c29c85..b11d2c4 100644 --- a/net/quic/core/quic_types.h +++ b/net/quic/core/quic_types.h
@@ -5,9 +5,8 @@ #ifndef NET_QUIC_CORE_QUIC_TYPES_H_ #define NET_QUIC_CORE_QUIC_TYPES_H_ -#include <stddef.h> - #include <array> +#include <cstddef> #include <map> #include <ostream> #include <vector> @@ -15,6 +14,16 @@ #include "net/quic/core/quic_time.h" #include "net/quic/platform/api/quic_export.h" +#ifdef _MSC_VER +// MSVC 2013 and prior don't have alignof or aligned(); they have __alignof and +// a __declspec instead. +#define QUIC_ALIGN_OF __alignof +#define QUIC_ALIGNED(X) __declspec(align(X)) +#else +#define QUIC_ALIGN_OF alignof +#define QUIC_ALIGNED(X) __attribute__((aligned(X))) +#endif // _MSC_VER + namespace net { typedef uint8_t QuicPathId;
diff --git a/net/quic/core/quic_utils.h b/net/quic/core/quic_utils.h index 515d204..db8e834 100644 --- a/net/quic/core/quic_utils.h +++ b/net/quic/core/quic_utils.h
@@ -5,9 +5,8 @@ #ifndef NET_QUIC_CORE_QUIC_UTILS_H_ #define NET_QUIC_CORE_QUIC_UTILS_H_ -#include <stddef.h> -#include <stdint.h> - +#include <cstddef> +#include <cstdint> #include <string> #include "base/macros.h" @@ -18,16 +17,6 @@ #include "net/quic/platform/api/quic_export.h" #include "net/quic/platform/api/quic_socket_address.h" -#ifdef _MSC_VER -// MSVC 2013 and prior don't have alignof or aligned(); they have __alignof and -// a __declspec instead. -#define QUIC_ALIGN_OF __alignof -#define QUIC_ALIGNED(X) __declspec(align(X)) -#else -#define QUIC_ALIGN_OF alignof -#define QUIC_ALIGNED(X) __attribute__((aligned(X))) -#endif // _MSC_VER - namespace net { class QUIC_EXPORT_PRIVATE QuicUtils { @@ -88,6 +77,7 @@ // Returns a std::string containing hex and ASCII representations of |binary|, // side-by-side in the style of hexdump. Non-printable characters will be // printed as '.' in the ASCII output. + // For example: // "0x0000: 4865 6c6c 6f2c 2051 5549 4321 0102 0304 Hello,.QUIC!...." static std::string HexDump(base::StringPiece binary_data);
diff --git a/net/quic/core/quic_version_manager.cc b/net/quic/core/quic_version_manager.cc index 9a45c77..f266f0d 100644 --- a/net/quic/core/quic_version_manager.cc +++ b/net/quic/core/quic_version_manager.cc
@@ -10,9 +10,9 @@ namespace net { QuicVersionManager::QuicVersionManager(QuicVersionVector supported_versions) - : enable_version_37_(FLAGS_quic_enable_version_37), - enable_version_36_(FLAGS_quic_enable_version_36_v3), - disable_version_34_(FLAGS_quic_disable_version_34), + : enable_version_37_(FLAGS_quic_reloadable_flag_quic_enable_version_37), + enable_version_36_(FLAGS_quic_reloadable_flag_quic_enable_version_36_v3), + disable_version_34_(FLAGS_quic_reloadable_flag_quic_disable_version_34), allowed_supported_versions_(supported_versions), filtered_supported_versions_( FilterSupportedVersions(supported_versions)) {} @@ -25,12 +25,14 @@ } void QuicVersionManager::MaybeRefilterSupportedVersions() { - if (enable_version_37_ != FLAGS_quic_enable_version_37 || - enable_version_36_ != FLAGS_quic_enable_version_36_v3 || - disable_version_34_ != FLAGS_quic_disable_version_34) { - enable_version_37_ = FLAGS_quic_enable_version_37; - enable_version_36_ = FLAGS_quic_enable_version_36_v3; - disable_version_34_ = FLAGS_quic_disable_version_34; + if (enable_version_37_ != FLAGS_quic_reloadable_flag_quic_enable_version_37 || + enable_version_36_ != + FLAGS_quic_reloadable_flag_quic_enable_version_36_v3 || + disable_version_34_ != + FLAGS_quic_reloadable_flag_quic_disable_version_34) { + enable_version_37_ = FLAGS_quic_reloadable_flag_quic_enable_version_37; + enable_version_36_ = FLAGS_quic_reloadable_flag_quic_enable_version_36_v3; + disable_version_34_ = FLAGS_quic_reloadable_flag_quic_disable_version_34; RefilterSupportedVersions(); } }
diff --git a/net/quic/core/quic_version_manager.h b/net/quic/core/quic_version_manager.h index 348dbb4..89b8c79 100644 --- a/net/quic/core/quic_version_manager.h +++ b/net/quic/core/quic_version_manager.h
@@ -31,11 +31,11 @@ } private: - // FLAGS_quic_enable_version_37 + // FLAGS_quic_reloadable_flag_quic_enable_version_37 bool enable_version_37_; - // FLAGS_quic_enable_version_36_v3 + // FLAGS_quic_reloadable_flag_quic_enable_version_36_v3 bool enable_version_36_; - // FLAGS_quic_disable_version_34 + // FLAGS_quic_reloadable_flag_quic_disable_version_34 bool disable_version_34_; // The list of versions that may be supported. QuicVersionVector allowed_supported_versions_;
diff --git a/net/quic/core/quic_version_manager_test.cc b/net/quic/core/quic_version_manager_test.cc index 34173eb6..52ec489 100644 --- a/net/quic/core/quic_version_manager_test.cc +++ b/net/quic/core/quic_version_manager_test.cc
@@ -16,14 +16,14 @@ TEST(QuicVersionManagerTest, QuicVersionManager) { QuicFlagSaver flags; - FLAGS_quic_enable_version_36_v3 = false; - FLAGS_quic_enable_version_37 = false; - FLAGS_quic_disable_version_34 = false; + FLAGS_quic_reloadable_flag_quic_enable_version_36_v3 = false; + FLAGS_quic_reloadable_flag_quic_enable_version_37 = false; + FLAGS_quic_reloadable_flag_quic_disable_version_34 = false; QuicVersionManager manager(AllSupportedVersions()); EXPECT_EQ(FilterSupportedVersions(AllSupportedVersions()), manager.GetSupportedVersions()); - FLAGS_quic_enable_version_36_v3 = true; + FLAGS_quic_reloadable_flag_quic_enable_version_36_v3 = true; EXPECT_EQ(FilterSupportedVersions(AllSupportedVersions()), manager.GetSupportedVersions()); ASSERT_EQ(3u, manager.GetSupportedVersions().size()); @@ -31,7 +31,7 @@ EXPECT_EQ(QUIC_VERSION_35, manager.GetSupportedVersions()[1]); EXPECT_EQ(QUIC_VERSION_34, manager.GetSupportedVersions()[2]); - FLAGS_quic_enable_version_37 = true; + FLAGS_quic_reloadable_flag_quic_enable_version_37 = true; EXPECT_EQ(FilterSupportedVersions(AllSupportedVersions()), manager.GetSupportedVersions()); ASSERT_EQ(4u, manager.GetSupportedVersions().size()); @@ -40,7 +40,7 @@ EXPECT_EQ(QUIC_VERSION_35, manager.GetSupportedVersions()[2]); EXPECT_EQ(QUIC_VERSION_34, manager.GetSupportedVersions()[3]); - FLAGS_quic_disable_version_34 = true; + FLAGS_quic_reloadable_flag_quic_disable_version_34 = true; EXPECT_EQ(FilterSupportedVersions(AllSupportedVersions()), manager.GetSupportedVersions()); ASSERT_EQ(3u, manager.GetSupportedVersions().size());
diff --git a/net/quic/core/quic_versions.cc b/net/quic/core/quic_versions.cc index 4633209f..fc661d14 100644 --- a/net/quic/core/quic_versions.cc +++ b/net/quic/core/quic_versions.cc
@@ -33,15 +33,16 @@ filtered_versions.clear(); // Guaranteed by spec not to change capacity. for (QuicVersion version : versions) { if (version == QUIC_VERSION_37) { - if (FLAGS_quic_enable_version_37 && FLAGS_quic_enable_version_36_v3) { + if (FLAGS_quic_reloadable_flag_quic_enable_version_37 && + FLAGS_quic_reloadable_flag_quic_enable_version_36_v3) { filtered_versions.push_back(version); } } else if (version == QUIC_VERSION_36) { - if (FLAGS_quic_enable_version_36_v3) { + if (FLAGS_quic_reloadable_flag_quic_enable_version_36_v3) { filtered_versions.push_back(version); } } else if (version == QUIC_VERSION_34) { - if (!FLAGS_quic_disable_version_34) { + if (!FLAGS_quic_reloadable_flag_quic_disable_version_34) { filtered_versions.push_back(version); } } else {
diff --git a/net/quic/core/quic_versions.h b/net/quic/core/quic_versions.h index d3a567159..0ce3902 100644 --- a/net/quic/core/quic_versions.h +++ b/net/quic/core/quic_versions.h
@@ -30,7 +30,7 @@ QUIC_VERSION_36 = 36, // Add support to force HOL blocking. QUIC_VERSION_37 = 37, // Add perspective into null encryption. - // IMPORTANT: if you are adding to this std::list, follow the instructions at + // IMPORTANT: if you are adding to this list, follow the instructions at // http://sites/quic/adding-and-removing-versions };
diff --git a/net/quic/core/quic_versions_test.cc b/net/quic/core/quic_versions_test.cc index 40978c49..cb2df31 100644 --- a/net/quic/core/quic_versions_test.cc +++ b/net/quic/core/quic_versions_test.cc
@@ -130,9 +130,9 @@ QuicVersionVector all_versions = {QUIC_VERSION_34, QUIC_VERSION_35, QUIC_VERSION_36, QUIC_VERSION_37}; - FLAGS_quic_disable_version_34 = true; - FLAGS_quic_enable_version_36_v3 = false; - FLAGS_quic_enable_version_37 = false; + FLAGS_quic_reloadable_flag_quic_disable_version_34 = true; + FLAGS_quic_reloadable_flag_quic_enable_version_36_v3 = false; + FLAGS_quic_reloadable_flag_quic_enable_version_37 = false; QuicVersionVector filtered_versions = FilterSupportedVersions(all_versions); ASSERT_EQ(1u, filtered_versions.size()); @@ -144,9 +144,9 @@ QuicVersionVector all_versions = {QUIC_VERSION_34, QUIC_VERSION_35, QUIC_VERSION_36, QUIC_VERSION_37}; - FLAGS_quic_disable_version_34 = false; - FLAGS_quic_enable_version_36_v3 = false; - FLAGS_quic_enable_version_37 = false; + FLAGS_quic_reloadable_flag_quic_disable_version_34 = false; + FLAGS_quic_reloadable_flag_quic_enable_version_36_v3 = false; + FLAGS_quic_reloadable_flag_quic_enable_version_37 = false; QuicVersionVector filtered_versions = FilterSupportedVersions(all_versions); ASSERT_EQ(2u, filtered_versions.size()); @@ -159,9 +159,9 @@ QuicVersionVector all_versions = {QUIC_VERSION_34, QUIC_VERSION_35, QUIC_VERSION_36, QUIC_VERSION_37}; - FLAGS_quic_disable_version_34 = false; - FLAGS_quic_enable_version_36_v3 = true; - FLAGS_quic_enable_version_37 = false; + FLAGS_quic_reloadable_flag_quic_disable_version_34 = false; + FLAGS_quic_reloadable_flag_quic_enable_version_36_v3 = true; + FLAGS_quic_reloadable_flag_quic_enable_version_37 = false; QuicVersionVector filtered_versions = FilterSupportedVersions(all_versions); ASSERT_EQ(3u, filtered_versions.size()); @@ -175,9 +175,9 @@ QuicVersionVector all_versions = {QUIC_VERSION_34, QUIC_VERSION_35, QUIC_VERSION_36, QUIC_VERSION_37}; - FLAGS_quic_disable_version_34 = false; - FLAGS_quic_enable_version_36_v3 = true; - FLAGS_quic_enable_version_37 = true; + FLAGS_quic_reloadable_flag_quic_disable_version_34 = false; + FLAGS_quic_reloadable_flag_quic_enable_version_36_v3 = true; + FLAGS_quic_reloadable_flag_quic_enable_version_37 = true; QuicVersionVector filtered_versions = FilterSupportedVersions(all_versions); ASSERT_EQ(all_versions, filtered_versions);
diff --git a/net/quic/core/quic_write_blocked_list.h b/net/quic/core/quic_write_blocked_list.h index 02f87f9..f26491d6 100644 --- a/net/quic/core/quic_write_blocked_list.h +++ b/net/quic/core/quic_write_blocked_list.h
@@ -5,13 +5,10 @@ #ifndef NET_QUIC_CORE_QUIC_WRITE_BLOCKED_LIST_H_ #define NET_QUIC_CORE_QUIC_WRITE_BLOCKED_LIST_H_ -#include <stddef.h> -#include <stdint.h> - -#include <set> +#include <cstddef> +#include <cstdint> #include "base/macros.h" -#include "net/quic/core/quic_flags.h" #include "net/quic/core/quic_packets.h" #include "net/quic/platform/api/quic_export.h" #include "net/spdy/priority_write_scheduler.h" @@ -123,9 +120,9 @@ } } - // Pushes a stream to the back of the list for its priority level *unless* - // it is latched for doing batched writes in which case it goes to the front - // of the list for its priority level. + // Pushes a stream to the back of the list for its priority level *unless* it + // is latched for doing batched writes in which case it goes to the front of + // the list for its priority level. // Headers and crypto streams are special cased to always resume first. void AddStream(QuicStreamId stream_id) { if (stream_id == kCryptoStreamId) {
diff --git a/net/quic/core/spdy_utils.h b/net/quic/core/spdy_utils.h index ce24c1b..752bd77 100644 --- a/net/quic/core/spdy_utils.h +++ b/net/quic/core/spdy_utils.h
@@ -5,10 +5,8 @@ #ifndef NET_QUIC_CORE_SPDY_UTILS_H_ #define NET_QUIC_CORE_SPDY_UTILS_H_ -#include <stddef.h> -#include <stdint.h> - -#include <map> +#include <cstddef> +#include <cstdint> #include <string> #include "base/macros.h" @@ -24,8 +22,8 @@ static std::string SerializeUncompressedHeaders( const SpdyHeaderBlock& headers); - // Parses |data| as a std::string containing serialized HTTP/2 HEADERS frame, - // populating |headers| with the key->value std:pairs found. + // Parses |data| as a string containing serialized HTTP/2 HEADERS frame, + // populating |headers| with the key->value pairs found. // |content_length| will be populated with the value of the content-length // header if one or more are present. // Returns true on success, false if parsing fails, or invalid keys are found. @@ -40,8 +38,8 @@ static bool ExtractContentLengthFromHeaders(int64_t* content_length, SpdyHeaderBlock* headers); - // Parses |data| as a std::string containing serialized HTTP/2 HEADERS frame, - // populating |trailers| with the key->value std:pairs found. + // Parses |data| as a string containing serialized HTTP/2 HEADERS frame, + // populating |trailers| with the key->value pairs found. // The final offset header will be excluded from |trailers|, and instead the // value will be copied to |final_byte_offset|. // Returns true on success, false if parsing fails, or invalid keys are found. @@ -64,14 +62,14 @@ // Returns URL composed from scheme, authority, and path header // values, or empty string if any of those fields are missing. - static std::string GetUrlFromHeaderBlock(const net::SpdyHeaderBlock& headers); + static std::string GetUrlFromHeaderBlock(const SpdyHeaderBlock& headers); - // Returns hostname, or empty std::string if missing. + // Returns hostname, or empty string if missing. static std::string GetHostNameFromHeaderBlock(const SpdyHeaderBlock& headers); // Returns true if result of |GetUrlFromHeaderBlock()| is non-empty // and is a well-formed URL. - static bool UrlIsValid(const net::SpdyHeaderBlock& headers); + static bool UrlIsValid(const SpdyHeaderBlock& headers); // Populates the fields of |headers| to make a GET request of |url|, // which must be fully-qualified.
diff --git a/net/quic/test_tools/crypto_test_utils.h b/net/quic/test_tools/crypto_test_utils.h index 7189ae1..1d2b833 100644 --- a/net/quic/test_tools/crypto_test_utils.h +++ b/net/quic/test_tools/crypto_test_utils.h
@@ -5,10 +5,9 @@ #ifndef NET_QUIC_TEST_TOOLS_CRYPTO_TEST_UTILS_H_ #define NET_QUIC_TEST_TOOLS_CRYPTO_TEST_UTILS_H_ -#include <stdarg.h> -#include <stddef.h> -#include <stdint.h> - +#include <cstdarg> +#include <cstddef> +#include <cstdint> #include <utility> #include <vector> @@ -153,9 +152,6 @@ // Returns a new |ProofVerifier| that uses the QUIC testing root CA. static std::unique_ptr<ProofVerifier> ProofVerifierForTesting(); - // Returns a real ProofVerifier (not a fake proof verifier) for testing. - static std::unique_ptr<ProofVerifier> RealProofVerifierForTesting(); - // Returns a hash of the leaf test certificate. static uint64_t LeafCertHashForTesting(); @@ -210,7 +206,7 @@ PacketSavingConnection* dest_conn, Perspective dest_perspective); - // Return an inchoate CHLO with some basic tag value std:pairs. + // Return an inchoate CHLO with some basic tag value pairs. static CryptoHandshakeMessage GenerateDefaultInchoateCHLO( const QuicClock* clock, QuicVersion version,
diff --git a/net/quic/test_tools/quic_connection_peer.cc b/net/quic/test_tools/quic_connection_peer.cc index 43234d2..a4d58f1 100644 --- a/net/quic/test_tools/quic_connection_peer.cc +++ b/net/quic/test_tools/quic_connection_peer.cc
@@ -73,7 +73,7 @@ QuicSentPacketManager* QuicConnectionPeer::GetSentPacketManager( QuicConnection* connection, QuicPathId path_id) { - if (FLAGS_quic_enable_multipath) { + if (FLAGS_quic_reloadable_flag_quic_enable_multipath) { return static_cast<QuicSentPacketManager*>( static_cast<QuicMultipathSentPacketManager*>( connection->sent_packet_manager_.get())
diff --git a/net/quic/test_tools/quic_crypto_server_config_peer.h b/net/quic/test_tools/quic_crypto_server_config_peer.h index 1f522d3..bd26a95 100644 --- a/net/quic/test_tools/quic_crypto_server_config_peer.h +++ b/net/quic/test_tools/quic_crypto_server_config_peer.h
@@ -59,8 +59,7 @@ // CheckConfigs compares the state of the Configs in |server_config_| to the // description given as arguments. The arguments are given as - // nullptr-terminated std:pairs. The first of each std:pair is the server - // config ID of + // nullptr-terminated pairs. The first of each pair is the server config ID of // a Config. The second is a boolean describing whether the config is the // primary. For example: // CheckConfigs(nullptr); // checks that no Configs are loaded. @@ -74,8 +73,7 @@ // nullptr); void CheckConfigs(const char* server_config_id1, ...); - // ConfigsDebug returns a std::string that contains debugging information - // about + // ConfigsDebug returns a string that contains debugging information about // the set of Configs loaded in |server_config_| and their status. std::string ConfigsDebug();
diff --git a/net/quic/test_tools/quic_stream_sequencer_buffer_peer.cc b/net/quic/test_tools/quic_stream_sequencer_buffer_peer.cc index bc0bf43..422d3882 100644 --- a/net/quic/test_tools/quic_stream_sequencer_buffer_peer.cc +++ b/net/quic/test_tools/quic_stream_sequencer_buffer_peer.cc
@@ -41,7 +41,7 @@ } bool QuicStreamSequencerBufferPeer::IsBlockArrayEmpty() { - if (FLAGS_quic_reduce_sequencer_buffer_memory_life_time && // NOLINT + if (FLAGS_quic_reloadable_flag_quic_reduce_sequencer_buffer_memory_life_time && // NOLINT buffer_->blocks_ == nullptr) { return true; }
diff --git a/net/quic/test_tools/quic_test_utils.cc b/net/quic/test_tools/quic_test_utils.cc index 2046051f..c0bb8914 100644 --- a/net/quic/test_tools/quic_test_utils.cc +++ b/net/quic/test_tools/quic_test_utils.cc
@@ -427,9 +427,10 @@ TestQuicSpdyServerSession::CreateQuicCryptoServerStream( const QuicCryptoServerConfig* crypto_config, QuicCompressedCertsCache* compressed_certs_cache) { - return new QuicCryptoServerStream(crypto_config, compressed_certs_cache, - FLAGS_enable_quic_stateless_reject_support, - this, &helper_); + return new QuicCryptoServerStream( + crypto_config, compressed_certs_cache, + FLAGS_quic_reloadable_flag_enable_quic_stateless_reject_support, this, + &helper_); } QuicCryptoServerStream* TestQuicSpdyServerSession::GetCryptoStream() {
diff --git a/net/tools/quic/end_to_end_test.cc b/net/tools/quic/end_to_end_test.cc index 470fe25..e6b558db 100644 --- a/net/tools/quic/end_to_end_test.cc +++ b/net/tools/quic/end_to_end_test.cc
@@ -378,11 +378,11 @@ // client as well according to the test parameter. copt.push_back(GetParam().congestion_control_tag); if (GetParam().congestion_control_tag == kQBIC && - FLAGS_quic_fix_cubic_convex_mode) { + FLAGS_quic_reloadable_flag_quic_fix_cubic_convex_mode) { copt.push_back(kCCVX); } if (GetParam().congestion_control_tag == kQBIC && - FLAGS_quic_fix_cubic_bytes_quantization) { + FLAGS_quic_reloadable_flag_quic_fix_cubic_bytes_quantization) { copt.push_back(kCBQT); } if (support_server_push_) { @@ -431,7 +431,7 @@ } void StartServer() { - FLAGS_quic_use_cheap_stateless_rejects = + FLAGS_quic_reloadable_flag_quic_use_cheap_stateless_rejects = GetParam().use_cheap_stateless_reject; auto test_server = new QuicTestServer( @@ -448,7 +448,7 @@ QuicServerPeer::GetDispatcher(server_thread_->server()); QuicDispatcherPeer::UseWriter(dispatcher, server_writer_); - FLAGS_enable_quic_stateless_reject_support = + FLAGS_quic_reloadable_flag_enable_quic_stateless_reject_support = GetParam().server_uses_stateless_rejects_if_peer_supported; server_writer_->Initialize(QuicDispatcherPeer::GetHelper(dispatcher), @@ -593,18 +593,20 @@ QuicCryptoStream* crypto_stream = QuicSessionPeer::GetCryptoStream(client_->client()->session()); QuicStreamSequencer* sequencer = QuicStreamPeer::sequencer(crypto_stream); - EXPECT_NE(FLAGS_quic_release_crypto_stream_buffer && - FLAGS_quic_reduce_sequencer_buffer_memory_life_time, // NOLINT - QuicStreamSequencerPeer::IsUnderlyingBufferAllocated(sequencer)); + EXPECT_NE( + FLAGS_quic_reloadable_flag_quic_release_crypto_stream_buffer && + FLAGS_quic_reloadable_flag_quic_reduce_sequencer_buffer_memory_life_time, // NOLINT + QuicStreamSequencerPeer::IsUnderlyingBufferAllocated(sequencer)); server_thread_->Pause(); QuicDispatcher* dispatcher = QuicServerPeer::GetDispatcher(server_thread_->server()); QuicSession* server_session = dispatcher->session_map().begin()->second.get(); crypto_stream = QuicSessionPeer::GetCryptoStream(server_session); sequencer = QuicStreamPeer::sequencer(crypto_stream); - EXPECT_NE(FLAGS_quic_release_crypto_stream_buffer && - FLAGS_quic_reduce_sequencer_buffer_memory_life_time, // NOLINT - QuicStreamSequencerPeer::IsUnderlyingBufferAllocated(sequencer)); + EXPECT_NE( + FLAGS_quic_reloadable_flag_quic_release_crypto_stream_buffer && + FLAGS_quic_reloadable_flag_quic_reduce_sequencer_buffer_memory_life_time, // NOLINT + QuicStreamSequencerPeer::IsUnderlyingBufferAllocated(sequencer)); } TEST_P(EndToEndTest, SimpleRequestResponsev6) { @@ -1156,7 +1158,7 @@ headers["key3"] = string(15 * 1024, 'a'); client_->SendCustomSynchronousRequest(headers, body); - if (FLAGS_quic_limit_uncompressed_headers) { + if (FLAGS_quic_reloadable_flag_quic_limit_uncompressed_headers) { EXPECT_EQ(QUIC_HEADERS_TOO_LARGE, client_->stream_error()); } else { EXPECT_EQ(QUIC_STREAM_NO_ERROR, client_->stream_error()); @@ -1322,10 +1324,10 @@ } TEST_P(EndToEndTest, NegotiateCongestionControl) { - FLAGS_quic_allow_new_bbr = true; + FLAGS_quic_reloadable_flag_quic_allow_new_bbr = true; // Disable this flag because if connection uses multipath sent packet manager, // static_cast here does not work. - FLAGS_quic_enable_multipath = false; + FLAGS_quic_reloadable_flag_quic_enable_multipath = false; ASSERT_TRUE(Initialize()); EXPECT_TRUE(client_->client()->WaitForCryptoHandshakeConfirmed()); @@ -1708,7 +1710,7 @@ // Test negotiation of IFWA connection option. TEST_P(EndToEndTest, NegotiatedServerInitialFlowControlWindow) { - FLAGS_quic_large_ifw_options = true; + FLAGS_quic_reloadable_flag_quic_large_ifw_options = true; const uint32_t kClientStreamIFCW = 123456; const uint32_t kClientSessionIFCW = 234567; @@ -1834,7 +1836,7 @@ QuicSpdySessionPeer::GetHeadersStream(client_session)->flow_controller(); QuicFlowController* server_header_stream_flow_controller = QuicSpdySessionPeer::GetHeadersStream(server_session)->flow_controller(); - if (FLAGS_quic_send_max_header_list_size) { + if (FLAGS_quic_reloadable_flag_quic_send_max_header_list_size) { // Both client and server are sending this SETTINGS frame, and the send // window is consumed. But because of timing issue, the server may send or // not send the frame, and the client may send/ not send / receive / not @@ -1859,7 +1861,7 @@ } if (!client_session->force_hol_blocking()) { - if (FLAGS_quic_send_max_header_list_size) { + if (FLAGS_quic_reloadable_flag_quic_send_max_header_list_size) { // Client *may* have received the SETTINGs frame. // TODO(fayang): Rewrite this part because it is hacky. float ratio1 = @@ -2691,9 +2693,10 @@ DVLOG(1) << "response body " << response_body; EXPECT_EQ(expected_body, response_body); } - EXPECT_NE(FLAGS_quic_headers_stream_release_sequencer_buffer && - FLAGS_quic_reduce_sequencer_buffer_memory_life_time, // NOLINT - QuicStreamSequencerPeer::IsUnderlyingBufferAllocated(sequencer)); + EXPECT_NE( + FLAGS_quic_reloadable_flag_quic_headers_stream_release_sequencer_buffer && + FLAGS_quic_reloadable_flag_quic_reduce_sequencer_buffer_memory_life_time, // NOLINT + QuicStreamSequencerPeer::IsUnderlyingBufferAllocated(sequencer)); } TEST_P(EndToEndTestServerPush, ServerPushUnderLimit) { @@ -2873,9 +2876,9 @@ } // TODO(ckrasic) - remove this when deprecating -// FLAGS_quic_enable_server_push_by_default. +// FLAGS_quic_reloadable_flag_quic_enable_server_push_by_default. TEST_P(EndToEndTestServerPush, DisabledWithoutConnectionOption) { - FLAGS_quic_enable_server_push_by_default = false; + FLAGS_quic_reloadable_flag_quic_enable_server_push_by_default = false; // Tests that server push won't be triggered when kSPSH is not set by client. support_server_push_ = false; ASSERT_TRUE(Initialize()); @@ -2995,9 +2998,10 @@ QuicHeadersStream* headers_stream = QuicSpdySessionPeer::GetHeadersStream(client_->client()->session()); QuicStreamSequencer* sequencer = QuicStreamPeer::sequencer(headers_stream); - EXPECT_NE(FLAGS_quic_headers_stream_release_sequencer_buffer && - FLAGS_quic_reduce_sequencer_buffer_memory_life_time, // NOLINT - QuicStreamSequencerPeer::IsUnderlyingBufferAllocated(sequencer)); + EXPECT_NE( + FLAGS_quic_reloadable_flag_quic_headers_stream_release_sequencer_buffer && + FLAGS_quic_reloadable_flag_quic_reduce_sequencer_buffer_memory_life_time, // NOLINT + QuicStreamSequencerPeer::IsUnderlyingBufferAllocated(sequencer)); } class EndToEndBufferedPacketsTest : public EndToEndTest {
diff --git a/net/tools/quic/quic_client_base.cc b/net/tools/quic/quic_client_base.cc index 1b7ed1e..d6b30d8 100644 --- a/net/tools/quic/quic_client_base.cc +++ b/net/tools/quic/quic_client_base.cc
@@ -115,7 +115,8 @@ while (EncryptionBeingEstablished()) { WaitForEvents(); } - if (FLAGS_enable_quic_stateless_reject_support && connected()) { + if (FLAGS_quic_reloadable_flag_enable_quic_stateless_reject_support && + connected()) { // Resend any previously queued data. ResendSavedData(); } @@ -269,7 +270,7 @@ DCHECK(session() != nullptr); if (!connected() && session()->error() == QUIC_CRYPTO_HANDSHAKE_STATELESS_REJECT) { - DCHECK(FLAGS_enable_quic_stateless_reject_support); + DCHECK(FLAGS_quic_reloadable_flag_enable_quic_stateless_reject_support); DVLOG(1) << "Detected stateless reject while waiting for events. " << "Attempting to reconnect."; Connect(); @@ -392,7 +393,7 @@ void QuicClientBase::MaybeAddDataToResend(const SpdyHeaderBlock& headers, StringPiece body, bool fin) { - if (!FLAGS_enable_quic_stateless_reject_support) { + if (!FLAGS_quic_reloadable_flag_enable_quic_stateless_reject_support) { return; }
diff --git a/net/tools/quic/quic_dispatcher.cc b/net/tools/quic/quic_dispatcher.cc index b876097..a361dba 100644 --- a/net/tools/quic/quic_dispatcher.cc +++ b/net/tools/quic/quic_dispatcher.cc
@@ -271,14 +271,14 @@ return false; } - if (FLAGS_quic_buffer_packets_after_chlo && + if (FLAGS_quic_reloadable_flag_quic_buffer_packets_after_chlo && buffered_packets_.HasChloForConnection(connection_id)) { BufferEarlyPacket(connection_id); return false; } // Check if we are buffering packets for this connection ID - if (FLAGS_enable_async_get_proof && + if (FLAGS_quic_reloadable_flag_enable_async_get_proof && (temporarily_buffered_connections_.find(connection_id) != temporarily_buffered_connections_.end())) { // This packet was received while the a CHLO for the same connection ID was @@ -310,7 +310,7 @@ QuicVersion version = GetSupportedVersions().front(); if (header.version_flag) { QuicVersion packet_version = header.versions.front(); - if (FLAGS_quic_fix_version_manager && + if (FLAGS_quic_reloadable_flag_quic_fix_version_manager && framer_.supported_versions() != GetSupportedVersions()) { // Reset framer's version if version flags change in flight. framer_.SetSupportedVersions(GetSupportedVersions()); @@ -373,7 +373,7 @@ case kFateTimeWait: // MaybeRejectStatelessly or OnExpiredPackets might have already added the // connection to time wait, in which case it should not be added again. - if (!FLAGS_quic_use_cheap_stateless_rejects || + if (!FLAGS_quic_reloadable_flag_quic_use_cheap_stateless_rejects || !time_wait_list_manager_->IsConnectionIdInTimeWait(connection_id)) { // Add this connection_id to the time-wait state, to safely reject // future packets. @@ -388,7 +388,7 @@ current_server_address_, current_client_address_, connection_id, packet_number, *current_packet_); - if (FLAGS_enable_async_get_proof) { + if (FLAGS_quic_reloadable_flag_enable_async_get_proof) { // Any packets which were buffered while the stateless rejector logic // was running should be discarded. Do not inform the time wait list // manager, which should already have a made a decision about sending a @@ -703,7 +703,8 @@ void QuicDispatcher::BufferEarlyPacket(QuicConnectionId connection_id) { bool is_new_connection = !buffered_packets_.HasBufferedPackets(connection_id); - if (FLAGS_quic_create_session_after_insertion && is_new_connection && + if (FLAGS_quic_reloadable_flag_quic_create_session_after_insertion && + is_new_connection && !ShouldCreateOrBufferPacketForConnection(connection_id)) { return; } @@ -712,19 +713,20 @@ current_client_address_, /*is_chlo=*/false); if (rs != EnqueuePacketResult::SUCCESS) { OnBufferPacketFailure(rs, connection_id); - } else if (!FLAGS_quic_create_session_after_insertion && is_new_connection) { + } else if (!FLAGS_quic_reloadable_flag_quic_create_session_after_insertion && + is_new_connection) { ShouldCreateOrBufferPacketForConnection(connection_id); } } void QuicDispatcher::ProcessChlo() { - if (FLAGS_quic_create_session_after_insertion && + if (FLAGS_quic_reloadable_flag_quic_create_session_after_insertion && !buffered_packets_.HasBufferedPackets(current_connection_id_) && !ShouldCreateOrBufferPacketForConnection(current_connection_id_)) { return; } if (FLAGS_quic_allow_chlo_buffering && - FLAGS_quic_limit_num_new_sessions_per_epoll_loop && + FLAGS_quic_reloadable_flag_quic_limit_num_new_sessions_per_epoll_loop && new_sessions_allowed_per_event_loop_ <= 0) { // Can't create new session any more. Wait till next event loop. if (!buffered_packets_.HasChloForConnection(current_connection_id_)) { @@ -739,8 +741,9 @@ current_client_address_, /*is_chlo=*/true); if (rs != EnqueuePacketResult::SUCCESS) { OnBufferPacketFailure(rs, current_connection_id_); - } else if (!FLAGS_quic_create_session_after_insertion && - is_new_connection) { + } else if ( + !FLAGS_quic_reloadable_flag_quic_create_session_after_insertion && + is_new_connection) { ShouldCreateOrBufferPacketForConnection(current_connection_id_); } } @@ -755,7 +758,8 @@ std::list<BufferedPacket> packets = buffered_packets_.DeliverPackets(current_connection_id_); // Check if CHLO is the first packet arrived on this connection. - if (!FLAGS_quic_create_session_after_insertion && packets.empty()) { + if (!FLAGS_quic_reloadable_flag_quic_create_session_after_insertion && + packets.empty()) { ShouldCreateOrBufferPacketForConnection(current_connection_id_); } // Process CHLO at first. @@ -765,7 +769,7 @@ // Do this even when flag is off because there might be still some packets // buffered in the store before flag is turned off. DeliverPacketsToSession(packets, session); - if (FLAGS_quic_limit_num_new_sessions_per_epoll_loop) { + if (FLAGS_quic_reloadable_flag_quic_limit_num_new_sessions_per_epoll_loop) { --new_sessions_allowed_per_event_loop_; } } @@ -833,8 +837,8 @@ const QuicPacketHeader& header) { // TODO(rch): This logic should probably live completely inside the rejector. if (!FLAGS_quic_allow_chlo_buffering || - !FLAGS_quic_use_cheap_stateless_rejects || - !FLAGS_enable_quic_stateless_reject_support || + !FLAGS_quic_reloadable_flag_quic_use_cheap_stateless_rejects || + !FLAGS_quic_reloadable_flag_enable_quic_stateless_reject_support || !ShouldAttemptCheapStatelessRejection()) { // Not use cheap stateless reject. if (FLAGS_quic_allow_chlo_buffering && @@ -885,7 +889,7 @@ } // Insert into set of connection IDs to buffer - if (FLAGS_enable_async_get_proof) { + if (FLAGS_quic_reloadable_flag_enable_async_get_proof) { const bool ok = temporarily_buffered_connections_.insert(connection_id).second; QUIC_BUG_IF(!ok) @@ -907,7 +911,7 @@ std::unique_ptr<QuicReceivedPacket> current_packet, QuicPacketNumber packet_number, QuicVersion first_version) { - if (FLAGS_enable_async_get_proof) { + if (FLAGS_quic_reloadable_flag_enable_async_get_proof) { // Stop buffering packets on this connection const auto num_erased = temporarily_buffered_connections_.erase(rejector->connection_id());
diff --git a/net/tools/quic/quic_dispatcher.h b/net/tools/quic/quic_dispatcher.h index ab724db..527eaa5b 100644 --- a/net/tools/quic/quic_dispatcher.h +++ b/net/tools/quic/quic_dispatcher.h
@@ -30,14 +30,13 @@ #include "net/tools/quic/stateless_rejector.h" namespace net { - -class QuicConfig; -class QuicCryptoServerConfig; - namespace test { class QuicDispatcherPeer; } // namespace test +class QuicConfig; +class QuicCryptoServerConfig; + class QuicDispatcher : public QuicTimeWaitListManager::Visitor, public ProcessPacketInterface, public QuicBlockedWriterInterface, @@ -63,7 +62,7 @@ void InitializeWithWriter(QuicPacketWriter* writer); // Process the incoming packet by creating a new session, passing it to - // an existing session, or passing it to the time wait std::list. + // an existing session, or passing it to the time wait list. void ProcessPacket(const QuicSocketAddress& server_address, const QuicSocketAddress& client_address, const QuicReceivedPacket& packet) override; @@ -90,9 +89,8 @@ void OnWriteBlocked(QuicBlockedWriterInterface* blocked_writer) override; // QuicTimeWaitListManager::Visitor interface implementation - // Called whenever the time wait std::list manager adds a new connection to - // the - // time-wait std::list. + // Called whenever the time wait list manager adds a new connection to the + // time-wait list. void OnConnectionAddedToTimeWaitList(QuicConnectionId connection_id) override; using SessionMap = @@ -276,7 +274,7 @@ QuicConnectionId connection_id); private: - friend class net::test::QuicDispatcherPeer; + friend class test::QuicDispatcherPeer; friend class StatelessRejectorProcessDoneCallback; typedef std::unordered_set<QuicConnectionId> QuicConnectionIdSet; @@ -344,7 +342,7 @@ // Entity that manages connection_ids in time wait state. std::unique_ptr<QuicTimeWaitListManager> time_wait_list_manager_; - // The std::list of closed but not-yet-deleted sessions. + // The list of closed but not-yet-deleted sessions. std::vector<std::unique_ptr<QuicSession>> closed_session_list_; // The helper used for all connections.
diff --git a/net/tools/quic/quic_dispatcher_test.cc b/net/tools/quic/quic_dispatcher_test.cc index f3c7226..f1e7853f 100644 --- a/net/tools/quic/quic_dispatcher_test.cc +++ b/net/tools/quic/quic_dispatcher_test.cc
@@ -86,7 +86,8 @@ QuicCompressedCertsCache* compressed_certs_cache) override { return new QuicCryptoServerStream( crypto_config, compressed_certs_cache, - FLAGS_enable_quic_stateless_reject_support, this, stream_helper()); + FLAGS_quic_reloadable_flag_enable_quic_stateless_reject_support, this, + stream_helper()); } void SetCryptoStream(QuicCryptoServerStream* crypto_stream) { @@ -534,10 +535,10 @@ TEST_F(QuicDispatcherTest, SupportedVersionsChangeInFlight) { static_assert(arraysize(kSupportedQuicVersions) == 4u, "Supported versions out of sync"); - FLAGS_quic_fix_version_manager = true; - FLAGS_quic_disable_version_34 = false; - FLAGS_quic_enable_version_36_v3 = true; - FLAGS_quic_enable_version_37 = true; + FLAGS_quic_reloadable_flag_quic_fix_version_manager = true; + FLAGS_quic_reloadable_flag_quic_disable_version_34 = false; + FLAGS_quic_reloadable_flag_quic_enable_version_36_v3 = true; + FLAGS_quic_reloadable_flag_quic_enable_version_37 = true; QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 1); server_address_ = QuicSocketAddress(QuicIpAddress::Any4(), 5); QuicConnectionId connection_id = 1; @@ -576,7 +577,7 @@ SerializeCHLO(), PACKET_8BYTE_CONNECTION_ID, PACKET_6BYTE_PACKET_NUMBER, 1); // Turn off version 36. - FLAGS_quic_enable_version_36_v3 = false; + FLAGS_quic_reloadable_flag_quic_enable_version_36_v3 = false; ++connection_id; EXPECT_CALL(*dispatcher_, CreateQuicSession(connection_id, client_address)) .Times(0); @@ -585,7 +586,7 @@ PACKET_6BYTE_PACKET_NUMBER, 1); // Turn on version 36. - FLAGS_quic_enable_version_36_v3 = true; + FLAGS_quic_reloadable_flag_quic_enable_version_36_v3 = true; ++connection_id; EXPECT_CALL(*dispatcher_, CreateQuicSession(connection_id, client_address)) .WillOnce(testing::Return(CreateSession( @@ -602,7 +603,7 @@ PACKET_6BYTE_PACKET_NUMBER, 1); // Turn off version 34. - FLAGS_quic_disable_version_34 = true; + FLAGS_quic_reloadable_flag_quic_disable_version_34 = true; ++connection_id; EXPECT_CALL(*dispatcher_, CreateQuicSession(connection_id, client_address)) .Times(0); @@ -611,7 +612,7 @@ PACKET_6BYTE_PACKET_NUMBER, 1); // Turn on version 34. - FLAGS_quic_disable_version_34 = false; + FLAGS_quic_reloadable_flag_quic_disable_version_34 = false; ++connection_id; EXPECT_CALL(*dispatcher_, CreateQuicSession(connection_id, client_address)) .WillOnce(testing::Return(CreateSession( @@ -635,11 +636,12 @@ QuicCompressedCertsCache* compressed_certs_cache, QuicServerSessionBase* session, QuicCryptoServerStream::Helper* helper) - : QuicCryptoServerStream(&crypto_config, - compressed_certs_cache, - FLAGS_enable_quic_stateless_reject_support, - session, - helper) {} + : QuicCryptoServerStream( + &crypto_config, + compressed_certs_cache, + FLAGS_quic_reloadable_flag_enable_quic_stateless_reject_support, + session, + helper) {} void set_handshake_confirmed_for_testing(bool handshake_confirmed) { handshake_confirmed_ = handshake_confirmed; } @@ -708,7 +710,7 @@ // crypto_stream1_. void SetUp() override { QuicDispatcherTest::SetUp(); - FLAGS_enable_quic_stateless_reject_support = + FLAGS_quic_reloadable_flag_enable_quic_stateless_reject_support = GetParam().enable_stateless_rejects_via_flag; } @@ -795,7 +797,7 @@ } TEST_P(QuicDispatcherStatelessRejectTest, CheapRejects) { - FLAGS_quic_use_cheap_stateless_rejects = true; + FLAGS_quic_reloadable_flag_quic_use_cheap_stateless_rejects = true; CreateTimeWaitListManager(); QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 1); @@ -838,7 +840,7 @@ } TEST_P(QuicDispatcherStatelessRejectTest, BufferNonChlo) { - FLAGS_quic_use_cheap_stateless_rejects = true; + FLAGS_quic_reloadable_flag_quic_use_cheap_stateless_rejects = true; CreateTimeWaitListManager(); const QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 1); @@ -1156,9 +1158,9 @@ : QuicDispatcherTest(), client_addr_(QuicIpAddress::Loopback4(), 1234), signed_config_(new QuicSignedServerConfig) { - FLAGS_quic_use_cheap_stateless_rejects = + FLAGS_quic_reloadable_flag_quic_use_cheap_stateless_rejects = GetParam().support_cheap_stateless_reject; - FLAGS_enable_quic_stateless_reject_support = + FLAGS_quic_reloadable_flag_enable_quic_stateless_reject_support = GetParam().enable_stateless_rejects_via_flag; } @@ -1239,14 +1241,15 @@ InSequence s; server_address_ = QuicSocketAddress(QuicIpAddress::Any4(), 5); // A bunch of non-CHLO should be buffered upon arrival. - size_t kNumConnections = (FLAGS_quic_limit_num_new_sessions_per_epoll_loop - ? kMaxConnectionsWithoutCHLO - : kDefaultMaxConnectionsInStore) + - 1; + size_t kNumConnections = + (FLAGS_quic_reloadable_flag_quic_limit_num_new_sessions_per_epoll_loop + ? kMaxConnectionsWithoutCHLO + : kDefaultMaxConnectionsInStore) + + 1; for (size_t i = 1; i <= kNumConnections; ++i) { QuicSocketAddress client_address(QuicIpAddress::Loopback4(), i); QuicConnectionId conn_id = i; - if (FLAGS_quic_create_session_after_insertion) { + if (FLAGS_quic_reloadable_flag_quic_create_session_after_insertion) { EXPECT_CALL(*dispatcher_, ShouldCreateOrBufferPacketForConnection(conn_id)); } else { @@ -1277,7 +1280,7 @@ for (size_t i = 1; i <= kNumConnections; ++i) { QuicSocketAddress client_address(QuicIpAddress::Loopback4(), i); QuicConnectionId conn_id = i; - if (FLAGS_quic_create_session_after_insertion && + if (FLAGS_quic_reloadable_flag_quic_create_session_after_insertion && conn_id == kNumConnections) { // The last CHLO should trigger ShouldCreateOrBufferPacketForConnection() // since it's the @@ -1290,7 +1293,7 @@ dispatcher_.get(), config_, conn_id, client_address, &mock_helper_, &mock_alarm_factory_, &crypto_config_, QuicDispatcherPeer::GetCache(dispatcher_.get()), &session1_))); - if (!FLAGS_quic_create_session_after_insertion && + if (!FLAGS_quic_reloadable_flag_quic_create_session_after_insertion && conn_id == kNumConnections) { // The last CHLO should trigger ShouldCreateOrBufferPacketForConnection() // since it's the first packet arrives on that connection. @@ -1299,9 +1302,10 @@ } // First |kNumConnections| - 1 connections should have buffered // a packet in store. The rest should have been dropped. - size_t upper_limit = FLAGS_quic_limit_num_new_sessions_per_epoll_loop - ? kMaxConnectionsWithoutCHLO - : kDefaultMaxConnectionsInStore; + size_t upper_limit = + FLAGS_quic_reloadable_flag_quic_limit_num_new_sessions_per_epoll_loop + ? kMaxConnectionsWithoutCHLO + : kDefaultMaxConnectionsInStore; size_t num_packet_to_process = i <= upper_limit ? 2u : 1u; EXPECT_CALL(*reinterpret_cast<MockQuicConnection*>(session1_->connection()), ProcessUdpPacket(_, client_address, _)) @@ -1387,7 +1391,7 @@ } TEST_P(BufferedPacketStoreTest, ProcessCHLOsUptoLimitAndBufferTheRest) { - FLAGS_quic_limit_num_new_sessions_per_epoll_loop = true; + FLAGS_quic_reloadable_flag_quic_limit_num_new_sessions_per_epoll_loop = true; // Process more than (|kMaxNumSessionsToCreate| + // |kDefaultMaxConnectionsInStore|) CHLOs, // the first |kMaxNumSessionsToCreate| should create connections immediately, @@ -1398,11 +1402,12 @@ const size_t kNumCHLOs = kMaxNumSessionsToCreate + kDefaultMaxConnectionsInStore + 1; for (size_t conn_id = 1; conn_id <= kNumCHLOs; ++conn_id) { - if (FLAGS_quic_create_session_after_insertion) { + if (FLAGS_quic_reloadable_flag_quic_create_session_after_insertion) { EXPECT_CALL(*dispatcher_, ShouldCreateOrBufferPacketForConnection(conn_id)); } - if (!FLAGS_quic_create_session_after_insertion && conn_id < kNumCHLOs) { + if (!FLAGS_quic_reloadable_flag_quic_create_session_after_insertion && + conn_id < kNumCHLOs) { // Except the last connection, all connections for previous CHLOs should // be regarded as newly added. EXPECT_CALL(*dispatcher_, @@ -1463,7 +1468,7 @@ // Duplicated CHLO shouldn't be buffered. TEST_P(BufferedPacketStoreTest, BufferDuplicatedCHLO) { - FLAGS_quic_limit_num_new_sessions_per_epoll_loop = true; + FLAGS_quic_reloadable_flag_quic_limit_num_new_sessions_per_epoll_loop = true; for (QuicConnectionId conn_id = 1; conn_id <= kMaxNumSessionsToCreate + 1; ++conn_id) { // Last CHLO will be buffered. Others will create connection right away. @@ -1488,7 +1493,7 @@ SerializeFullCHLO()); size_t packets_buffered = 2; - if (!FLAGS_quic_buffer_packets_after_chlo) { + if (!FLAGS_quic_reloadable_flag_quic_buffer_packets_after_chlo) { // The packet sent above is dropped when flag is off. packets_buffered = 1; } @@ -1510,7 +1515,7 @@ } TEST_P(BufferedPacketStoreTest, BufferNonChloPacketsUptoLimitWithChloBuffered) { - FLAGS_quic_limit_num_new_sessions_per_epoll_loop = true; + FLAGS_quic_reloadable_flag_quic_limit_num_new_sessions_per_epoll_loop = true; QuicConnectionId last_connection_id = kMaxNumSessionsToCreate + 1; for (QuicConnectionId conn_id = 1; conn_id <= last_connection_id; ++conn_id) { // Last CHLO will be buffered. Others will create connection right away. @@ -1557,7 +1562,7 @@ // Tests that when dispatcher's packet buffer is full, a CHLO on connection // which doesn't have buffered CHLO should be buffered. TEST_P(BufferedPacketStoreTest, ReceiveCHLOForBufferedConnection) { - FLAGS_quic_limit_num_new_sessions_per_epoll_loop = true; + FLAGS_quic_reloadable_flag_quic_limit_num_new_sessions_per_epoll_loop = true; QuicBufferedPacketStore* store = QuicDispatcherPeer::GetBufferedPackets(dispatcher_.get()); @@ -1605,10 +1610,10 @@ client_addr_(QuicIpAddress::Loopback4(), 1234), crypto_config_peer_(&crypto_config_), signed_config_(new QuicSignedServerConfig) { - FLAGS_enable_async_get_proof = true; - FLAGS_enable_quic_stateless_reject_support = true; - FLAGS_quic_use_cheap_stateless_rejects = true; - FLAGS_quic_create_session_after_insertion = true; + FLAGS_quic_reloadable_flag_enable_async_get_proof = true; + FLAGS_quic_reloadable_flag_enable_quic_stateless_reject_support = true; + FLAGS_quic_reloadable_flag_quic_use_cheap_stateless_rejects = true; + FLAGS_quic_reloadable_flag_quic_create_session_after_insertion = true; } void SetUp() override {
diff --git a/net/tools/quic/quic_server.cc b/net/tools/quic/quic_server.cc index 7054dcf..bc1ae8a6 100644 --- a/net/tools/quic/quic_server.cc +++ b/net/tools/quic/quic_server.cc
@@ -174,7 +174,7 @@ if (event->in_events & EPOLLIN) { DVLOG(1) << "EPOLLIN"; - if (FLAGS_quic_limit_num_new_sessions_per_epoll_loop) { + if (FLAGS_quic_reloadable_flag_quic_limit_num_new_sessions_per_epoll_loop) { dispatcher_->ProcessBufferedChlos(kNumSessionsToCreatePerSocketEvent); } @@ -185,7 +185,7 @@ overflow_supported_ ? &packets_dropped_ : nullptr); } - if (FLAGS_quic_limit_num_new_sessions_per_epoll_loop && + if (FLAGS_quic_reloadable_flag_quic_limit_num_new_sessions_per_epoll_loop && dispatcher_->HasChlosBuffered()) { // Register EPOLLIN event to consume buffered CHLO(s). event->out_ready_mask |= EPOLLIN;
diff --git a/net/tools/quic/quic_server_test.cc b/net/tools/quic/quic_server_test.cc index 4f5db9ee..1485d09 100644 --- a/net/tools/quic/quic_server_test.cc +++ b/net/tools/quic/quic_server_test.cc
@@ -103,7 +103,7 @@ // event should try to create connections for them. And set epoll mask with // EPOLLIN if there are still CHLOs remaining at the end of epoll event. TEST_F(QuicServerEpollInTest, ProcessBufferedCHLOsOnEpollin) { - FLAGS_quic_limit_num_new_sessions_per_epoll_loop = true; + FLAGS_quic_reloadable_flag_quic_limit_num_new_sessions_per_epoll_loop = true; // Given an EPOLLIN event, try to create session for buffered CHLOs. In first // event, dispatcher can't create session for all of CHLOs. So listener should // register another EPOLLIN event by itself. Even without new packet arrival,
diff --git a/net/tools/quic/quic_simple_server_session.cc b/net/tools/quic/quic_simple_server_session.cc index 8862ae7..fd9a98d8 100644 --- a/net/tools/quic/quic_simple_server_session.cc +++ b/net/tools/quic/quic_simple_server_session.cc
@@ -44,9 +44,10 @@ QuicSimpleServerSession::CreateQuicCryptoServerStream( const QuicCryptoServerConfig* crypto_config, QuicCompressedCertsCache* compressed_certs_cache) { - return new QuicCryptoServerStream(crypto_config, compressed_certs_cache, - FLAGS_enable_quic_stateless_reject_support, - this, stream_helper()); + return new QuicCryptoServerStream( + crypto_config, compressed_certs_cache, + FLAGS_quic_reloadable_flag_enable_quic_stateless_reject_support, this, + stream_helper()); } void QuicSimpleServerSession::StreamDraining(QuicStreamId id) {
diff --git a/net/tools/quic/quic_simple_server_session_test.cc b/net/tools/quic/quic_simple_server_session_test.cc index 3e6f3e1..125cb78 100644 --- a/net/tools/quic/quic_simple_server_session_test.cc +++ b/net/tools/quic/quic_simple_server_session_test.cc
@@ -88,11 +88,12 @@ QuicCompressedCertsCache* compressed_certs_cache, QuicServerSessionBase* session, QuicCryptoServerStream::Helper* helper) - : QuicCryptoServerStream(crypto_config, - compressed_certs_cache, - FLAGS_enable_quic_stateless_reject_support, - session, - helper) {} + : QuicCryptoServerStream( + crypto_config, + compressed_certs_cache, + FLAGS_quic_reloadable_flag_enable_quic_stateless_reject_support, + session, + helper) {} ~MockQuicCryptoServerStream() override {} MOCK_METHOD1(SendServerConfigUpdate,
diff --git a/net/tools/quic/quic_spdy_client_stream.cc b/net/tools/quic/quic_spdy_client_stream.cc index 1274c47..2137a6b5 100644 --- a/net/tools/quic/quic_spdy_client_stream.cc +++ b/net/tools/quic/quic_spdy_client_stream.cc
@@ -64,8 +64,8 @@ return; } - if (FLAGS_quic_supports_100_continue && response_code_ == 100 && - !has_preliminary_headers_) { + if (FLAGS_quic_restart_flag_quic_supports_100_continue && + response_code_ == 100 && !has_preliminary_headers_) { // These are preliminary 100 Continue headers, not the actual response // headers. set_headers_decompressed(false);
diff --git a/net/tools/quic/quic_spdy_client_stream_test.cc b/net/tools/quic/quic_spdy_client_stream_test.cc index 785025a4..055e728 100644 --- a/net/tools/quic/quic_spdy_client_stream_test.cc +++ b/net/tools/quic/quic_spdy_client_stream_test.cc
@@ -110,7 +110,7 @@ TEST_F(QuicSpdyClientStreamTest, TestFraming100Continue) { headers_[":status"] = "100"; - FLAGS_quic_supports_100_continue = true; + FLAGS_quic_restart_flag_quic_supports_100_continue = true; auto headers = AsHeaderList(headers_); stream_->OnStreamHeaderList(false, headers.uncompressed_header_bytes(), headers); @@ -124,7 +124,7 @@ TEST_F(QuicSpdyClientStreamTest, TestFraming100ContinueNoFlag) { headers_[":status"] = "100"; - FLAGS_quic_supports_100_continue = false; + FLAGS_quic_restart_flag_quic_supports_100_continue = false; auto headers = AsHeaderList(headers_); stream_->OnStreamHeaderList(false, headers.uncompressed_header_bytes(), headers);
diff --git a/net/tools/quic/stateless_rejector.cc b/net/tools/quic/stateless_rejector.cc index e8d0a02..2cc30c1 100644 --- a/net/tools/quic/stateless_rejector.cc +++ b/net/tools/quic/stateless_rejector.cc
@@ -68,8 +68,8 @@ DCHECK_NE(connection_id, server_designated_connection_id); DCHECK_EQ(state_, UNKNOWN); - if (!FLAGS_enable_quic_stateless_reject_support || - !FLAGS_quic_use_cheap_stateless_rejects || + if (!FLAGS_quic_reloadable_flag_enable_quic_stateless_reject_support || + !FLAGS_quic_reloadable_flag_quic_use_cheap_stateless_rejects || !QuicCryptoServerStream::DoesPeerSupportStatelessRejects(message)) { state_ = UNSUPPORTED; return;
diff --git a/net/tools/quic/stateless_rejector_test.cc b/net/tools/quic/stateless_rejector_test.cc index 1ea44f0780..d8e236f 100644 --- a/net/tools/quic/stateless_rejector_test.cc +++ b/net/tools/quic/stateless_rejector_test.cc
@@ -89,9 +89,9 @@ kDefaultMaxPacketSize, QuicSocketAddress(QuicIpAddress::Loopback4(), 12345), QuicSocketAddress(QuicIpAddress::Loopback4(), 443))) { - FLAGS_enable_quic_stateless_reject_support = + FLAGS_quic_reloadable_flag_enable_quic_stateless_reject_support = GetParam().flags == ENABLED || GetParam().flags == CHEAP_DISABLED; - FLAGS_quic_use_cheap_stateless_rejects = + FLAGS_quic_reloadable_flag_quic_use_cheap_stateless_rejects = GetParam().flags == ENABLED || GetParam().flags == STATELESS_DISABLED; // Add a new primary config.
diff --git a/net/tools/quic/test_tools/quic_test_client.cc b/net/tools/quic/test_tools/quic_test_client.cc index aeb9e47..fea5045 100644 --- a/net/tools/quic/test_tools/quic_test_client.cc +++ b/net/tools/quic/test_tools/quic_test_client.cc
@@ -329,7 +329,7 @@ stream->WriteOrBufferBody(body.as_string(), fin, ack_listener); ret = body.length(); } - if (FLAGS_enable_quic_stateless_reject_support) { + if (FLAGS_quic_reloadable_flag_enable_quic_stateless_reject_support) { std::unique_ptr<SpdyHeaderBlock> new_headers; if (headers) { new_headers.reset(new SpdyHeaderBlock(headers->Clone()));
diff --git a/net/url_request/url_request_unittest.cc b/net/url_request/url_request_unittest.cc index 5c3923d..1028f1c 100644 --- a/net/url_request/url_request_unittest.cc +++ b/net/url_request/url_request_unittest.cc
@@ -9636,6 +9636,65 @@ mock_report_sender.latest_report_uri()); } +// Tests that Expect-Staple reports are not sent for connections on which there +// is a certificate error. +TEST_F(HTTPSOCSPTest, ExpectStapleReportNotSentOnMissingWithCertError) { + EmbeddedTestServer https_test_server(net::EmbeddedTestServer::TYPE_HTTPS); + https_test_server.SetSSLConfig( + net::EmbeddedTestServer::CERT_COMMON_NAME_IS_DOMAIN); + https_test_server.ServeFilesFromSourceDirectory( + base::FilePath(kTestFilePath)); + ASSERT_TRUE(https_test_server.Start()); + + // Set up a MockCertVerifier to report an error for the certificate + // and indicate that there was no stapled OCSP response. + scoped_refptr<X509Certificate> cert = https_test_server.GetCertificate(); + ASSERT_TRUE(cert); + MockCertVerifier cert_verifier; + CertVerifyResult verify_result; + verify_result.cert_status = CERT_STATUS_DATE_INVALID; + verify_result.verified_cert = cert; + verify_result.is_issued_by_known_root = true; + verify_result.ocsp_result.response_status = OCSPVerifyResult::MISSING; + cert_verifier.AddResultForCert(cert.get(), verify_result, + ERR_CERT_DATE_INVALID); + + // Set up a mock report sender so that the test can check that an + // Expect-Staple report is not sent. + TransportSecurityState transport_security_state; + MockCertificateReportSender mock_report_sender; + transport_security_state.SetReportSender(&mock_report_sender); + + TestNetworkDelegate network_delegate; + TestURLRequestContext context(true); + + // Force |kExpectStapleStaticHostname| to resolve to |https_test_server|. + MockHostResolver host_resolver; + context.set_host_resolver(&host_resolver); + + context.set_transport_security_state(&transport_security_state); + context.set_network_delegate(&network_delegate); + context.set_cert_verifier(&cert_verifier); + context.Init(); + + // Make a connection to |kExpectStapleStaticHostname|. Because the + // |verify_result| used with the |cert_verifier| will indicate a certificate + // error, an Expect-Staple report should not be sent. + TestDelegate d; + GURL url = https_test_server.GetURL("/"); + GURL::Replacements replace_host; + replace_host.SetHostStr(kExpectStapleStaticHostname); + url = url.ReplaceComponents(replace_host); + std::unique_ptr<URLRequest> violating_request( + context.CreateRequest(url, DEFAULT_PRIORITY, &d)); + violating_request->Start(); + base::RunLoop().Run(); + + // Confirm a report was not sent. + EXPECT_TRUE(mock_report_sender.latest_report().empty()); + EXPECT_EQ(GURL(), mock_report_sender.latest_report_uri()); +} + TEST_F(HTTPSOCSPTest, ExpectStapleReportNotSentOnValid) { EmbeddedTestServer https_test_server(net::EmbeddedTestServer::TYPE_HTTPS); https_test_server.SetSSLConfig( @@ -9688,6 +9747,65 @@ EXPECT_EQ(GURL(), mock_report_sender.latest_report_uri()); } +// Tests that an Expect-Staple report is not sent when OCSP details are not +// checked on the connection. +TEST_F(HTTPSOCSPTest, ExpectStapleReportNotSentOnNotChecked) { + EmbeddedTestServer https_test_server(net::EmbeddedTestServer::TYPE_HTTPS); + https_test_server.SetSSLConfig( + net::EmbeddedTestServer::CERT_COMMON_NAME_IS_DOMAIN); + https_test_server.ServeFilesFromSourceDirectory( + base::FilePath(kTestFilePath)); + ASSERT_TRUE(https_test_server.Start()); + + // Set up a MockCertVerifier to accept the certificate that the server sends, + // and set |ocsp_result| to indicate that OCSP stapling details were not + // checked on the connection. + scoped_refptr<X509Certificate> cert = https_test_server.GetCertificate(); + ASSERT_TRUE(cert); + MockCertVerifier cert_verifier; + CertVerifyResult verify_result; + verify_result.verified_cert = cert; + verify_result.is_issued_by_known_root = true; + verify_result.ocsp_result.response_status = OCSPVerifyResult::NOT_CHECKED; + cert_verifier.AddResultForCert(cert.get(), verify_result, OK); + + // Set up a mock report sender so that the test can check that an + // Expect-Staple report is not sent. + TransportSecurityState transport_security_state; + MockCertificateReportSender mock_report_sender; + transport_security_state.SetReportSender(&mock_report_sender); + + TestNetworkDelegate network_delegate; + TestURLRequestContext context(true); + + // Force |kExpectStapleStaticHostname| to resolve to |https_test_server|. + MockHostResolver host_resolver; + context.set_host_resolver(&host_resolver); + + context.set_transport_security_state(&transport_security_state); + context.set_network_delegate(&network_delegate); + context.set_cert_verifier(&cert_verifier); + context.Init(); + + // Make a connection to |kExpectStapleStaticHostname|. Because the + // |verify_result| used with the |cert_verifier| will indicate that OCSP + // stapling details were not checked on the connection, an Expect-Staple + // report should not be sent. + TestDelegate d; + GURL url = https_test_server.GetURL("/"); + GURL::Replacements replace_host; + replace_host.SetHostStr(kExpectStapleStaticHostname); + url = url.ReplaceComponents(replace_host); + std::unique_ptr<URLRequest> ok_request( + context.CreateRequest(url, DEFAULT_PRIORITY, &d)); + ok_request->Start(); + base::RunLoop().Run(); + + // Check that no report was sent. + EXPECT_TRUE(mock_report_sender.latest_report().empty()); + EXPECT_EQ(GURL(), mock_report_sender.latest_report_uri()); +} + static const struct OCSPVerifyTestData { std::vector<SpawnedTestServer::SSLOptions::OCSPSingleResponse> ocsp_responses; SpawnedTestServer::SSLOptions::OCSPProduced ocsp_produced;
diff --git a/printing/BUILD.gn b/printing/BUILD.gn index 159f436..ad70ef1 100644 --- a/printing/BUILD.gn +++ b/printing/BUILD.gn
@@ -237,6 +237,20 @@ } } +static_library("test_support") { + testonly = true + sources = [ + "backend/test_print_backend.cc", + "backend/test_print_backend.h", + ] + public_deps = [ + "//printing", + ] + deps = [ + "//base", + ] +} + test("printing_unittests") { sources = [ "emf_win_unittest.cc",
diff --git a/printing/backend/print_backend.cc b/printing/backend/print_backend.cc index 6d472e0..fbc4e77 100644 --- a/printing/backend/print_backend.cc +++ b/printing/backend/print_backend.cc
@@ -6,6 +6,10 @@ namespace { bool g_native_cups_enabled = false; + +// PrintBackend override for testing. +printing::PrintBackend* g_print_backend_for_test = nullptr; + } // namespace namespace printing { @@ -45,6 +49,19 @@ PrintBackend::~PrintBackend() {} // static +scoped_refptr<PrintBackend> PrintBackend::CreateInstance( + const base::DictionaryValue* print_backend_settings) { + return g_print_backend_for_test + ? g_print_backend_for_test + : PrintBackend::CreateInstanceImpl(print_backend_settings); +} + +// static +void PrintBackend::SetPrintBackendForTesting(PrintBackend* backend) { + g_print_backend_for_test = backend; +} + +// static bool PrintBackend::GetNativeCupsEnabled() { return g_native_cups_enabled; }
diff --git a/printing/backend/print_backend.h b/printing/backend/print_backend.h index 079b150..df47d40 100644 --- a/printing/backend/print_backend.h +++ b/printing/backend/print_backend.h
@@ -124,6 +124,10 @@ static scoped_refptr<PrintBackend> CreateInstance( const base::DictionaryValue* print_backend_settings); + // Test method to override the print backend for testing. Caller should + // retain ownership. + static void SetPrintBackendForTesting(PrintBackend* print_backend); + // Returns the value of the native cups flag static bool GetNativeCupsEnabled(); @@ -132,6 +136,10 @@ protected: friend class base::RefCountedThreadSafe<PrintBackend>; virtual ~PrintBackend(); + + // Provide the actual backend for CreateInstance(). + static scoped_refptr<PrintBackend> CreateInstanceImpl( + const base::DictionaryValue* print_backend_settings); }; } // namespace printing
diff --git a/printing/backend/print_backend_chromeos.cc b/printing/backend/print_backend_chromeos.cc index e27bc4e6..e3695c5 100644 --- a/printing/backend/print_backend_chromeos.cc +++ b/printing/backend/print_backend_chromeos.cc
@@ -79,7 +79,8 @@ return true; } -scoped_refptr<PrintBackend> PrintBackend::CreateInstance( +// static +scoped_refptr<PrintBackend> PrintBackend::CreateInstanceImpl( const base::DictionaryValue* print_backend_settings) { if (GetNativeCupsEnabled()) { #if defined(USE_CUPS)
diff --git a/printing/backend/print_backend_cups.cc b/printing/backend/print_backend_cups.cc index 639ac36..39a0858 100644 --- a/printing/backend/print_backend_cups.cc +++ b/printing/backend/print_backend_cups.cc
@@ -196,7 +196,7 @@ } #if !defined(OS_CHROMEOS) -scoped_refptr<PrintBackend> PrintBackend::CreateInstance( +scoped_refptr<PrintBackend> PrintBackend::CreateInstanceImpl( const base::DictionaryValue* print_backend_settings) { std::string print_server_url_str, cups_blocking; int encryption = HTTP_ENCRYPT_NEVER;
diff --git a/printing/backend/print_backend_dummy.cc b/printing/backend/print_backend_dummy.cc index e4cde2d..727bdfa 100644 --- a/printing/backend/print_backend_dummy.cc +++ b/printing/backend/print_backend_dummy.cc
@@ -59,7 +59,8 @@ DISALLOW_COPY_AND_ASSIGN(DummyPrintBackend); }; -scoped_refptr<PrintBackend> PrintBackend::CreateInstance( +// static +scoped_refptr<PrintBackend> PrintBackend::CreateInstanceImpl( const base::DictionaryValue* print_backend_settings) { return new DummyPrintBackend(); }
diff --git a/printing/backend/print_backend_win.cc b/printing/backend/print_backend_win.cc index b248a8a2..39760867 100644 --- a/printing/backend/print_backend_win.cc +++ b/printing/backend/print_backend_win.cc
@@ -381,7 +381,8 @@ return printer_handle.OpenPrinter(base::UTF8ToWide(printer_name).c_str()); } -scoped_refptr<PrintBackend> PrintBackend::CreateInstance( +// static +scoped_refptr<PrintBackend> PrintBackend::CreateInstanceImpl( const base::DictionaryValue* print_backend_settings) { return new PrintBackendWin; }
diff --git a/printing/backend/test_print_backend.cc b/printing/backend/test_print_backend.cc new file mode 100644 index 0000000..5e7eaf9 --- /dev/null +++ b/printing/backend/test_print_backend.cc
@@ -0,0 +1,85 @@ +// Copyright 2016 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. + +#include "printing/backend/test_print_backend.h" + +#include <memory> +#include <utility> + +#include "base/stl_util.h" +#include "printing/backend/print_backend.h" + +namespace printing { + +TestPrintBackend::TestPrintBackend() {} + +TestPrintBackend::~TestPrintBackend() {} + +bool TestPrintBackend::EnumeratePrinters(PrinterList* printer_list) { + if (printer_list_.empty()) + return false; + + printer_list->insert(printer_list->end(), printer_list_.begin(), + printer_list_.end()); + return true; +} + +std::string TestPrintBackend::GetDefaultPrinterName() { + return default_printer_name_; +} + +bool TestPrintBackend::GetPrinterBasicInfo(const std::string& printer_name, + PrinterBasicInfo* printer_info) { + NOTREACHED() << "Not implemented"; + return false; +} + +bool TestPrintBackend::GetPrinterSemanticCapsAndDefaults( + const std::string& printer_name, + PrinterSemanticCapsAndDefaults* printer_info) { + auto found = valid_printers_.find(printer_name); + if (found == valid_printers_.end()) + return false; + + const std::unique_ptr<PrinterSemanticCapsAndDefaults>& caps = found->second; + if (!caps) + return false; + + *printer_info = *(found->second); + return true; +} + +bool TestPrintBackend::GetPrinterCapsAndDefaults( + const std::string& printer_name, + PrinterCapsAndDefaults* printer_info) { + // not implemented + return false; +} + +std::string TestPrintBackend::GetPrinterDriverInfo( + const std::string& printr_name) { + // not implemented + return ""; +} + +bool TestPrintBackend::IsValidPrinter(const std::string& printer_name) { + return base::ContainsKey(valid_printers_, printer_name); +} + +void TestPrintBackend::PopulatePrinterList(const PrinterList& printer_list) { + printer_list_.insert(printer_list_.end(), printer_list.begin(), + printer_list.end()); +} + +void TestPrintBackend::SetDefaultPrinterName(const std::string& printer_name) { + default_printer_name_ = printer_name; +} + +void TestPrintBackend::AddValidPrinter( + const std::string& printer_name, + std::unique_ptr<PrinterSemanticCapsAndDefaults> caps) { + valid_printers_[printer_name] = std::move(caps); +} + +} // namespace printing
diff --git a/printing/backend/test_print_backend.h b/printing/backend/test_print_backend.h new file mode 100644 index 0000000..08d36c6 --- /dev/null +++ b/printing/backend/test_print_backend.h
@@ -0,0 +1,59 @@ +// Copyright 2016 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 PRINTING_BACKEND_TEST_PRINT_BACKEND_H_ +#define PRINTING_BACKEND_TEST_PRINT_BACKEND_H_ + +#include <map> +#include <memory> +#include <string> +#include <vector> + +#include "printing/backend/print_backend.h" + +namespace printing { + +// PrintBackend which doesn't interact with the OS and responses +// can be overridden as necessary. +class TestPrintBackend : public PrintBackend { + public: + TestPrintBackend(); + + // PrintBackend overrides + bool EnumeratePrinters(PrinterList* printer_list) override; + std::string GetDefaultPrinterName() override; + bool GetPrinterBasicInfo(const std::string& printer_name, + PrinterBasicInfo* printer_info) override; + bool GetPrinterSemanticCapsAndDefaults( + const std::string& printer_name, + PrinterSemanticCapsAndDefaults* printer_info) override; + bool GetPrinterCapsAndDefaults(const std::string& printer_name, + PrinterCapsAndDefaults* printer_info) override; + std::string GetPrinterDriverInfo(const std::string& printer_name) override; + bool IsValidPrinter(const std::string& printer_name) override; + + // Methods for test setup. + // Add printers to the list returned by EnumeratePrinters. + void PopulatePrinterList(const PrinterList& printer_list); + + // Set a default printer. The default is the empty string. + void SetDefaultPrinterName(const std::string& printer_name); + + // Add a printer to satisfy IsValidPrinter and + // GetPrinterSemanticCapsAndDefualts. + void AddValidPrinter(const std::string& printer_name, + std::unique_ptr<PrinterSemanticCapsAndDefaults> caps); + + private: + ~TestPrintBackend() override; + + std::string default_printer_name_; + PrinterList printer_list_; + std::map<std::string, std::unique_ptr<PrinterSemanticCapsAndDefaults>> + valid_printers_; +}; + +} // namespace printing + +#endif // PRINTING_BACKEND_TEST_PRINT_BACKEND_H_
diff --git a/remoting/host/desktop_session_win.cc b/remoting/host/desktop_session_win.cc index f1d9069..eff9158b 100644 --- a/remoting/host/desktop_session_win.cc +++ b/remoting/host/desktop_session_win.cc
@@ -101,6 +101,12 @@ const wchar_t kNetworkLevelAuthValueName[] = L"UserAuthentication"; const wchar_t kSecurityLayerValueName[] = L"SecurityLayer"; +webrtc::DesktopSize GetBoundedRdpDesktopSize(int width, int height) { + return webrtc::DesktopSize( + std::min(kMaxRdpScreenWidth, std::max(kMinRdpScreenWidth, width)), + std::min(kMaxRdpScreenHeight, std::max(kMinRdpScreenHeight, height))); +} + // DesktopSession implementation which attaches to the host's physical console. // Receives IPC messages from the desktop process, running in the console // session, via |WorkerProcessIpcDelegate|, and monitors console session @@ -283,11 +289,7 @@ webrtc::DesktopVector(kDefaultRdpDpi, kDefaultRdpDpi)); // Make sure that the host resolution is within the limits supported by RDP. - host_size = webrtc::DesktopSize( - std::min(kMaxRdpScreenWidth, - std::max(kMinRdpScreenWidth, host_size.width())), - std::min(kMaxRdpScreenHeight, - std::max(kMinRdpScreenHeight, host_size.height()))); + host_size = GetBoundedRdpDesktopSize(host_size.width(), host_size.height()); // Read the port number used by RDP. DWORD server_port = kDefaultRdpPort; @@ -304,6 +306,7 @@ terminal_id_ = base::GenerateGUID(); base::win::ScopedBstr terminal_id(base::UTF8ToUTF16(terminal_id_).c_str()); result = rdp_desktop_session_->Connect(host_size.width(), host_size.height(), + kDefaultRdpDpi, kDefaultRdpDpi, terminal_id, server_port, event_handler.get()); if (FAILED(result)) { @@ -330,10 +333,14 @@ void RdpSession::SetScreenResolution(const ScreenResolution& resolution) { DCHECK(caller_task_runner()->BelongsToCurrentThread()); + DCHECK(!resolution.IsEmpty()); - // TODO(alexeypa): implement resize-to-client for RDP sessions here. - // See http://crbug.com/137696. - NOTIMPLEMENTED(); + webrtc::DesktopSize new_size = resolution.ScaleDimensionsToDpi( + webrtc::DesktopVector(kDefaultRdpDpi, kDefaultRdpDpi)); + new_size = GetBoundedRdpDesktopSize(new_size.width(), new_size.height()); + + rdp_desktop_session_->ChangeResolution(new_size.width(), new_size.height(), + kDefaultRdpDpi, kDefaultRdpDpi); } void RdpSession::InjectSas() {
diff --git a/remoting/host/linux/BUILD.gn b/remoting/host/linux/BUILD.gn index 151797c..de5bbba2 100644 --- a/remoting/host/linux/BUILD.gn +++ b/remoting/host/linux/BUILD.gn
@@ -43,6 +43,7 @@ deps = [ ":remoting_me2me_host_copy_host_wrapper", ":remoting_me2me_host_copy_script", + ":remoting_native_messaging_host", "//remoting/host:remoting_me2me_host", ] }
diff --git a/remoting/host/linux/linux_me2me_host.py b/remoting/host/linux/linux_me2me_host.py index c89dc75..4e511148 100755 --- a/remoting/host/linux/linux_me2me_host.py +++ b/remoting/host/linux/linux_me2me_host.py
@@ -37,6 +37,27 @@ LOG_FILE_ENV_VAR = "CHROME_REMOTE_DESKTOP_LOG_FILE" +ENV_VARS_FORWARDED_TO_CHILD_ENV = [ + "HOME", + "LANG", + "LOGNAME", + "PATH", + "SHELL", + "USER", + "USERNAME", + LOG_FILE_ENV_VAR, + "GOOGLE_CLIENT_ID_REMOTING", + "GOOGLE_CLIENT_ID_REMOTING_HOST", + "GOOGLE_CLIENT_SECRET_REMOTING", + "GOOGLE_CLIENT_SECRET_REMOTING_HOST" +] + +# If this env var is defined, extra host params will be loaded from this env var +# as a list of strings separated by space (\s+). Note that param that contains +# space is currently NOT supported and will be broken down into two params at +# the space character. +HOST_EXTRA_PARAMS_ENV_VAR = "CHROME_REMOTE_DESKTOP_HOST_EXTRA_PARAMS" + # This script has a sensible default for the initial and maximum desktop size, # which can be overridden either on the command-line, or via a comma-separated # list of sizes in this environment variable. @@ -367,15 +388,7 @@ # from the user's console X session. self.child_env = {} - for key in [ - "HOME", - "LANG", - "LOGNAME", - "PATH", - "SHELL", - "USER", - "USERNAME", - LOG_FILE_ENV_VAR]: + for key in ENV_VARS_FORWARDED_TO_CHILD_ENV: if key in os.environ: self.child_env[key] = os.environ[key] @@ -676,7 +689,7 @@ self._launch_x_server(x_args) self._launch_x_session() - def launch_host(self, host_config): + def launch_host(self, host_config, extra_start_host_args): # Start remoting host args = [HOST_BINARY_PATH, "--host-config=-"] if self.pulseaudio_pipe: @@ -686,6 +699,8 @@ if self.ssh_auth_sockname: args.append("--ssh-auth-sockname=%s" % self.ssh_auth_sockname) + args.extend(extra_start_host_args) + # Have the host process use SIGUSR1 to signal a successful start. def sigusr1_handler(signum, frame): _ = signum, frame @@ -1499,7 +1514,13 @@ relaunch_times.append(host_inhibitor.earliest_relaunch_time) else: logging.info("Launching host process") - desktop.launch_host(host_config) + + extra_start_host_args = [] + if HOST_EXTRA_PARAMS_ENV_VAR in os.environ: + extra_start_host_args = \ + re.split('\s+', os.environ[HOST_EXTRA_PARAMS_ENV_VAR].strip()) + desktop.launch_host(host_config, extra_start_host_args) + host_inhibitor.record_started(MINIMUM_PROCESS_LIFETIME, backoff_time)
diff --git a/remoting/host/security_key/security_key_ipc_client.cc b/remoting/host/security_key/security_key_ipc_client.cc index 994f92e..3b6b4058 100644 --- a/remoting/host/security_key/security_key_ipc_client.cc +++ b/remoting/host/security_key/security_key_ipc_client.cc
@@ -41,8 +41,8 @@ const ConnectedCallback& connected_callback, const base::Closure& connection_error_callback) { DCHECK(thread_checker_.CalledOnValidThread()); - DCHECK(!connected_callback.is_null()); - DCHECK(!connection_error_callback.is_null()); + DCHECK(connected_callback); + DCHECK(connection_error_callback); DCHECK(!ipc_channel_); connected_callback_ = connected_callback; @@ -56,14 +56,14 @@ const ResponseCallback& response_callback) { DCHECK(thread_checker_.CalledOnValidThread()); DCHECK(!request_payload.empty()); - DCHECK(!response_callback.is_null()); + DCHECK(response_callback); if (!ipc_channel_) { LOG(ERROR) << "Request made before IPC connection was established."; return false; } - if (!response_callback_.is_null()) { + if (response_callback_) { LOG(ERROR) << "Request made while waiting for a response to a previous request."; return false; @@ -131,7 +131,7 @@ void SecurityKeyIpcClient::OnChannelError() { DCHECK(thread_checker_.CalledOnValidThread()); - if (!connection_error_callback_.is_null()) { + if (connection_error_callback_) { base::ResetAndReturn(&connection_error_callback_).Run(); } } @@ -139,26 +139,41 @@ void SecurityKeyIpcClient::OnSecurityKeyResponse( const std::string& response_data) { DCHECK(thread_checker_.CalledOnValidThread()); - DCHECK(!connection_error_callback_.is_null()); if (!response_data.empty()) { base::ResetAndReturn(&response_callback_).Run(response_data); } else { LOG(ERROR) << "Invalid response received"; - base::ResetAndReturn(&connection_error_callback_).Run(); + if (connection_error_callback_) { + base::ResetAndReturn(&connection_error_callback_).Run(); + } } } void SecurityKeyIpcClient::OnConnectionReady() { DCHECK(thread_checker_.CalledOnValidThread()); - DCHECK(!connected_callback_.is_null()); + + if (!connected_callback_) { + LOG(ERROR) << "Unexpected ConnectionReady message received."; + if (connection_error_callback_) { + base::ResetAndReturn(&connection_error_callback_).Run(); + } + return; + } base::ResetAndReturn(&connected_callback_).Run(/*connection_usable=*/true); } void SecurityKeyIpcClient::OnInvalidSession() { DCHECK(thread_checker_.CalledOnValidThread()); - DCHECK(!connected_callback_.is_null()); + + if (!connected_callback_) { + LOG(ERROR) << "Unexpected InvalidSession message received."; + if (connection_error_callback_) { + base::ResetAndReturn(&connection_error_callback_).Run(); + } + return; + } base::ResetAndReturn(&connected_callback_).Run(/*connection_usable=*/false); } @@ -170,7 +185,7 @@ CloseIpcConnection(); if (!channel_handle_.is_valid() && !CheckForSecurityKeyIpcServerChannel()) { - if (!connection_error_callback_.is_null()) { + if (connection_error_callback_) { base::ResetAndReturn(&connection_error_callback_).Run(); } return; @@ -184,7 +199,7 @@ } ipc_channel_.reset(); - if (!connection_error_callback_.is_null()) { + if (connection_error_callback_) { base::ResetAndReturn(&connection_error_callback_).Run(); } }
diff --git a/remoting/host/security_key/security_key_ipc_client_unittest.cc b/remoting/host/security_key/security_key_ipc_client_unittest.cc index 7b1cfd46..cf62fa31 100644 --- a/remoting/host/security_key/security_key_ipc_client_unittest.cc +++ b/remoting/host/security_key/security_key_ipc_client_unittest.cc
@@ -58,9 +58,10 @@ void WaitForOperationComplete(); // Sets up an active IPC connection between |security_key_ipc_client_| - // and |fake_ipc_server_|. |expect_success| defines whether the operation - // is expected to succeed or fail. - void EstablishConnection(bool expect_success); + // and |fake_ipc_server_|. |expect_connected| defines whether the operation + // is result in a usable IPC connection. |expect_error| defines whether the + // the error callback should be invoked during the connection process. + void EstablishConnection(bool expect_connected, bool expect_error); // Sends a security key request from |security_key_ipc_client_| and // a response from |fake_ipc_server_| and verifies the payloads for both. @@ -177,7 +178,8 @@ IPC::Channel::GenerateUniqueRandomChannelID(); } -void SecurityKeyIpcClientTest::EstablishConnection(bool expect_success) { +void SecurityKeyIpcClientTest::EstablishConnection(bool expect_connected, + bool expect_error) { // Start up the security key forwarding session IPC channel first, that way // we can provide the channel using the fake SecurityKeyAuthHandler later on. mojo::edk::NamedPlatformHandle channel_handle( @@ -197,8 +199,8 @@ base::Bind(&SecurityKeyIpcClientTest::OperationComplete, base::Unretained(this), /*failed=*/true)); WaitForOperationComplete(); - ASSERT_EQ(connection_established_, expect_success); - ASSERT_NE(operation_failed_, expect_success); + ASSERT_EQ(expect_connected, connection_established_); + ASSERT_EQ(expect_error, operation_failed_); } void SecurityKeyIpcClientTest::SendRequestAndResponse( @@ -209,17 +211,17 @@ base::Unretained(this)))); WaitForOperationComplete(); ASSERT_FALSE(operation_failed_); - ASSERT_EQ(last_connection_id_received_, kTestConnectionId); - ASSERT_EQ(last_message_received_, request_data); + ASSERT_EQ(kTestConnectionId, last_connection_id_received_); + ASSERT_EQ(request_data, last_message_received_); ASSERT_TRUE(fake_ipc_server_.SendResponse(response_data)); WaitForOperationComplete(); ASSERT_FALSE(operation_failed_); - ASSERT_EQ(last_message_received_, response_data); + ASSERT_EQ(response_data, last_message_received_); } TEST_F(SecurityKeyIpcClientTest, GenerateSingleSecurityKeyRequest) { - EstablishConnection(/*expect_success=*/true); + EstablishConnection(/*expect_connected=*/true, /*expect_error=*/false); SendRequestAndResponse("Auth me!", "You've been authed!"); @@ -227,7 +229,7 @@ } TEST_F(SecurityKeyIpcClientTest, GenerateLargeSecurityKeyRequest) { - EstablishConnection(/*expect_success=*/true); + EstablishConnection(/*expect_connected=*/true, /*expect_error=*/false); SendRequestAndResponse(std::string(kLargeMessageSizeBytes, 'Y'), std::string(kLargeMessageSizeBytes, 'Z')); @@ -236,7 +238,7 @@ } TEST_F(SecurityKeyIpcClientTest, GenerateReallyLargeSecurityKeyRequest) { - EstablishConnection(/*expect_success=*/true); + EstablishConnection(/*expect_connected=*/true, /*expect_error=*/false); SendRequestAndResponse(std::string(kLargeMessageSizeBytes * 2, 'Y'), std::string(kLargeMessageSizeBytes * 2, 'Z')); @@ -245,7 +247,7 @@ } TEST_F(SecurityKeyIpcClientTest, GenerateMultipleSecurityKeyRequest) { - EstablishConnection(/*expect_success=*/true); + EstablishConnection(/*expect_connected=*/true, /*expect_error=*/false); SendRequestAndResponse("Auth me 1!", "You've been authed once!"); SendRequestAndResponse("Auth me 2!", "You've been authed twice!"); @@ -255,7 +257,7 @@ } TEST_F(SecurityKeyIpcClientTest, ServerClosesConnectionAfterRequestTimeout) { - EstablishConnection(/*expect_success=*/true); + EstablishConnection(/*expect_connected=*/true, /*expect_error=*/false); fake_ipc_server_.CloseChannel(); WaitForOperationComplete(); ASSERT_FALSE(operation_failed_); @@ -263,7 +265,7 @@ TEST_F(SecurityKeyIpcClientTest, SecondSecurityKeyRequestBeforeFirstResponseReceived) { - EstablishConnection(/*expect_success=*/true); + EstablishConnection(/*expect_connected=*/true, /*expect_error=*/false); ASSERT_TRUE(security_key_ipc_client_.SendSecurityKeyRequest( "First Request", @@ -279,7 +281,7 @@ } TEST_F(SecurityKeyIpcClientTest, ReceiveSecurityKeyResponseWithEmptyPayload) { - EstablishConnection(/*expect_success=*/true); + EstablishConnection(/*expect_connected=*/true, /*expect_error=*/false); ASSERT_TRUE(security_key_ipc_client_.SendSecurityKeyRequest( "Valid request", @@ -316,16 +318,90 @@ ASSERT_TRUE(operation_failed_); } +TEST_F(SecurityKeyIpcClientTest, MultipleConnectionReadyMessagesReceived) { + EstablishConnection(/*expect_connected=*/true, /*expect_error=*/false); + ASSERT_FALSE(operation_failed_); + + // Send a second ConnectionReady message to trigger the error callback. + SendConnectionMessage(); + WaitForOperationComplete(); + ASSERT_TRUE(operation_failed_); + + // Send a third message to ensure no crash occurs both callbacks will have + // been called and cleared so we don't wait for the operation to complete. + SendConnectionMessage(); + ASSERT_TRUE(operation_failed_); +} + +TEST_F(SecurityKeyIpcClientTest, UnexpectedInvalidSessionMessagesReceived) { + EstablishConnection(/*expect_connected=*/true, /*expect_error=*/false); + ASSERT_FALSE(operation_failed_); + + // Send an InvalidSession message to trigger the error callback. + simulate_invalid_session_ = true; + SendConnectionMessage(); + WaitForOperationComplete(); + ASSERT_TRUE(operation_failed_); + + // Send a third message to ensure no crash occurs both callbacks will have + // been called and cleared so we don't wait for the operation to complete. + SendConnectionMessage(); + ASSERT_TRUE(operation_failed_); +} + #if defined(OS_WIN) TEST_F(SecurityKeyIpcClientTest, SecurityKeyIpcServerRunningInWrongSession) { // Set the expected session Id to a different session than we are running in. security_key_ipc_client_.SetExpectedIpcServerSessionIdForTest(session_id_ + 1); - simulate_invalid_session_ = true; // Attempting to establish a connection should fail here since the IPC Server + // is 'running' in a different session than expected. The success callback + // will be called by the IPC server since it thinks the connection is valid, + // but we will have already started tearing down the connection since it + // failed at the client end. + EstablishConnection(/*expect_connected=*/true, /*expect_error=*/true); +} + +TEST_F(SecurityKeyIpcClientTest, SecurityKeyIpcClientRunningInWrongSession) { + // Attempting to establish a connection should fail here since the IPC Client + // is 'running' in the non-remoted session. + simulate_invalid_session_ = true; + EstablishConnection(/*expect_connected=*/false, /*expect_error=*/false); +} + +TEST_F(SecurityKeyIpcClientTest, MultipleInvalidSessionMessagesReceived) { + // Attempting to establish a connection should fail here since the IPC Server // is 'running' in a different session than expected. - EstablishConnection(/*expect_success=*/false); + simulate_invalid_session_ = true; + EstablishConnection(/*expect_connected=*/false, /*expect_error=*/false); + + SendConnectionMessage(); + WaitForOperationComplete(); + ASSERT_TRUE(operation_failed_); + + // Send a third message to ensure no crash occurs both callbacks will have + // been called and cleared so we don't wait for the operation to complete. + SendConnectionMessage(); + ASSERT_TRUE(operation_failed_); +} + +TEST_F(SecurityKeyIpcClientTest, UnexpectedConnectionReadyMessagesReceived) { + // Attempting to establish a connection should fail here since the IPC Server + // is 'running' in a different session than expected. + simulate_invalid_session_ = true; + EstablishConnection(/*expect_connected=*/false, /*expect_error=*/false); + + // Send an InvalidSession message to trigger the error callback. + simulate_invalid_session_ = false; + SendConnectionMessage(); + WaitForOperationComplete(); + ASSERT_TRUE(operation_failed_); + + // Send a third message to ensure no crash occurs both callbacks will have + // been called and cleared so we don't wait for the operation to complete. + SendConnectionMessage(); + ASSERT_TRUE(operation_failed_); } #endif // defined(OS_WIN)
diff --git a/remoting/host/setup/daemon_controller_delegate_linux.cc b/remoting/host/setup/daemon_controller_delegate_linux.cc index db9b393..d2a9816 100644 --- a/remoting/host/setup/daemon_controller_delegate_linux.cc +++ b/remoting/host/setup/daemon_controller_delegate_linux.cc
@@ -34,6 +34,10 @@ namespace { +#ifndef NDEBUG +const char kDaemonDevScript[] = "remoting/chrome-remote-desktop"; +#endif // NDEBUG + const char kDaemonScript[] = "/opt/google/chrome-remote-desktop/chrome-remote-desktop"; @@ -54,6 +58,16 @@ } bool GetScriptPath(base::FilePath* result) { +#ifndef NDEBUG + base::FilePath out_dir; + PathService::Get(base::DIR_EXE, &out_dir); + base::FilePath dev_exe = out_dir.AppendASCII(kDaemonDevScript); + if (access(dev_exe.value().c_str(), X_OK) == 0) { + *result = dev_exe; + return true; + } +#endif // NDEBUG + base::FilePath candidate_exe(kDaemonScript); if (access(candidate_exe.value().c_str(), X_OK) == 0) { *result = candidate_exe; @@ -157,9 +171,7 @@ bool consent, const DaemonController::CompletionCallback& done) { // Add the user to chrome-remote-desktop group first. - std::vector<std::string> args; - args.push_back("--add-user"); - if (!RunHostScript(args)) { + if (!RunHostScript({"--add-user"})) { LOG(ERROR) << "Failed to add user to chrome-remote-desktop group."; done.Run(DaemonController::RESULT_FAILED); return; @@ -185,8 +197,9 @@ } // Finally start the host. - args.clear(); - args.push_back("--start"); + std::vector<std::string> args = {"--start", + "--config=" + GetConfigPath().value()}; + DaemonController::AsyncResult result = DaemonController::RESULT_FAILED; if (RunHostScript(args)) result = DaemonController::RESULT_OK;
diff --git a/remoting/host/win/chromoting_lib_idl.templ b/remoting/host/win/chromoting_lib_idl.templ index 3dba78e..5f0e392 100644 --- a/remoting/host/win/chromoting_lib_idl.templ +++ b/remoting/host/win/chromoting_lib_idl.templ
@@ -32,10 +32,12 @@ interface IRdpDesktopSession : IUnknown { [ id(1), helpstring("Initiates a loopback RDP connection to spawn a new " "Windows session. |width| and |height| specify the " - "initial screen resolution. |terminal_id| specifies a " - "unique value to be used to identify this connection." - "|port_number| specifies the RDP port number to use.") ] - HRESULT Connect([in] long width, [in] long height, [in] BSTR terminal_id, + "initial screen resolution, they must be scaled to |dpi|." + " |terminal_id| specifies a unique value to be used to " + "identify this connection. |port_number| specifies the " + "RDP port number to use.") ] + HRESULT Connect([in] long width, [in] long height, [in] long dpi_x, + [in] long dpi_y, [in] BSTR terminal_id, [in] DWORD port_number, [in] IRdpDesktopSessionEventHandler* event_handler); @@ -43,7 +45,8 @@ HRESULT Disconnect(); [ id(3), helpstring("Changes the screen resolution.") ] - HRESULT ChangeResolution([in] long width, [in] long height); + HRESULT ChangeResolution([in] long width, [in] long height, [in] long dpi_x, + [in] long dpi_y); [ id(4), helpstring("Sends Secure Attention Sequence to the session.") ] HRESULT InjectSas();
diff --git a/remoting/host/win/rdp_client.cc b/remoting/host/win/rdp_client.cc index 2402522e..b1a537f 100644 --- a/remoting/host/win/rdp_client.cc +++ b/remoting/host/win/rdp_client.cc
@@ -5,7 +5,8 @@ #include "remoting/host/win/rdp_client.h" #include <windows.h> -#include <stdint.h> + +#include <cstdint> #include "base/bind.h" #include "base/bind_helpers.h" @@ -16,8 +17,8 @@ #include "net/base/ip_address.h" #include "net/base/ip_endpoint.h" #include "remoting/base/typed_buffer.h" +#include "remoting/host/screen_resolution.h" #include "remoting/host/win/rdp_client_window.h" -#include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" namespace remoting { @@ -42,7 +43,7 @@ RdpClient::EventHandler* event_handler); // Initiates a loopback RDP connection. - void Connect(const webrtc::DesktopSize& screen_size, + void Connect(const ScreenResolution& resolution, const std::string& terminal_id, DWORD port_number); @@ -52,6 +53,9 @@ // Sends Secure Attention Sequence to the session. void InjectSas(); + // Change the resolution of the desktop. + void ChangeResolution(const ScreenResolution& resolution); + // RdpClientWindow::EventHandler interface. void OnConnected() override; void OnDisconnected() override; @@ -87,14 +91,14 @@ RdpClient::RdpClient( scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, - const webrtc::DesktopSize& screen_size, + const ScreenResolution& resolution, const std::string& terminal_id, DWORD port_number, EventHandler* event_handler) { DCHECK(caller_task_runner->BelongsToCurrentThread()); core_ = new Core(caller_task_runner, ui_task_runner, event_handler); - core_->Connect(screen_size, terminal_id, port_number); + core_->Connect(resolution, terminal_id, port_number); } RdpClient::~RdpClient() { @@ -109,6 +113,12 @@ core_->InjectSas(); } +void RdpClient::ChangeResolution(const ScreenResolution& resolution) { + DCHECK(CalledOnValidThread()); + + core_->ChangeResolution(resolution); +} + RdpClient::Core::Core( scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, @@ -118,13 +128,13 @@ event_handler_(event_handler) { } -void RdpClient::Core::Connect(const webrtc::DesktopSize& screen_size, +void RdpClient::Core::Connect(const ScreenResolution& resolution, const std::string& terminal_id, DWORD port_number) { if (!ui_task_runner_->BelongsToCurrentThread()) { ui_task_runner_->PostTask( - FROM_HERE, base::Bind(&Core::Connect, this, screen_size, terminal_id, - port_number)); + FROM_HERE, + base::Bind(&Core::Connect, this, resolution, terminal_id, port_number)); return; } @@ -138,7 +148,7 @@ // Create the ActiveX control window. rdp_client_window_.reset(new RdpClientWindow(server_endpoint, terminal_id, this)); - if (!rdp_client_window_->Connect(screen_size)) { + if (!rdp_client_window_->Connect(resolution)) { rdp_client_window_.reset(); // Notify the caller that connection attempt failed. @@ -169,8 +179,21 @@ return; } - if (rdp_client_window_) + if (rdp_client_window_) { rdp_client_window_->InjectSas(); + } +} + +void RdpClient::Core::ChangeResolution(const ScreenResolution& resolution) { + if (!ui_task_runner_->BelongsToCurrentThread()) { + ui_task_runner_->PostTask( + FROM_HERE, base::Bind(&Core::ChangeResolution, this, resolution)); + return; + } + + if (rdp_client_window_) { + rdp_client_window_->ChangeResolution(resolution); + } } void RdpClient::Core::OnConnected() {
diff --git a/remoting/host/win/rdp_client.h b/remoting/host/win/rdp_client.h index a0de33a9..e30f16ec 100644 --- a/remoting/host/win/rdp_client.h +++ b/remoting/host/win/rdp_client.h
@@ -16,12 +16,10 @@ class SingleThreadTaskRunner; } // namespace base -namespace webrtc { -class DesktopSize; -} // namespace webrtc - namespace remoting { +class ScreenResolution; + // Establishes a loopback RDP connection to spawn a new Windows session. class RdpClient : public base::NonThreadSafe { public: @@ -39,7 +37,7 @@ RdpClient(scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, - const webrtc::DesktopSize& screen_size, + const ScreenResolution& resolution, const std::string& terminal_id, DWORD port_number, EventHandler* event_handler); @@ -48,6 +46,9 @@ // Sends Secure Attention Sequence to the session. void InjectSas(); + // Change the resolution of the desktop. + void ChangeResolution(const ScreenResolution& resolution); + private: // The actual implementation resides in Core class. class Core;
diff --git a/remoting/host/win/rdp_client_unittest.cc b/remoting/host/win/rdp_client_unittest.cc index b30284cf..8f3303e6 100644 --- a/remoting/host/win/rdp_client_unittest.cc +++ b/remoting/host/win/rdp_client_unittest.cc
@@ -5,7 +5,8 @@ // ATL headers have to go first. #include <atlbase.h> #include <atlhost.h> -#include <stdint.h> + +#include <cstdint> #include <string> #include "base/bind.h" @@ -17,6 +18,7 @@ #include "base/single_thread_task_runner.h" #include "base/win/scoped_com_initializer.h" #include "remoting/base/auto_thread_task_runner.h" +#include "remoting/host/screen_resolution.h" #include "remoting/host/win/rdp_client.h" #include "remoting/host/win/wts_terminal_monitor.h" #include "testing/gmock/include/gmock/gmock.h" @@ -32,9 +34,10 @@ namespace { -// Default width and hight of the RDP client window. +// Default width, height, and dpi of the RDP client window. const long kDefaultWidth = 1024; const long kDefaultHeight = 768; +const long kDefaultDpi = 96; const DWORD kDefaultRdpPort = 3389; @@ -166,10 +169,11 @@ .Times(AtMost(1)) .WillOnce(InvokeWithoutArgs(this, &RdpClientTest::CloseRdpClient)); - rdp_client_.reset( - new RdpClient(task_runner_, task_runner_, - webrtc::DesktopSize(kDefaultWidth, kDefaultHeight), - terminal_id_, kDefaultRdpPort, &event_handler_)); + rdp_client_.reset(new RdpClient( + task_runner_, task_runner_, + ScreenResolution(webrtc::DesktopSize(kDefaultWidth, kDefaultHeight), + webrtc::DesktopVector(kDefaultDpi, kDefaultDpi)), + terminal_id_, kDefaultRdpPort, &event_handler_)); task_runner_ = nullptr; run_loop_.Run();
diff --git a/remoting/host/win/rdp_client_window.cc b/remoting/host/win/rdp_client_window.cc index 49552ad..47a50b3 100644 --- a/remoting/host/win/rdp_client_window.cc +++ b/remoting/host/win/rdp_client_window.cc
@@ -21,23 +21,23 @@ namespace { // RDP session disconnect reason codes that should not be interpreted as errors. -const long kDisconnectReasonNoInfo = 0; -const long kDisconnectReasonLocalNotError = 1; -const long kDisconnectReasonRemoteByUser = 2; -const long kDisconnectReasonByServer = 3; +constexpr long kDisconnectReasonNoInfo = 0; +constexpr long kDisconnectReasonLocalNotError = 1; +constexpr long kDisconnectReasonRemoteByUser = 2; +constexpr long kDisconnectReasonByServer = 3; // Maximum length of a window class name including the terminating nullptr. -const int kMaxWindowClassLength = 256; +constexpr int kMaxWindowClassLength = 256; // Each member of the array returned by GetKeyboardState() contains status data // for a virtual key. If the high-order bit is 1, the key is down; otherwise, it // is up. -const BYTE kKeyPressedFlag = 0x80; +constexpr BYTE kKeyPressedFlag = 0x80; -const int kKeyboardStateLength = 256; +constexpr int kKeyboardStateLength = 256; // The RDP control creates 'IHWindowClass' window to handle keyboard input. -const wchar_t kRdpInputWindowClass[] = L"IHWindowClass"; +constexpr wchar_t kRdpInputWindowClass[] = L"IHWindowClass"; enum RdpAudioMode { // Redirect sounds to the client. This is the default value. @@ -119,36 +119,42 @@ } RdpClientWindow::~RdpClientWindow() { - if (m_hWnd) + if (m_hWnd) { DestroyWindow(); + } DCHECK(!client_.get()); + DCHECK(!client_9_.get()); DCHECK(!client_settings_.get()); } -bool RdpClientWindow::Connect(const webrtc::DesktopSize& screen_size) { +bool RdpClientWindow::Connect(const ScreenResolution& resolution) { DCHECK(!m_hWnd); - screen_size_ = screen_size; - RECT rect = { 0, 0, screen_size_.width(), screen_size_.height() }; + screen_resolution_ = resolution; + RECT rect = {0, 0, screen_resolution_.dimensions().width(), + screen_resolution_.dimensions().height()}; bool result = Create(nullptr, rect, nullptr) != nullptr; // Hide the window since this class is about establishing a connection, not // about showing a UI to the user. - if (result) + if (result) { ShowWindow(SW_HIDE); + } return result; } void RdpClientWindow::Disconnect() { - if (m_hWnd) + if (m_hWnd) { SendMessage(WM_CLOSE); + } } void RdpClientWindow::InjectSas() { - if (!m_hWnd) + if (!m_hWnd) { return; + } // Find the window handling the keyboard input. HWND input_window = FindWindowRecursively(m_hWnd, kRdpInputWindowClass); @@ -208,6 +214,11 @@ SendMessage(input_window, WM_KEYUP, VK_CONTROL, MAKELPARAM(1, control | up)); } +void RdpClientWindow::ChangeResolution(const ScreenResolution& resolution) { + screen_resolution_ = resolution; + UpdateDesktopResolution(); +} + void RdpClientWindow::OnClose() { if (!client_.get()) { NotifyDisconnected(); @@ -244,7 +255,8 @@ base::win::ScopedBstr terminal_id(base::UTF8ToUTF16(terminal_id_).c_str()); // Create the child window that actually hosts the ActiveX control. - RECT rect = { 0, 0, screen_size_.width(), screen_size_.height() }; + RECT rect = {0, 0, screen_resolution_.dimensions().width(), + screen_resolution_.dimensions().height()}; activex_window.Create(m_hWnd, rect, nullptr, WS_CHILD | WS_VISIBLE | WS_BORDER); if (activex_window.m_hWnd == nullptr) @@ -271,13 +283,19 @@ return LogOnCreateError(result); // Set dimensions of the remote desktop. - result = client_->put_DesktopWidth(screen_size_.width()); + result = client_->put_DesktopWidth(screen_resolution_.dimensions().width()); if (FAILED(result)) return LogOnCreateError(result); - result = client_->put_DesktopHeight(screen_size_.height()); + result = client_->put_DesktopHeight(screen_resolution_.dimensions().height()); if (FAILED(result)) return LogOnCreateError(result); + // Check to see if the platform exposes the interface used for resizing. + result = client_.QueryInterface(client_9_.Receive()); + if (FAILED(result) && result != E_NOINTERFACE) { + return LogOnCreateError(result); + } + // Set the server name to connect to. result = client_->put_Server(server_name); if (FAILED(result)) @@ -370,6 +388,7 @@ void RdpClientWindow::OnDestroy() { client_.Release(); + client_9_.Release(); client_settings_.Release(); } @@ -397,6 +416,17 @@ return S_OK; } +HRESULT RdpClientWindow::OnLoginComplete() { + VLOG(1) << "RDP: user successfully logged in."; + + user_logged_in_ = true; + + // Apply pending screen size changes to the desktop. + UpdateDesktopResolution(); + + return S_OK; +} + HRESULT RdpClientWindow::OnDisconnected(long reason) { if (reason == kDisconnectReasonNoInfo || reason == kDisconnectReasonLocalNotError || @@ -453,13 +483,15 @@ << server_endpoint_.ToString() << ": error=" << std::hex << error << std::dec; client_.Release(); + client_9_.Release(); client_settings_.Release(); return -1; } void RdpClientWindow::NotifyConnected() { - if (event_handler_) + if (event_handler_) { event_handler_->OnConnected(); + } } void RdpClientWindow::NotifyDisconnected() { @@ -470,12 +502,38 @@ } } +void RdpClientWindow::UpdateDesktopResolution() { + if (!client_9_ || !user_logged_in_) { + return; + } + + // UpdateSessionDisplaySettings() is poorly documented in MSDN and has a few + // quirks that should be noted. + // 1.) This method will only work when the user is logged into their session. + // 2.) The method may return E_UNEXPECTED until some amount of time (seconds) + // have elapsed after logging in to the user's session. + // TODO(joedow): Investigate adding retry logic for applying the settings. + HRESULT result = client_9_->UpdateSessionDisplaySettings( + screen_resolution_.dimensions().width(), + screen_resolution_.dimensions().height(), + screen_resolution_.dimensions().width(), + screen_resolution_.dimensions().height(), + /*ulOrientation=*/0, + screen_resolution_.dpi().x(), + screen_resolution_.dpi().y()); + if (FAILED(result)) { + LOG(ERROR) << "UpdateSessionDisplaySettings() failed: 0x" << std::hex + << result << std::dec; + } +} + scoped_refptr<RdpClientWindow::WindowHook> RdpClientWindow::WindowHook::Create() { scoped_refptr<WindowHook> window_hook = g_window_hook.Pointer()->Get(); - if (!window_hook.get()) + if (!window_hook.get()) { window_hook = new WindowHook(); + } return window_hook; } @@ -512,8 +570,9 @@ // Get the hook handle. HHOOK hook = g_window_hook.Pointer()->Get()->hook_; - if (code != HCBT_ACTIVATE) + if (code != HCBT_ACTIVATE) { return CallNextHookEx(hook, code, wparam, lparam); + } // Close the window once all pending window messages are processed. HWND window = reinterpret_cast<HWND>(wparam);
diff --git a/remoting/host/win/rdp_client_window.h b/remoting/host/win/rdp_client_window.h index c68f399..a7b1159 100644 --- a/remoting/host/win/rdp_client_window.h +++ b/remoting/host/win/rdp_client_window.h
@@ -14,6 +14,7 @@ #include "base/message_loop/message_loop.h" #include "base/win/scoped_comptr.h" #include "net/base/ip_endpoint.h" +#include "remoting/host/screen_resolution.h" // The following header was generated by Visual Studio. We had to check it in // due to a bug in VS2013. See crbug.com/318952 for details. #include "remoting/host/win/com_imported_mstscax.tlh" @@ -68,9 +69,9 @@ ~RdpClientWindow() override; // Creates the window along with the ActiveX control and initiates the - // connection. |screen_size| specifies resolution of the screen. Returns false + // connection. |resolution| specifies resolution of the screen. Returns false // if an error occurs. - bool Connect(const webrtc::DesktopSize& screen_size); + bool Connect(const ScreenResolution& resolution); // Initiates shutdown of the connection. The caller must not delete |this| // until it receives OnDisconnected() notification. @@ -80,6 +81,9 @@ // Attention Sequence by the ActiveX control. void InjectSas(); + // Change the resolution of the desktop. + void ChangeResolution(const ScreenResolution& resolution); + private: typedef IDispEventImpl<1, RdpClientWindow, &__uuidof(mstsc::IMsTscAxEvents), @@ -105,6 +109,8 @@ BEGIN_SINK_MAP(RdpClientWindow) SINK_ENTRY_EX(1, __uuidof(mstsc::IMsTscAxEvents), 2, &RdpClientWindow::OnConnected) + SINK_ENTRY_EX(1, __uuidof(mstsc::IMsTscAxEvents), 3, + &RdpClientWindow::OnLoginComplete) SINK_ENTRY_EX(1, __uuidof(mstsc::IMsTscAxEvents), 4, &RdpClientWindow::OnDisconnected) SINK_ENTRY_EX(1, __uuidof(mstsc::IMsTscAxEvents), 10, @@ -121,6 +127,7 @@ STDMETHOD(OnAuthenticationWarningDisplayed)(); STDMETHOD(OnAuthenticationWarningDismissed)(); STDMETHOD(OnConnected)(); + STDMETHOD(OnLoginComplete)(); STDMETHOD(OnDisconnected)(long reason); STDMETHOD(OnFatalError)(long error_code); STDMETHOD(OnConfirmClose)(VARIANT_BOOL* allow_close); @@ -133,11 +140,14 @@ void NotifyConnected(); void NotifyDisconnected(); + // Updates the desktop using |screen_resolution_| if resizing is supported. + void UpdateDesktopResolution(); + // Invoked to report connect/disconnect events. EventHandler* event_handler_; // Contains the requested dimensions of the screen. - webrtc::DesktopSize screen_size_; + remoting::ScreenResolution screen_resolution_; // The endpoint to connect to. net::IPEndPoint server_endpoint_; @@ -145,8 +155,15 @@ // The terminal ID assigned to this connection. std::string terminal_id_; + // Our RDP session always starts logged out (i.e. at the logon screen), some + // functions do not work until the user has logged in so we want to track that + // event. We don't support logging out so this value should never revert from + // true to false. + bool user_logged_in_ = false; + // Interfaces exposed by the RDP ActiveX control. base::win::ScopedComPtr<mstsc::IMsRdpClient> client_; + base::win::ScopedComPtr<mstsc::IMsRdpClient9> client_9_; base::win::ScopedComPtr<mstsc::IMsRdpClientAdvancedSettings> client_settings_; // Used to cancel modal dialog boxes shown by the RDP control.
diff --git a/remoting/host/win/rdp_desktop_session.cc b/remoting/host/win/rdp_desktop_session.cc index 19980be..4f934eb 100644 --- a/remoting/host/win/rdp_desktop_session.cc +++ b/remoting/host/win/rdp_desktop_session.cc
@@ -6,6 +6,7 @@ #include "base/strings/utf_string_conversions.h" #include "remoting/base/auto_thread_task_runner.h" +#include "remoting/host/screen_resolution.h" #include "remoting/host/win/chromoting_module.h" #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" @@ -20,6 +21,8 @@ STDMETHODIMP RdpDesktopSession::Connect( long width, long height, + long dpi_x, + long dpi_y, BSTR terminal_id, DWORD port_number, IRdpDesktopSessionEventHandler* event_handler) { @@ -29,9 +32,11 @@ ChromotingModule::task_runner(); DCHECK(task_runner->BelongsToCurrentThread()); - client_.reset(new RdpClient( - task_runner, task_runner, webrtc::DesktopSize(width, height), - base::UTF16ToUTF8(terminal_id), port_number, this)); + client_.reset( + new RdpClient(task_runner, task_runner, + ScreenResolution(webrtc::DesktopSize(width, height), + webrtc::DesktopVector(dpi_x, dpi_y)), + base::UTF16ToUTF8(terminal_id), port_number, this)); return S_OK; } @@ -41,13 +46,22 @@ return S_OK; } -STDMETHODIMP RdpDesktopSession::ChangeResolution(long width, long height) { - return E_NOTIMPL; +STDMETHODIMP RdpDesktopSession::ChangeResolution(long width, + long height, + long dpi_x, + long dpi_y) { + if (client_) { + client_->ChangeResolution(ScreenResolution( + webrtc::DesktopSize(width, height), + webrtc::DesktopVector(dpi_x, dpi_y))); + } + return S_OK; } STDMETHODIMP RdpDesktopSession::InjectSas() { - if (client_) + if (client_) { client_->InjectSas(); + } return S_OK; }
diff --git a/remoting/host/win/rdp_desktop_session.h b/remoting/host/win/rdp_desktop_session.h index bba1889..325023d 100644 --- a/remoting/host/win/rdp_desktop_session.h +++ b/remoting/host/win/rdp_desktop_session.h
@@ -42,13 +42,16 @@ // IRdpDesktopSession implementation. STDMETHOD(Connect) - (long width, - long height, - BSTR terminal_id, - DWORD port_number, - IRdpDesktopSessionEventHandler* event_handler) override; + (long width, + long height, + long dpi_x, + long dpi_y, + BSTR terminal_id, + DWORD port_number, + IRdpDesktopSessionEventHandler* event_handler) override; STDMETHOD(Disconnect)() override; - STDMETHOD(ChangeResolution)(long width, long height) override; + STDMETHOD(ChangeResolution)(long width, long height, + long dpi_x, long dpi_y) override; STDMETHOD(InjectSas)() override; DECLARE_NO_REGISTRY()
diff --git a/skia/ext/bitmap_platform_device_cairo.cc b/skia/ext/bitmap_platform_device_cairo.cc index 093719e..261228b 100644 --- a/skia/ext/bitmap_platform_device_cairo.cc +++ b/skia/ext/bitmap_platform_device_cairo.cc
@@ -166,11 +166,12 @@ // PlatformCanvas impl -std::unique_ptr<SkCanvas> CreatePlatformCanvas(int width, - int height, - bool is_opaque, - uint8_t* data, - OnFailureType failureType) { +std::unique_ptr<SkCanvas> CreatePlatformCanvasWithPixels( + int width, + int height, + bool is_opaque, + uint8_t* data, + OnFailureType failureType) { sk_sp<SkBaseDevice> dev( BitmapPlatformDevice::Create(width, height, is_opaque, data)); return CreateCanvas(dev, failureType);
diff --git a/skia/ext/bitmap_platform_device_mac.cc b/skia/ext/bitmap_platform_device_mac.cc index bf02a89..ba5f81b 100644 --- a/skia/ext/bitmap_platform_device_mac.cc +++ b/skia/ext/bitmap_platform_device_mac.cc
@@ -260,22 +260,12 @@ // PlatformCanvas impl -std::unique_ptr<SkCanvas> CreatePlatformCanvas(CGContextRef ctx, - int width, - int height, - bool is_opaque, - OnFailureType failureType) { - const bool do_clear = false; - sk_sp<SkBaseDevice> dev( - BitmapPlatformDevice::Create(ctx, width, height, is_opaque, do_clear)); - return CreateCanvas(dev, failureType); -} - -std::unique_ptr<SkCanvas> CreatePlatformCanvas(int width, - int height, - bool is_opaque, - uint8_t* data, - OnFailureType failureType) { +std::unique_ptr<SkCanvas> CreatePlatformCanvasWithPixels( + int width, + int height, + bool is_opaque, + uint8_t* data, + OnFailureType failureType) { sk_sp<SkBaseDevice> dev( BitmapPlatformDevice::CreateWithData(data, width, height, is_opaque)); return CreateCanvas(dev, failureType);
diff --git a/skia/ext/bitmap_platform_device_skia.cc b/skia/ext/bitmap_platform_device_skia.cc index d19810b..a39e5d71 100644 --- a/skia/ext/bitmap_platform_device_skia.cc +++ b/skia/ext/bitmap_platform_device_skia.cc
@@ -60,11 +60,12 @@ // PlatformCanvas impl -std::unique_ptr<SkCanvas> CreatePlatformCanvas(int width, - int height, - bool is_opaque, - uint8_t* data, - OnFailureType failureType) { +std::unique_ptr<SkCanvas> CreatePlatformCanvasWithPixels( + int width, + int height, + bool is_opaque, + uint8_t* data, + OnFailureType failureType) { sk_sp<SkBaseDevice> dev( BitmapPlatformDevice::Create(width, height, is_opaque, data)); return CreateCanvas(dev, failureType);
diff --git a/skia/ext/bitmap_platform_device_win.cc b/skia/ext/bitmap_platform_device_win.cc index 44a3ea5..b792c0fd 100644 --- a/skia/ext/bitmap_platform_device_win.cc +++ b/skia/ext/bitmap_platform_device_win.cc
@@ -207,11 +207,12 @@ // PlatformCanvas impl -std::unique_ptr<SkCanvas> CreatePlatformCanvas(int width, - int height, - bool is_opaque, - HANDLE shared_section, - OnFailureType failureType) { +std::unique_ptr<SkCanvas> CreatePlatformCanvasWithSharedSection( + int width, + int height, + bool is_opaque, + HANDLE shared_section, + OnFailureType failureType) { sk_sp<SkBaseDevice> dev( BitmapPlatformDevice::Create(width, height, is_opaque, shared_section)); return CreateCanvas(dev, failureType);
diff --git a/skia/ext/platform_canvas.h b/skia/ext/platform_canvas.h index 04a4d17..20b958b 100644 --- a/skia/ext/platform_canvas.h +++ b/skia/ext/platform_canvas.h
@@ -45,7 +45,7 @@ #if defined(WIN32) // The shared_section parameter is passed to gfx::PlatformDevice::create. // See it for details. -SK_API std::unique_ptr<SkCanvas> CreatePlatformCanvas( +SK_API std::unique_ptr<SkCanvas> CreatePlatformCanvasWithSharedSection( int width, int height, bool is_opaque, @@ -61,27 +61,11 @@ int x, int y, const RECT* src_rect); -#elif defined(__APPLE__) -SK_API std::unique_ptr<SkCanvas> CreatePlatformCanvas( - CGContextRef context, - int width, - int height, - bool is_opaque, - OnFailureType failure_type); - -SK_API std::unique_ptr<SkCanvas> CreatePlatformCanvas( - int width, - int height, - bool is_opaque, - uint8_t* context, - OnFailureType failure_type); #elif defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || \ - defined(__sun) || defined(ANDROID) - // Linux --------------------------------------------------------------------- - + defined(__sun) || defined(ANDROID) || defined(__APPLE__) // Construct a canvas from the given memory region. The memory is not cleared // first. @data must be, at least, @height * StrideForWidth(@width) bytes. -SK_API std::unique_ptr<SkCanvas> CreatePlatformCanvas( +SK_API std::unique_ptr<SkCanvas> CreatePlatformCanvasWithPixels( int width, int height, bool is_opaque, @@ -92,23 +76,28 @@ static inline std::unique_ptr<SkCanvas> CreatePlatformCanvas(int width, int height, bool is_opaque) { - return CreatePlatformCanvas(width, height, is_opaque, 0, CRASH_ON_FAILURE); +#if defined(WIN32) + return CreatePlatformCanvasWithSharedSection(width, height, is_opaque, 0, + CRASH_ON_FAILURE); +#else + return CreatePlatformCanvasWithPixels(width, height, is_opaque, 0, + CRASH_ON_FAILURE); +#endif } SK_API std::unique_ptr<SkCanvas> CreateCanvas(const sk_sp<SkBaseDevice>& device, OnFailureType failure_type); -static inline std::unique_ptr<SkCanvas> CreateBitmapCanvas(int width, - int height, - bool is_opaque) { - return CreatePlatformCanvas(width, height, is_opaque, 0, CRASH_ON_FAILURE); -} - static inline std::unique_ptr<SkCanvas> TryCreateBitmapCanvas(int width, int height, bool is_opaque) { - return CreatePlatformCanvas(width, height, is_opaque, 0, - RETURN_NULL_ON_FAILURE); +#if defined(WIN32) + return CreatePlatformCanvasWithSharedSection(width, height, is_opaque, 0, + RETURN_NULL_ON_FAILURE); +#else + return CreatePlatformCanvasWithPixels(width, height, is_opaque, 0, + RETURN_NULL_ON_FAILURE); +#endif } // Return the stride (length of a line in bytes) for the given width. Because
diff --git a/skia/ext/skia_utils_mac.mm b/skia/ext/skia_utils_mac.mm index 57fb707..e2dbb80 100644 --- a/skia/ext/skia_utils_mac.mm +++ b/skia/ext/skia_utils_mac.mm
@@ -190,8 +190,8 @@ int width = CGImageGetWidth(image); int height = CGImageGetHeight(image); - std::unique_ptr<SkCanvas> canvas(skia::CreatePlatformCanvas( - nullptr, width, height, false, RETURN_NULL_ON_FAILURE)); + std::unique_ptr<SkCanvas> canvas( + skia::TryCreateBitmapCanvas(width, height, false)); ScopedPlatformPaint p(canvas.get()); CGContextRef context = p.GetNativeDrawingContext();
diff --git a/third_party/WebKit/LayoutTests/TestExpectations b/third_party/WebKit/LayoutTests/TestExpectations index 22c8948..c66a62b 100644 --- a/third_party/WebKit/LayoutTests/TestExpectations +++ b/third_party/WebKit/LayoutTests/TestExpectations
@@ -1307,18 +1307,6 @@ crbug.com/619539 [ Win ] http/tests/workers/terminate-during-sync-operation-file.html [ Pass Timeout ] crbug.com/619539 [ Win ] virtual/mojo-loading/http/tests/workers/terminate-during-sync-operation-file.html [ Pass Timeout ] -# Temporary until we start generating Trusty baselines. -crbug.com/498021 [ Linux ] fast/text/unicode-fallback-font.html [ Failure ] -crbug.com/498021 [ Linux ] fast/forms/month/month-appearance-l10n.html [ Failure ] -crbug.com/498021 [ Linux Win ] fast/text/ellipsis-stroked.html [ Failure ] -crbug.com/498021 [ Linux ] fast/text/emphasis-complex.html [ Failure ] -crbug.com/498021 [ Linux ] fast/text/international/danda-space.html [ Failure ] -crbug.com/498021 [ Linux ] fast/text/international/hindi-whitespace.html [ Failure ] -crbug.com/498021 [ Linux ] fast/text/selection-multiple-runs.html [ Failure ] -crbug.com/498021 [ Linux ] fast/encoding/invalid-UTF-8.html [ Failure ] -crbug.com/498021 [ Linux ] fast/text/emoticons.html [ Failure ] -crbug.com/498021 [ Linux ] fast/text/international/hindi-spacing.html [ Failure ] - crbug.com/649159 imported/wpt/shadow-dom/slotchange-event.html [ Failure ] # These are the failing tests because Chrome hasn't implemented according to the spec.
diff --git a/third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-point-readonly.html b/third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-point-readonly.html index c71e8e1..285cc0a 100644 --- a/third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-point-readonly.html +++ b/third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-point-readonly.html
@@ -21,4 +21,8 @@ assert_readonly(point, 'w'); }, 'DOMPointReadOnly readonly test'); +test(() => { + var point = new DOMPointReadOnly(1, 2, 3, 4); + assert_object_equals(point.toJSON(), {x: 1, y: 2, z: 3, w: 4}); +}, 'DOMPointReadOnly toJSON'); </script>
diff --git a/third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-point.html b/third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-point.html index 9c6fa14..49a00c7 100644 --- a/third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-point.html +++ b/third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-point.html
@@ -62,4 +62,9 @@ assert_dom_point_equals(point, [10, 20, 30, 40]); }, 'DOMPoint setter'); +test(() => { + var point = new DOMPoint(1, 2, 3, 4); + assert_object_equals(point.toJSON(), {x: 1, y: 2, z: 3, w: 4}); +}, 'DOMPoint toJSON'); + </script>
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/tracing/timeline-receive-response-event.html b/third_party/WebKit/LayoutTests/http/tests/inspector/tracing/timeline-receive-response-event.html index 7ec1251..8e9df83 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/tracing/timeline-receive-response-event.html +++ b/third_party/WebKit/LayoutTests/http/tests/inspector/tracing/timeline-receive-response-event.html
@@ -26,8 +26,10 @@ function test() { UI.viewManager.showView("timeline"); - UI.panels.timeline._model._currentTarget = SDK.targetManager.mainTarget(); - UI.panels.timeline._captureJSProfileSetting.set(false); + const panel = UI.panels.timeline; + panel._model._currentTarget = SDK.targetManager.mainTarget(); + panel._landingPage._tabbedPane.selectTab(Timeline.TimelineLandingPage.PageId.Advanced); + panel._captureJSProfileSetting.set(false); InspectorTest.invokeAsyncWithTimeline("performActions", finish); function finish()
diff --git a/third_party/WebKit/LayoutTests/inspector/tracing/frame-model-instrumentation.html b/third_party/WebKit/LayoutTests/inspector/tracing/frame-model-instrumentation.html index 7f7d641..110f29e9 100644 --- a/third_party/WebKit/LayoutTests/inspector/tracing/frame-model-instrumentation.html +++ b/third_party/WebKit/LayoutTests/inspector/tracing/frame-model-instrumentation.html
@@ -12,6 +12,7 @@ function test() { + UI.panels.timeline._landingPage._tabbedPane.selectTab(Timeline.TimelineLandingPage.PageId.Advanced); UI.panels.timeline._captureLayersAndPicturesSetting.set(true); InspectorTest.invokeAsyncWithTimeline("doActions", InspectorTest.safeWrap(dumpLastFrame)); function dumpLastFrame()
diff --git a/third_party/WebKit/LayoutTests/inspector/tracing/timeline-paint/layer-tree.html b/third_party/WebKit/LayoutTests/inspector/tracing/timeline-paint/layer-tree.html index 094de66..806823d 100644 --- a/third_party/WebKit/LayoutTests/inspector/tracing/timeline-paint/layer-tree.html +++ b/third_party/WebKit/LayoutTests/inspector/tracing/timeline-paint/layer-tree.html
@@ -21,6 +21,7 @@ function test() { + UI.panels.timeline._landingPage._tabbedPane.selectTab(Timeline.TimelineLandingPage.PageId.Advanced); UI.panels.timeline._captureLayersAndPicturesSetting.set(true); InspectorTest.invokeAsyncWithTimeline("doActions", step1);
diff --git a/third_party/WebKit/LayoutTests/inspector/tracing/timeline-paint/paint-profiler-update.html b/third_party/WebKit/LayoutTests/inspector/tracing/timeline-paint/paint-profiler-update.html index c35ae02d..8c0fac5f 100644 --- a/third_party/WebKit/LayoutTests/inspector/tracing/timeline-paint/paint-profiler-update.html +++ b/third_party/WebKit/LayoutTests/inspector/tracing/timeline-paint/paint-profiler-update.html
@@ -26,8 +26,8 @@ function test() { - var panel = UI.panels.timeline; - + const panel = UI.panels.timeline; + panel._landingPage._tabbedPane.selectTab(Timeline.TimelineLandingPage.PageId.Advanced); panel._captureLayersAndPicturesSetting.set(true); panel._onModeChanged();
diff --git a/third_party/WebKit/LayoutTests/inspector/tracing/timeline-time/timeline-time.html b/third_party/WebKit/LayoutTests/inspector/tracing/timeline-time/timeline-time.html index 9a16df9b..4c8457a3 100644 --- a/third_party/WebKit/LayoutTests/inspector/tracing/timeline-time/timeline-time.html +++ b/third_party/WebKit/LayoutTests/inspector/tracing/timeline-time/timeline-time.html
@@ -88,6 +88,7 @@ InspectorTest.walkTimelineEventTree(dumpName); next(); } + UI.panels.timeline._landingPage._tabbedPane.selectTab(Timeline.TimelineLandingPage.PageId.Advanced); UI.panels.timeline._captureJSProfileSetting.set(false); InspectorTest.evaluateWithTimeline(actions, InspectorTest.safeWrap(callback), true); }
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/encoding/invalid-UTF-8-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/encoding/invalid-UTF-8-expected.png index ae3808a1..dfa608d5e5 100644 --- a/third_party/WebKit/LayoutTests/platform/linux/fast/encoding/invalid-UTF-8-expected.png +++ b/third_party/WebKit/LayoutTests/platform/linux/fast/encoding/invalid-UTF-8-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/encoding/invalid-UTF-8-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/fast/encoding/invalid-UTF-8-expected.txt index 8b87f59..bba115f 100644 --- a/third_party/WebKit/LayoutTests/platform/linux/fast/encoding/invalid-UTF-8-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/linux/fast/encoding/invalid-UTF-8-expected.txt
@@ -10,6 +10,6 @@ LayoutText {#text} at (0,0) size 475x19 text run at (0,0) width 475: "The output should be: \"\x{442}??\x{442}\" (with black diamonds in place of question marks)." LayoutBlockFlow {HR} at (0,72) size 784x2 [border: (1px inset #EEEEEE)] - LayoutBlockFlow {P} at (0,90) size 784x20 - LayoutText {#text} at (0,0) size 46x19 - text run at (0,0) width 46: "\x{442}\x{FFFD}\x{FFFD}\x{442}" + LayoutBlockFlow {P} at (0,90) size 784x28 + LayoutText {#text} at (0,3) size 36x19 + text run at (0,3) width 36: "\x{442}\x{FFFD}\x{FFFD}\x{442}"
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/forms/month/month-appearance-l10n-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/forms/month/month-appearance-l10n-expected.png index 6ba8030..116fe8d 100644 --- a/third_party/WebKit/LayoutTests/platform/linux/fast/forms/month/month-appearance-l10n-expected.png +++ b/third_party/WebKit/LayoutTests/platform/linux/fast/forms/month/month-appearance-l10n-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/text/emoticons-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/text/emoticons-expected.png index 16b5807..9e8fb3fc 100644 --- a/third_party/WebKit/LayoutTests/platform/linux/fast/text/emoticons-expected.png +++ b/third_party/WebKit/LayoutTests/platform/linux/fast/text/emoticons-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/text/emoticons-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/fast/text/emoticons-expected.txt index 5b98223..bd9d3c1 100644 --- a/third_party/WebKit/LayoutTests/platform/linux/fast/text/emoticons-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/linux/fast/text/emoticons-expected.txt
@@ -7,15 +7,15 @@ LayoutText {#text} at (0,0) size 302x36 text run at (0,0) width 302: "Emoticons & Symbols" LayoutBlockFlow {PRE} at (0,58.44) size 784x368 - LayoutText {#text} at (0,0) size 403x368 - text run at (0,0) width 403: "U+1F60x \x{D83D}\x{DE00} \x{D83D}\x{DE01} \x{D83D}\x{DE02} \x{D83D}\x{DE03} \x{D83D}\x{DE04} \x{D83D}\x{DE05} \x{D83D}\x{DE06} \x{D83D}\x{DE07} \x{D83D}\x{DE08} \x{D83D}\x{DE09} \x{D83D}\x{DE0A} \x{D83D}\x{DE0B} \x{D83D}\x{DE0C} \x{D83D}\x{DE0D} \x{D83D}\x{DE0E} \x{D83D}\x{DE0F}" - text run at (403,0) width 0: " " - text run at (0,16) width 372: "U+1F61x \x{D83D}\x{DE10} \x{D83D}\x{DE11} \x{D83D}\x{DE12} \x{D83D}\x{DE13} \x{D83D}\x{DE14} \x{D83D}\x{DE15} \x{D83D}\x{DE16} \x{D83D}\x{DE17} \x{D83D}\x{DE18} \x{D83D}\x{DE19} \x{D83D}\x{DE1A} \x{D83D}\x{DE1B} \x{D83D}\x{DE1C} \x{D83D}\x{DE1D} \x{D83D}\x{DE1E} \x{D83D}\x{DE1F}" - text run at (372,16) width 0: " " - text run at (0,32) width 373: "U+1F62x \x{D83D}\x{DE20} \x{D83D}\x{DE21} \x{D83D}\x{DE22} \x{D83D}\x{DE23} \x{D83D}\x{DE24} \x{D83D}\x{DE25} \x{D83D}\x{DE26} \x{D83D}\x{DE27} \x{D83D}\x{DE28} \x{D83D}\x{DE29} \x{D83D}\x{DE2A} \x{D83D}\x{DE2B} \x{D83D}\x{DE2C} \x{D83D}\x{DE2D} \x{D83D}\x{DE2E} \x{D83D}\x{DE2F}" - text run at (373,32) width 0: " " - text run at (0,48) width 403: "U+1F63x \x{D83D}\x{DE30} \x{D83D}\x{DE31} \x{D83D}\x{DE32} \x{D83D}\x{DE33} \x{D83D}\x{DE34} \x{D83D}\x{DE35} \x{D83D}\x{DE36} \x{D83D}\x{DE37} \x{D83D}\x{DE38} \x{D83D}\x{DE39} \x{D83D}\x{DE3A} \x{D83D}\x{DE3B} \x{D83D}\x{DE3C} \x{D83D}\x{DE3D} \x{D83D}\x{DE3E} \x{D83D}\x{DE3F}" - text run at (403,48) width 0: " " + LayoutText {#text} at (0,0) size 416x368 + text run at (0,0) width 409: "U+1F60x \x{D83D}\x{DE00} \x{D83D}\x{DE01} \x{D83D}\x{DE02} \x{D83D}\x{DE03} \x{D83D}\x{DE04} \x{D83D}\x{DE05} \x{D83D}\x{DE06} \x{D83D}\x{DE07} \x{D83D}\x{DE08} \x{D83D}\x{DE09} \x{D83D}\x{DE0A} \x{D83D}\x{DE0B} \x{D83D}\x{DE0C} \x{D83D}\x{DE0D} \x{D83D}\x{DE0E} \x{D83D}\x{DE0F}" + text run at (409,0) width 0: " " + text run at (0,16) width 408: "U+1F61x \x{D83D}\x{DE10} \x{D83D}\x{DE11} \x{D83D}\x{DE12} \x{D83D}\x{DE13} \x{D83D}\x{DE14} \x{D83D}\x{DE15} \x{D83D}\x{DE16} \x{D83D}\x{DE17} \x{D83D}\x{DE18} \x{D83D}\x{DE19} \x{D83D}\x{DE1A} \x{D83D}\x{DE1B} \x{D83D}\x{DE1C} \x{D83D}\x{DE1D} \x{D83D}\x{DE1E} \x{D83D}\x{DE1F}" + text run at (408,16) width 0: " " + text run at (0,32) width 397: "U+1F62x \x{D83D}\x{DE20} \x{D83D}\x{DE21} \x{D83D}\x{DE22} \x{D83D}\x{DE23} \x{D83D}\x{DE24} \x{D83D}\x{DE25} \x{D83D}\x{DE26} \x{D83D}\x{DE27} \x{D83D}\x{DE28} \x{D83D}\x{DE29} \x{D83D}\x{DE2A} \x{D83D}\x{DE2B} \x{D83D}\x{DE2C} \x{D83D}\x{DE2D} \x{D83D}\x{DE2E} \x{D83D}\x{DE2F}" + text run at (397,32) width 0: " " + text run at (0,48) width 416: "U+1F63x \x{D83D}\x{DE30} \x{D83D}\x{DE31} \x{D83D}\x{DE32} \x{D83D}\x{DE33} \x{D83D}\x{DE34} \x{D83D}\x{DE35} \x{D83D}\x{DE36} \x{D83D}\x{DE37} \x{D83D}\x{DE38} \x{D83D}\x{DE39} \x{D83D}\x{DE3A} \x{D83D}\x{DE3B} \x{D83D}\x{DE3C} \x{D83D}\x{DE3D} \x{D83D}\x{DE3E} \x{D83D}\x{DE3F}" + text run at (416,48) width 0: " " text run at (0,64) width 302: "U+1F64x \x{D83D}\x{DE40} \x{D83D}\x{DE41} \x{D83D}\x{DE42} \x{D83D}\x{DE45} \x{D83D}\x{DE46} \x{D83D}\x{DE47} \x{D83D}\x{DE48} \x{D83D}\x{DE49} \x{D83D}\x{DE4A} \x{D83D}\x{DE4B} \x{D83D}\x{DE4C} \x{D83D}\x{DE4D} \x{D83D}\x{DE4E} \x{D83D}\x{DE4F}" text run at (302,64) width 0: " " text run at (0,80) width 312: "U+1F30x \x{D83C}\x{DF00} \x{D83C}\x{DF01} \x{D83C}\x{DF02} \x{D83C}\x{DF03} \x{D83C}\x{DF04} \x{D83C}\x{DF05} \x{D83C}\x{DF06} \x{D83C}\x{DF07} \x{D83C}\x{DF08} \x{D83C}\x{DF09} \x{D83C}\x{DF0A} \x{D83C}\x{DF0B} \x{D83C}\x{DF0C} \x{D83C}\x{DF0D} \x{D83C}\x{DF0E} \x{D83C}\x{DF0F}"
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/text/emphasis-complex-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/text/emphasis-complex-expected.png index 9d1ddf1..866d51ac 100644 --- a/third_party/WebKit/LayoutTests/platform/linux/fast/text/emphasis-complex-expected.png +++ b/third_party/WebKit/LayoutTests/platform/linux/fast/text/emphasis-complex-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/text/international/danda-space-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/text/international/danda-space-expected.png index 4fa90cb..f9aea5e 100644 --- a/third_party/WebKit/LayoutTests/platform/linux/fast/text/international/danda-space-expected.png +++ b/third_party/WebKit/LayoutTests/platform/linux/fast/text/international/danda-space-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/text/international/danda-space-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/fast/text/international/danda-space-expected.txt index 85ab953..359b9af 100644 --- a/third_party/WebKit/LayoutTests/platform/linux/fast/text/international/danda-space-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/linux/fast/text/international/danda-space-expected.txt
@@ -4,13 +4,13 @@ LayoutBlockFlow {HTML} at (0,0) size 800x600 LayoutBlockFlow {BODY} at (8,8) size 784x576 LayoutBlockFlow {P} at (0,0) size 784x20 - LayoutText {#text} at (0,0) size 51x19 - text run at (0,0) width 51: "Test for " - LayoutInline {A} at (0,0) size 66x19 [color=#0000EE] - LayoutText {#text} at (51,0) size 66x19 - text run at (51,0) width 66: "bug 25464" - LayoutText {#text} at (117,0) size 369x19 - text run at (117,0) width 369: ": Test for rendering of Danda (U+0964) followed by a space." + LayoutText {#text} at (0,0) size 50x19 + text run at (0,0) width 50: "Test for " + LayoutInline {A} at (0,0) size 67x19 [color=#0000EE] + LayoutText {#text} at (49,0) size 67x19 + text run at (49,0) width 67: "bug 25464" + LayoutText {#text} at (115,0) size 369x19 + text run at (115,0) width 369: ": Test for rendering of Danda (U+0964) followed by a space." LayoutBlockFlow {P} at (0,36) size 784x33 LayoutText {#text} at (0,6) size 299x19 text run at (0,6) width 299: "\x{A39}\x{A41}\x{A70}\x{A26}\x{A40} \x{A39}\x{A48}\x{964} \x{A07}\x{A38} \x{A32}\x{A3F}\x{A2A}\x{A40} \x{A26}\x{A47} \x{A35}\x{A3F}\x{A1A} \x{A69}\x{A6B} (35) \x{A05}\x{A71}\x{A16}\x{A30} \x{A39}\x{A41}\x{A70}\x{A26}\x{A47} \x{A39}\x{A28}\x{964}"
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/text/international/hindi-spacing-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/text/international/hindi-spacing-expected.png index 6d645009..bac2e42 100644 --- a/third_party/WebKit/LayoutTests/platform/linux/fast/text/international/hindi-spacing-expected.png +++ b/third_party/WebKit/LayoutTests/platform/linux/fast/text/international/hindi-spacing-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/text/international/hindi-spacing-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/fast/text/international/hindi-spacing-expected.txt index 26f924c..ccca827b 100644 --- a/third_party/WebKit/LayoutTests/platform/linux/fast/text/international/hindi-spacing-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/linux/fast/text/international/hindi-spacing-expected.txt
@@ -7,11 +7,11 @@ text run at (0,0) width 780: "This tests the width of a breaking space after a Hindi character to ensure that it's measured properly and enough space is left for it." text run at (0,20) width 681: "Neither the Hindi on the button below nor the same text on two lines below that should be truncated at either end." LayoutBR {BR} at (681,35) size 0x0 - LayoutButton {INPUT} at (0,40) size 116x29 [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)] - LayoutBlockFlow (anonymous) at (8,3) size 100x23 - LayoutText {#text} at (0,1) size 100x16 - text run at (0,1) width 100: "\x{915}\x{93F}\x{938}\x{940} \x{92D}\x{940} \x{924}\x{930}\x{939} \x{906}\x{917}\x{947} \x{92C}" - LayoutBR {BR} at (116,57) size 0x0 + LayoutButton {INPUT} at (0,40) size 118x29 [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)] + LayoutBlockFlow (anonymous) at (8,3) size 102x23 + LayoutText {#text} at (0,1) size 102x16 + text run at (0,1) width 102: "\x{915}\x{93F}\x{938}\x{940} \x{92D}\x{940} \x{924}\x{930}\x{939} \x{906}\x{917}\x{947} \x{92C}" + LayoutBR {BR} at (118,57) size 0x0 LayoutInline {SPAN} at (0,0) size 118x19 LayoutText {#text} at (0,72) size 118x19 text run at (0,72) width 118: "\x{915}\x{93F}\x{938}\x{940} \x{92D}\x{940} \x{924}\x{930}\x{939} \x{906}\x{917}\x{947} \x{92C}"
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/text/international/hindi-whitespace-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/text/international/hindi-whitespace-expected.png index 493b1ff..94b18bb30 100644 --- a/third_party/WebKit/LayoutTests/platform/linux/fast/text/international/hindi-whitespace-expected.png +++ b/third_party/WebKit/LayoutTests/platform/linux/fast/text/international/hindi-whitespace-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/text/selection-multiple-runs-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/text/selection-multiple-runs-expected.png index b0bf2dd..a6404d6 100644 --- a/third_party/WebKit/LayoutTests/platform/linux/fast/text/selection-multiple-runs-expected.png +++ b/third_party/WebKit/LayoutTests/platform/linux/fast/text/selection-multiple-runs-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt b/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt index ce5fa74..daa8b06 100644 --- a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt +++ b/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt
@@ -1126,6 +1126,7 @@ getter y getter z method constructor + method toJSON interface DOMRect : DOMRectReadOnly attribute @@toStringTag getter height
diff --git a/third_party/WebKit/Source/core/dom/DOMPointReadOnly.cpp b/third_party/WebKit/Source/core/dom/DOMPointReadOnly.cpp index e62791e..024d062 100644 --- a/third_party/WebKit/Source/core/dom/DOMPointReadOnly.cpp +++ b/third_party/WebKit/Source/core/dom/DOMPointReadOnly.cpp
@@ -4,6 +4,9 @@ #include "core/dom/DOMPointReadOnly.h" +#include "bindings/core/v8/ScriptValue.h" +#include "bindings/core/v8/V8ObjectBuilder.h" + namespace blink { DOMPointReadOnly* DOMPointReadOnly::create(double x, @@ -13,6 +16,16 @@ return new DOMPointReadOnly(x, y, z, w); } +ScriptValue DOMPointReadOnly::toJSONForBinding( + ScriptState* scriptState) const { + V8ObjectBuilder result(scriptState); + result.addNumber("x", x()); + result.addNumber("y", y()); + result.addNumber("z", z()); + result.addNumber("w", w()); + return result.scriptValue(); +} + DOMPointReadOnly::DOMPointReadOnly(double x, double y, double z, double w) : m_x(x), m_y(y), m_z(z), m_w(w) {}
diff --git a/third_party/WebKit/Source/core/dom/DOMPointReadOnly.h b/third_party/WebKit/Source/core/dom/DOMPointReadOnly.h index 0c2f98a2..f2544d9 100644 --- a/third_party/WebKit/Source/core/dom/DOMPointReadOnly.h +++ b/third_party/WebKit/Source/core/dom/DOMPointReadOnly.h
@@ -11,6 +11,9 @@ namespace blink { +class ScriptValue; +class ScriptState; + class CORE_EXPORT DOMPointReadOnly : public GarbageCollected<DOMPointReadOnly>, public ScriptWrappable { DEFINE_WRAPPERTYPEINFO(); @@ -24,7 +27,9 @@ double w() const { return m_w; } DEFINE_INLINE_TRACE() {} - + + ScriptValue toJSONForBinding(ScriptState*) const; + protected: DOMPointReadOnly(double x, double y, double z, double w);
diff --git a/third_party/WebKit/Source/core/dom/DOMPointReadOnly.idl b/third_party/WebKit/Source/core/dom/DOMPointReadOnly.idl index d80c8252..e94259e 100644 --- a/third_party/WebKit/Source/core/dom/DOMPointReadOnly.idl +++ b/third_party/WebKit/Source/core/dom/DOMPointReadOnly.idl
@@ -17,4 +17,5 @@ // FIXME: Implement matrixTransform. // DOMPoint matrixTransform(DOMMatrixReadOnly matrix); + serializer = { attribute }; };
diff --git a/third_party/WebKit/Source/core/frame/FrameView.cpp b/third_party/WebKit/Source/core/frame/FrameView.cpp index c47c1e0..be913bd 100644 --- a/third_party/WebKit/Source/core/frame/FrameView.cpp +++ b/third_party/WebKit/Source/core/frame/FrameView.cpp
@@ -1561,6 +1561,7 @@ void FrameView::viewportSizeChanged(bool widthChanged, bool heightChanged) { DCHECK(widthChanged || heightChanged); + DCHECK(m_frame->host()); if (LayoutViewItem layoutView = this->layoutViewItem()) { if (layoutView.usesCompositing()) @@ -1569,15 +1570,14 @@ // Ensure the root scroller compositing layers update geometry in response to // the URL bar resizing. - if (m_frame->isMainFrame()) { - m_frame->document() - ->frameHost() - ->globalRootScrollerController() - .mainFrameViewResized(); - } + if (m_frame->isMainFrame()) + m_frame->host()->globalRootScrollerController().mainFrameViewResized(); showOverlayScrollbars(); - if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { + + bool rootLayerScrollingEnabled = + RuntimeEnabledFeatures::rootLayerScrollingEnabled(); + if (rootLayerScrollingEnabled) { // The background must be repainted when the FrameView is resized, even if // the initial containing block does not change (so we can't rely on layout // to issue the invalidation). This is because the background fills the @@ -1590,19 +1590,30 @@ } if (RuntimeEnabledFeatures::inertTopControlsEnabled() && layoutView() && - layoutView()->style()->hasFixedBackgroundImage()) { - // In the case where we don't change layout size from top control resizes, - // we wont perform a layout. If we have a fixed background image however, - // the background layer needs to get resized so we should request a layout - // explicitly. - PaintLayer* layer = layoutView()->layer(); - if (layoutView()->compositor()->needsFixedRootBackgroundLayer(layer)) { - setNeedsLayout(); - } else if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { - // If root layer scrolls is on, we've already issued a full invalidation + m_frame->isMainFrame() && m_frame->host()->browserControls().height()) { + if (layoutView()->style()->hasFixedBackgroundImage()) { + // In the case where we don't change layout size from top control resizes, + // we wont perform a layout. If we have a fixed background image however, + // the background layer needs to get resized so we should request a layout + // explicitly. + PaintLayer* layer = layoutView()->layer(); + if (layoutView()->compositor()->needsFixedRootBackgroundLayer(layer)) { + setNeedsLayout(); + } else if (!rootLayerScrollingEnabled) { + // If root layer scrolls is on, we've already issued a full invalidation + // above. + layoutView()->setShouldDoFullPaintInvalidationOnResizeIfNeeded( + widthChanged, heightChanged); + } + } else if (heightChanged && !rootLayerScrollingEnabled) { + // If the document rect doesn't fill the full view height, hiding the + // URL bar will expose area outside the current LayoutView so we need to + // paint additional background. If RLS is on, we've already invalidated // above. - layoutView()->setShouldDoFullPaintInvalidationOnResizeIfNeeded( - widthChanged, heightChanged); + LayoutViewItem lvi = layoutViewItem(); + DCHECK(!lvi.isNull()); + if (lvi.documentRect().height() < lvi.viewRect().height()) + lvi.setShouldDoFullPaintInvalidation(); } }
diff --git a/third_party/WebKit/Source/core/layout/LayoutBox.cpp b/third_party/WebKit/Source/core/layout/LayoutBox.cpp index 1c8e33b..dcb72f2 100644 --- a/third_party/WebKit/Source/core/layout/LayoutBox.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutBox.cpp
@@ -1717,10 +1717,12 @@ // overflowClipRect(). The border box rect's size equals the frame rect's // size so we trigger a paint property update when the frame rect changes. setNeedsPaintPropertyUpdate(); - } else if (styleRef().hasTransform()) { - // The transform paint property's origin depends on the frame rect because - // transform-origin can be sized with lengths relative to the frame rect. - // See: PaintPropertyTreeBuilder::updateTransform(...). + } else if (styleRef().hasTransform() || styleRef().hasPerspective()) { + // Relative lengths (e.g., percentage values) in transform, perspective, + // transform-origin, and perspective-origin can depend on the size of the + // frame rect, so force a property update if it changes. + // TODO(pdr): We only need to update properties if there are relative + // lengths. setNeedsPaintPropertyUpdate(); } }
diff --git a/third_party/WebKit/Source/core/layout/LayoutView.cpp b/third_party/WebKit/Source/core/layout/LayoutView.cpp index 6333e60..2f1dcc9 100644 --- a/third_party/WebKit/Source/core/layout/LayoutView.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutView.cpp
@@ -229,9 +229,9 @@ IncludeScrollbarsInRect includeScrollbars = RuntimeEnabledFeatures::rootLayerScrollingEnabled() ? IncludeScrollbars : ExcludeScrollbars; - FloatSize viewSize(frameView()->visibleContentSize(includeScrollbars)); setShouldDoFullPaintInvalidationOnResizeIfNeeded( - offsetWidth() != viewSize.width(), offsetHeight() != viewSize.height()); + offsetWidth() != layoutSize(includeScrollbars).width(), + offsetHeight() != layoutSize(includeScrollbars).height()); if (pageLogicalHeight() && shouldUsePrintingLayout()) { m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = logicalWidth();
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_block_node.cc b/third_party/WebKit/Source/core/layout/ng/ng_block_node.cc index a551077..a1cdca3 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_block_node.cc +++ b/third_party/WebKit/Source/core/layout/ng/ng_block_node.cc
@@ -114,8 +114,10 @@ // TODO(cbiesinger): For orthogonal children, we need to always synthesize. NGLayoutAlgorithm::MinAndMaxState state = minmax_algorithm_->ComputeMinAndMaxContentSizes(sizes); - if (state == NGLayoutAlgorithm::kSuccess) + if (state == NGLayoutAlgorithm::kSuccess) { + minmax_algorithm_ = nullptr; return true; + } if (state == NGLayoutAlgorithm::kPending) return false; DCHECK_EQ(state, NGLayoutAlgorithm::kNotImplemented);
diff --git a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp index d566bce6..239e70d 100644 --- a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp +++ b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp
@@ -626,6 +626,8 @@ static FloatPoint perspectiveOrigin(const LayoutBox& box) { const ComputedStyle& style = box.styleRef(); + // Perspective origin has no effect without perspective. + DCHECK(style.hasPerspective()); FloatSize borderBoxSize(box.size()); return FloatPoint( floatValueForLength(style.perspectiveOriginX(), borderBoxSize.width()),
diff --git a/third_party/WebKit/Source/core/paint/PaintPropertyTreeUpdateTests.cpp b/third_party/WebKit/Source/core/paint/PaintPropertyTreeUpdateTests.cpp index 726bee4..4401e5f 100644 --- a/third_party/WebKit/Source/core/paint/PaintPropertyTreeUpdateTests.cpp +++ b/third_party/WebKit/Source/core/paint/PaintPropertyTreeUpdateTests.cpp
@@ -498,4 +498,57 @@ EXPECT_EQ(nullptr, properties->effect()); } +TEST_P(PaintPropertyTreeUpdateTest, PerspectiveOriginUpdatesOnSizeChanges) { + setBodyInnerHTML( + "<style>" + " body { margin: 0 }" + " #perspective {" + " position: absolute;" + " perspective: 100px;" + " width: 100px;" + " perspective-origin: 50% 50% 0;" + " }" + "</style>" + "<div id='perspective'>" + " <div id='contents'></div>" + "</div>"); + + auto* perspective = document().getElementById("perspective")->layoutObject(); + EXPECT_EQ(TransformationMatrix().applyPerspective(100), + perspective->paintProperties()->perspective()->matrix()); + EXPECT_EQ(FloatPoint3D(50, 0, 0), + perspective->paintProperties()->perspective()->origin()); + + auto* contents = document().getElementById("contents"); + contents->setAttribute(HTMLNames::styleAttr, "height: 200px;"); + document().view()->updateAllLifecyclePhases(); + EXPECT_EQ(TransformationMatrix().applyPerspective(100), + perspective->paintProperties()->perspective()->matrix()); + EXPECT_EQ(FloatPoint3D(50, 100, 0), + perspective->paintProperties()->perspective()->origin()); +} + +TEST_P(PaintPropertyTreeUpdateTest, TransformUpdatesOnRelativeLengthChanges) { + setBodyInnerHTML( + "<style>" + " body { margin: 0 }" + " #transform {" + " transform: translate3d(50%, 50%, 0);" + " width: 100px;" + " height: 200px;" + " }" + "</style>" + "<div id='transform'></div>"); + + auto* transform = document().getElementById("transform"); + auto* transformObject = transform->layoutObject(); + EXPECT_EQ(TransformationMatrix().translate3d(50, 100, 0), + transformObject->paintProperties()->transform()->matrix()); + + transform->setAttribute(HTMLNames::styleAttr, "width: 200px; height: 300px;"); + document().view()->updateAllLifecyclePhases(); + EXPECT_EQ(TransformationMatrix().translate3d(100, 150, 0), + transformObject->paintProperties()->transform()->matrix()); +} + } // namespace blink
diff --git a/third_party/WebKit/Source/devtools/BUILD.gn b/third_party/WebKit/Source/devtools/BUILD.gn index 39f3038..cc8e633 100644 --- a/third_party/WebKit/Source/devtools/BUILD.gn +++ b/third_party/WebKit/Source/devtools/BUILD.gn
@@ -6,28 +6,90 @@ import("//third_party/WebKit/public/public_features.gni") import("//third_party/WebKit/Source/core/core.gni") -devtools_embedder_scripts = [ - "front_end/devtools_compatibility.js", - "front_end/Tests.js", -] -devtools_core_base_files = [ +all_devtools_files = [ + "front_end/accessibility/AccessibilityModel.js", + "front_end/accessibility/accessibilityNode.css", + "front_end/accessibility/AccessibilityNodeView.js", + "front_end/accessibility/AccessibilitySidebarView.js", + "front_end/accessibility/AccessibilityStrings.js", + "front_end/accessibility/ARIAAttributesView.js", + "front_end/accessibility/ARIAConfig.js", + "front_end/accessibility/ARIAMetadata.js", + "front_end/accessibility/AXTreePane.js", + "front_end/accessibility/module.json", + "front_end/animation/AnimationGroupPreviewUI.js", + "front_end/animation/AnimationModel.js", + "front_end/animation/animationScreenshotPopover.css", + "front_end/animation/AnimationScreenshotPopover.js", + "front_end/animation/animationTimeline.css", + "front_end/animation/AnimationTimeline.js", + "front_end/animation/AnimationUI.js", + "front_end/animation/module.json", + "front_end/audits/AuditCategories.js", + "front_end/audits/AuditCategory.js", + "front_end/audits/AuditController.js", + "front_end/audits/AuditExtensionCategory.js", + "front_end/audits/AuditFormatters.js", + "front_end/audits/AuditLauncherView.js", + "front_end/audits/auditResultTree.css", + "front_end/audits/AuditResultView.js", + "front_end/audits/AuditRules.js", + "front_end/audits/auditsPanel.css", + "front_end/audits/AuditsPanel.js", + "front_end/audits/auditsSidebarTree.css", + "front_end/audits/module.json", "front_end/audits2_worker.js", "front_end/audits2_worker.json", - "front_end/inspector.js", - "front_end/inspector.json", - "front_end/formatter_worker.js", - "front_end/formatter_worker.json", - "front_end/heap_snapshot_worker.js", - "front_end/heap_snapshot_worker.json", - "front_end/utility_shared_worker.js", - "front_end/utility_shared_worker.json", - "front_end/unit_test_runner.js", - "front_end/unit_test_runner.json", - "front_end/toolbox.js", - "front_end/toolbox.json", - "front_end/Runtime.js", -] -devtools_common_js_files = [ + "front_end/audits2_worker/Audits2Service.js", + "front_end/audits2_worker/lighthouse/lighthouse-background.js", + "front_end/audits2_worker/module.json", + "front_end/audits2/Audits2Panel.js", + "front_end/audits2/module.json", + "front_end/bindings/BlackboxManager.js", + "front_end/bindings/BreakpointManager.js", + "front_end/bindings/CompilerScriptMapping.js", + "front_end/bindings/ContentProviderBasedProject.js", + "front_end/bindings/CSSWorkspaceBinding.js", + "front_end/bindings/DebuggerWorkspaceBinding.js", + "front_end/bindings/DefaultScriptMapping.js", + "front_end/bindings/FileUtils.js", + "front_end/bindings/LiveLocation.js", + "front_end/bindings/module.json", + "front_end/bindings/NetworkProject.js", + "front_end/bindings/PresentationConsoleMessageHelper.js", + "front_end/bindings/ResourceScriptMapping.js", + "front_end/bindings/ResourceUtils.js", + "front_end/bindings/SASSSourceMapping.js", + "front_end/bindings/StylesSourceMapping.js", + "front_end/bindings/TempFile.js", + "front_end/cm_modes/clike.js", + "front_end/cm_modes/clojure.js", + "front_end/cm_modes/coffeescript.js", + "front_end/cm_modes/DefaultCodeMirrorMimeMode.js", + "front_end/cm_modes/livescript.js", + "front_end/cm_modes/module.json", + "front_end/cm_modes/php.js", + "front_end/cm_modes/python.js", + "front_end/cm_modes/shell.js", + "front_end/cm/activeline.js", + "front_end/cm/closebrackets.js", + "front_end/cm/codemirror.css", + "front_end/cm/codemirror.js", + "front_end/cm/comment.js", + "front_end/cm/css.js", + "front_end/cm/css.js", + "front_end/cm/headlesscodemirror.js", + "front_end/cm/headlesscodemirror.js", + "front_end/cm/htmlembedded.js", + "front_end/cm/htmlmixed.js", + "front_end/cm/javascript.js", + "front_end/cm/markselection.js", + "front_end/cm/matchbrackets.js", + "front_end/cm/multiplex.js", + "front_end/cm/overlay.js", + "front_end/cm/simple.js", + "front_end/cm/xml.js", + "front_end/cm/xml.js", "front_end/common/CharacterIdMap.js", "front_end/common/Color.js", "front_end/common/Console.js", @@ -35,6 +97,7 @@ "front_end/common/CSSShadowModel.js", "front_end/common/FormatterWorkerPool.js", "front_end/common/Geometry.js", + "front_end/common/module.json", "front_end/common/ModuleExtensionInterfaces.js", "front_end/common/Object.js", "front_end/common/OutputStream.js", @@ -48,60 +111,278 @@ "front_end/common/TextDictionary.js", "front_end/common/TextRange.js", "front_end/common/TextUtils.js", + "front_end/common/TextUtils.js", "front_end/common/Throttler.js", "front_end/common/Trie.js", "front_end/common/UIString.js", + "front_end/common/UIString.js", "front_end/common/Worker.js", -] -devtools_components_js_files = [ + "front_end/components_lazy/CookiesTable.js", + "front_end/components_lazy/filmStripDialog.css", + "front_end/components_lazy/FilmStripModel.js", + "front_end/components_lazy/filmStripView.css", + "front_end/components_lazy/FilmStripView.js", + "front_end/components_lazy/GCActionDelegate.js", + "front_end/components_lazy/LineLevelProfile.js", + "front_end/components_lazy/module.json", "front_end/components/breakpointsList.css", + "front_end/components/BreakpointsSidebarPaneBase.js", "front_end/components/customPreviewSection.css", - "front_end/components/domUtils.css", - "front_end/components/eventListenersView.css", - "front_end/components/networkConditionsSettingsTab.css", - "front_end/components/objectPropertiesSection.css", - "front_end/components/objectValue.css", - "front_end/components/spectrum.css", "front_end/components/CustomPreviewSection.js", "front_end/components/DataSaverInfobar.js", "front_end/components/DockController.js", "front_end/components/DOMBreakpointsSidebarPane.js", "front_end/components/DOMPresentationUtils.js", + "front_end/components/domUtils.css", + "front_end/components/EventListenersUtils.js", + "front_end/components/eventListenersView.css", + "front_end/components/EventListenersView.js", "front_end/components/ExecutionContextSelector.js", "front_end/components/JavaScriptAutocomplete.js", - "front_end/components/BreakpointsSidebarPaneBase.js", "front_end/components/Linkifier.js", + "front_end/components/module.json", "front_end/components/NetworkConditionsSelector.js", + "front_end/components/networkConditionsSettingsTab.css", "front_end/components/ObjectPopoverHelper.js", + "front_end/components/objectPropertiesSection.css", "front_end/components/ObjectPropertiesSection.js", + "front_end/components/objectValue.css", + "front_end/components/Reload.js", "front_end/components/RemoteObjectPreviewFormatter.js", "front_end/components/RequestAppBannerActionDelegate.js", "front_end/components/ShortcutsScreen.js", + "front_end/components/spectrum.css", "front_end/components/Spectrum.js", - "front_end/components/EventListenersUtils.js", - "front_end/components/EventListenersView.js", - "front_end/components/Reload.js", -] -devtools_host_js_files = [ - "front_end/host/InspectorFrontendHostAPI.js", + "front_end/console/ConsoleContextSelector.js", + "front_end/console/ConsolePanel.js", + "front_end/console/ConsolePrompt.js", + "front_end/console/consoleView.css", + "front_end/console/ConsoleView.js", + "front_end/console/ConsoleViewMessage.js", + "front_end/console/ConsoleViewport.js", + "front_end/console/module.json", + "front_end/css_tracker/cssTrackerView.css", + "front_end/css_tracker/CSSTrackerView.js", + "front_end/css_tracker/module.json", + "front_end/css_tracker/unusedRulesTree.css", + "front_end/devices/devicesView.css", + "front_end/devices/DevicesView.js", + "front_end/devices/module.json", + "front_end/diff/diff_match_patch.js", + "front_end/diff/Diff.js", + "front_end/diff/module.json", + "front_end/elements/breadcrumbs.css", + "front_end/elements/ClassesPaneWidget.js", + "front_end/elements/ColorSwatchPopoverIcon.js", + "front_end/elements/ComputedStyleModel.js", + "front_end/elements/computedStyleSidebarPane.css", + "front_end/elements/ComputedStyleWidget.js", + "front_end/elements/ElementsBreadcrumbs.js", + "front_end/elements/elementsPanel.css", + "front_end/elements/ElementsPanel.js", + "front_end/elements/ElementsSidebarPane.js", + "front_end/elements/ElementStatePaneWidget.js", + "front_end/elements/ElementsTreeElement.js", + "front_end/elements/ElementsTreeElementHighlighter.js", + "front_end/elements/elementsTreeOutline.css", + "front_end/elements/ElementsTreeOutline.js", + "front_end/elements/EventListenersWidget.js", + "front_end/elements/InspectElementModeController.js", + "front_end/elements/MetricsSidebarPane.js", + "front_end/elements/module.json", + "front_end/elements/platformFontsWidget.css", + "front_end/elements/PlatformFontsWidget.js", + "front_end/elements/PropertiesWidget.js", + "front_end/elements/StylePropertyHighlighter.js", + "front_end/elements/stylesSectionTree.css", + "front_end/elements/StylesSidebarPane.js", + "front_end/emulated_devices/module.json", + "front_end/emulation/AdvancedApp.js", + "front_end/emulation/DeviceModeModel.js", + "front_end/emulation/deviceModeToolbar.css", + "front_end/emulation/DeviceModeToolbar.js", + "front_end/emulation/deviceModeView.css", + "front_end/emulation/DeviceModeView.js", + "front_end/emulation/DeviceModeWrapper.js", + "front_end/emulation/DeviceOrientation.js", + "front_end/emulation/devicesSettingsTab.css", + "front_end/emulation/DevicesSettingsTab.js", + "front_end/emulation/EmulatedDevices.js", + "front_end/emulation/Geolocation.js", + "front_end/emulation/inspectedPagePlaceholder.css", + "front_end/emulation/InspectedPagePlaceholder.js", + "front_end/emulation/mediaQueryInspector.css", + "front_end/emulation/MediaQueryInspector.js", + "front_end/emulation/module.json", + "front_end/emulation/sensors.css", + "front_end/emulation/SensorsView.js", + "front_end/emulation/TouchModel.js", + "front_end/extensions/ExtensionAPI.js", + "front_end/extensions/ExtensionAuditCategory.js", + "front_end/extensions/ExtensionPanel.js", + "front_end/extensions/ExtensionRegistryStub.js", + "front_end/extensions/ExtensionServer.js", + "front_end/extensions/ExtensionView.js", + "front_end/extensions/module.json", + "front_end/formatter_worker.js", + "front_end/formatter_worker.json", + "front_end/formatter_worker/acorn/acorn.js", + "front_end/formatter_worker/acorn/acorn.js", + "front_end/formatter_worker/AcornTokenizer.js", + "front_end/formatter_worker/CSSFormatter.js", + "front_end/formatter_worker/CSSRuleParser.js", + "front_end/formatter_worker/ESTreeWalker.js", + "front_end/formatter_worker/FormattedContentBuilder.js", + "front_end/formatter_worker/FormatterWorker.js", + "front_end/formatter_worker/HTMLFormatter.js", + "front_end/formatter_worker/IdentityFormatter.js", + "front_end/formatter_worker/JavaScriptFormatter.js", + "front_end/formatter_worker/JavaScriptOutline.js", + "front_end/formatter_worker/module.json", + "front_end/formatter_worker/RelaxedJSONParser.js", + "front_end/gonzales/gonzales-scss.js", + "front_end/gonzales/module.json", + "front_end/gonzales/SCSSParser.js", + "front_end/heap_snapshot_worker.js", + "front_end/heap_snapshot_worker.json", + "front_end/heap_snapshot_worker/AllocationProfile.js", + "front_end/heap_snapshot_worker/HeapSnapshot.js", + "front_end/heap_snapshot_worker/HeapSnapshotLoader.js", + "front_end/heap_snapshot_worker/HeapSnapshotWorker.js", + "front_end/heap_snapshot_worker/HeapSnapshotWorkerDispatcher.js", + "front_end/heap_snapshot_worker/module.json", "front_end/host/InspectorFrontendHost.js", + "front_end/host/InspectorFrontendHostAPI.js", + "front_end/host/module.json", "front_end/host/Platform.js", "front_end/host/ResourceLoader.js", "front_end/host/UserMetrics.js", -] -devtools_sass_js_files = [ + "front_end/inspector.js", + "front_end/inspector.json", + "front_end/layer_viewer/layerDetailsView.css", + "front_end/layer_viewer/LayerDetailsView.js", + "front_end/layer_viewer/layers3DView.css", + "front_end/layer_viewer/Layers3DView.js", + "front_end/layer_viewer/LayerTreeOutline.js", + "front_end/layer_viewer/LayerViewHost.js", + "front_end/layer_viewer/module.json", + "front_end/layer_viewer/paintProfiler.css", + "front_end/layer_viewer/PaintProfilerView.js", + "front_end/layer_viewer/TransformController.js", + "front_end/layers/LayerPaintProfilerView.js", + "front_end/layers/LayersPanel.js", + "front_end/layers/LayerTreeModel.js", + "front_end/layers/module.json", + "front_end/main/errorWarningCounter.css", + "front_end/main/Main.js", + "front_end/main/module.json", + "front_end/main/OverlayController.js", + "front_end/main/remoteDebuggingTerminatedScreen.css", + "front_end/main/renderingOptions.css", + "front_end/main/RenderingOptions.js", + "front_end/main/SimpleApp.js", + "front_end/main/targetCrashedScreen.css", + "front_end/network/blockedURLsPane.css", + "front_end/network/BlockedURLsPane.js", + "front_end/network/eventSourceMessagesView.css", + "front_end/network/EventSourceMessagesView.js", + "front_end/network/FilterSuggestionBuilder.js", + "front_end/network/HARWriter.js", + "front_end/network/JSONView.js", + "front_end/network/module.json", + "front_end/network/networkConfigView.css", + "front_end/network/NetworkConfigView.js", + "front_end/network/NetworkDataGridNode.js", + "front_end/network/NetworkItemView.js", + "front_end/network/networkLogView.css", + "front_end/network/NetworkLogView.js", + "front_end/network/NetworkLogViewColumns.js", + "front_end/network/networkManageCustomHeadersView.css", + "front_end/network/NetworkManageCustomHeadersView.js", + "front_end/network/NetworkOverview.js", + "front_end/network/networkPanel.css", + "front_end/network/NetworkPanel.js", + "front_end/network/NetworkTimeCalculator.js", + "front_end/network/NetworkWaterfallColumn.js", + "front_end/network/requestCookiesView.css", + "front_end/network/RequestCookiesView.js", + "front_end/network/requestHeadersTree.css", + "front_end/network/requestHeadersView.css", + "front_end/network/RequestHeadersView.js", + "front_end/network/RequestHTMLView.js", + "front_end/network/RequestPreviewView.js", + "front_end/network/RequestResponseView.js", + "front_end/network/RequestTimingView.js", + "front_end/network/RequestView.js", + "front_end/network/ResourceWebSocketFrameView.js", + "front_end/network/webSocketFrameView.css", + "front_end/network/xmlTree.css", + "front_end/network/xmlView.css", + "front_end/network/XMLView.js", + "front_end/persistence/Automapping.js", + "front_end/persistence/DefaultMapping.js", + "front_end/persistence/FileSystemWorkspaceBinding.js", + "front_end/persistence/Persistence.js", + "front_end/persistence/PersistenceUtils.js", + "front_end/platform/DOMExtension.js", + "front_end/platform/module.json", + "front_end/platform/utilities.js", + "front_end/platform/utilities.js", + "front_end/platform/utilities.js", + "front_end/profiler/BottomUpProfileDataGrid.js", + "front_end/profiler/CPUProfileFlameChart.js", + "front_end/profiler/CPUProfileView.js", + "front_end/profiler/heapProfiler.css", + "front_end/profiler/HeapProfileView.js", + "front_end/profiler/HeapSnapshotCommon.js", + "front_end/profiler/HeapSnapshotCommon.js", + "front_end/profiler/HeapSnapshotDataGrids.js", + "front_end/profiler/HeapSnapshotGridNodes.js", + "front_end/profiler/HeapSnapshotProxy.js", + "front_end/profiler/HeapSnapshotView.js", + "front_end/profiler/module.json", + "front_end/profiler/ProfileDataGrid.js", + "front_end/profiler/ProfileLauncherView.js", + "front_end/profiler/profilesPanel.css", + "front_end/profiler/ProfilesPanel.js", + "front_end/profiler/profilesSidebarTree.css", + "front_end/profiler/ProfileTypeRegistry.js", + "front_end/profiler/ProfileView.js", + "front_end/profiler/TargetsComboBoxController.js", + "front_end/profiler/TopDownProfileDataGrid.js", + "front_end/resources/ApplicationCacheItemsView.js", + "front_end/resources/appManifestView.css", + "front_end/resources/AppManifestView.js", + "front_end/resources/clearStorageView.css", + "front_end/resources/ClearStorageView.js", + "front_end/resources/CookieItemsView.js", + "front_end/resources/DatabaseModel.js", + "front_end/resources/DatabaseQueryView.js", + "front_end/resources/DatabaseTableView.js", + "front_end/resources/DOMStorageItemsView.js", + "front_end/resources/DOMStorageModel.js", + "front_end/resources/IndexedDBModel.js", + "front_end/resources/indexedDBViews.css", + "front_end/resources/IndexedDBViews.js", + "front_end/resources/module.json", + "front_end/resources/resourcesPanel.css", + "front_end/resources/ResourcesPanel.js", + "front_end/resources/resourcesSidebar.css", + "front_end/resources/serviceWorkerCacheViews.css", + "front_end/resources/ServiceWorkerCacheViews.js", + "front_end/resources/serviceWorkersView.css", + "front_end/resources/ServiceWorkersView.js", + "front_end/Runtime.js", "front_end/sass/ASTService.js", "front_end/sass/ASTSourceMap.js", + "front_end/sass/module.json", "front_end/sass/SASSProcessor.js", - "front_end/sass/SASSSupport.js", "front_end/sass/SASSSourceMapFactory.js", -] -devtools_screencast_js_files = [ - "front_end/screencast/screencastView.css", + "front_end/sass/SASSSupport.js", + "front_end/screencast/module.json", "front_end/screencast/ScreencastApp.js", + "front_end/screencast/screencastView.css", "front_end/screencast/ScreencastView.js", -] -devtools_sdk_js_files = [ "front_end/sdk/ApplicationCacheModel.js", "front_end/sdk/Connections.js", "front_end/sdk/ConsoleModel.js", @@ -123,6 +404,7 @@ "front_end/sdk/HeapProfilerModel.js", "front_end/sdk/InspectorBackend.js", "front_end/sdk/LayerTreeBase.js", + "front_end/sdk/module.json", "front_end/sdk/NetworkLog.js", "front_end/sdk/NetworkManager.js", "front_end/sdk/NetworkRequest.js", @@ -142,322 +424,252 @@ "front_end/sdk/TargetManager.js", "front_end/sdk/TracingManager.js", "front_end/sdk/TracingModel.js", -] -devtools_workspace_js_files = [ - "front_end/workspace/FileManager.js", - "front_end/workspace/FileSystemMapping.js", - "front_end/workspace/IsolatedFileSystem.js", - "front_end/workspace/IsolatedFileSystemManager.js", - "front_end/workspace/SearchConfig.js", - "front_end/workspace/UISourceCode.js", - "front_end/workspace/Workspace.js", -] -devtools_bindings_js_files = [ - "front_end/bindings/BlackboxManager.js", - "front_end/bindings/BreakpointManager.js", - "front_end/bindings/CompilerScriptMapping.js", - "front_end/bindings/ContentProviderBasedProject.js", - "front_end/bindings/CSSWorkspaceBinding.js", - "front_end/bindings/DebuggerWorkspaceBinding.js", - "front_end/bindings/DefaultScriptMapping.js", - "front_end/bindings/FileUtils.js", - "front_end/bindings/LiveLocation.js", - "front_end/bindings/NetworkProject.js", - "front_end/bindings/PresentationConsoleMessageHelper.js", - "front_end/bindings/ResourceScriptMapping.js", - "front_end/bindings/ResourceUtils.js", - "front_end/bindings/SASSSourceMapping.js", - "front_end/bindings/StylesSourceMapping.js", - "front_end/bindings/TempFile.js", -] -devtools_persistence_js_files = [ - "front_end/persistence/FileSystemWorkspaceBinding.js", - "front_end/persistence/DefaultMapping.js", - "front_end/persistence/Automapping.js", - "front_end/persistence/Persistence.js", - "front_end/persistence/PersistenceUtils.js", -] -devtools_platform_js_files = [ - "front_end/platform/DOMExtension.js", - "front_end/platform/utilities.js", -] -devtools_toolbox_bootstrap_js_files = - [ "front_end/toolbox_bootstrap/Toolbox.js" ] -devtools_emulation_js_files = [ - "front_end/emulation/devicesSettingsTab.css", - "front_end/emulation/deviceModeToolbar.css", - "front_end/emulation/deviceModeView.css", - "front_end/emulation/inspectedPagePlaceholder.css", - "front_end/emulation/mediaQueryInspector.css", - "front_end/emulation/sensors.css", - "front_end/emulation/AdvancedApp.js", - "front_end/emulation/DeviceModeModel.js", - "front_end/emulation/DeviceModeToolbar.js", - "front_end/emulation/DeviceModeView.js", - "front_end/emulation/DeviceModeWrapper.js", - "front_end/emulation/DeviceOrientation.js", - "front_end/emulation/DevicesSettingsTab.js", - "front_end/emulation/EmulatedDevices.js", - "front_end/emulation/Geolocation.js", - "front_end/emulation/InspectedPagePlaceholder.js", - "front_end/emulation/MediaQueryInspector.js", - "front_end/emulation/SensorsView.js", - "front_end/emulation/TouchModel.js", -] -devtools_ui_js_files = [ + "front_end/security/lockIcon.css", + "front_end/security/mainView.css", + "front_end/security/module.json", + "front_end/security/originView.css", + "front_end/security/SecurityModel.js", + "front_end/security/SecurityPanel.js", + "front_end/security/sidebar.css", + "front_end/services/ServiceManager.js", + "front_end/settings/editFileSystemView.css", + "front_end/settings/EditFileSystemView.js", + "front_end/settings/frameworkBlackboxSettingsTab.css", + "front_end/settings/FrameworkBlackboxSettingsTab.js", + "front_end/settings/module.json", + "front_end/settings/settingsScreen.css", + "front_end/settings/SettingsScreen.js", + "front_end/shell/module.json", + "front_end/shell/TestShell.js", + "front_end/snippets/module.json", + "front_end/snippets/ScriptSnippetModel.js", + "front_end/snippets/SnippetStorage.js", + "front_end/source_frame/fontView.css", + "front_end/source_frame/FontView.js", + "front_end/source_frame/imageView.css", + "front_end/source_frame/ImageView.js", + "front_end/source_frame/module.json", + "front_end/source_frame/ResourceSourceFrame.js", + "front_end/source_frame/SourceFrame.js", + "front_end/source_frame/SourcesTextEditor.js", + "front_end/sources/AddSourceMapURLDialog.js", + "front_end/sources/AdvancedSearchView.js", + "front_end/sources/CallStackSidebarPane.js", + "front_end/sources/CSSSourceFrame.js", + "front_end/sources/EditingLocationHistoryManager.js", + "front_end/sources/eventListenerBreakpoints.css", + "front_end/sources/EventListenerBreakpointsSidebarPane.js", + "front_end/sources/fileBasedSearchResultsPane.css", + "front_end/sources/FileBasedSearchResultsPane.js", + "front_end/sources/FilePathScoreFunction.js", + "front_end/sources/FilteredUISourceCodeListDelegate.js", + "front_end/sources/InplaceFormatterEditorAction.js", + "front_end/sources/JavaScriptBreakpointsSidebarPane.js", + "front_end/sources/JavaScriptCompiler.js", + "front_end/sources/JavaScriptOutlineDialog.js", + "front_end/sources/JavaScriptSourceFrame.js", + "front_end/sources/module.json", + "front_end/sources/navigatorTree.css", + "front_end/sources/navigatorView.css", + "front_end/sources/NavigatorView.js", + "front_end/sources/ObjectEventListenersSidebarPane.js", + "front_end/sources/OpenResourceDialog.js", + "front_end/sources/revisionHistory.css", + "front_end/sources/RevisionHistoryView.js", + "front_end/sources/ScopeChainSidebarPane.js", + "front_end/sources/ScriptFormatter.js", + "front_end/sources/ScriptFormatterEditorAction.js", + "front_end/sources/serviceWorkersSidebar.css", + "front_end/sources/SimpleHistoryManager.js", + "front_end/sources/SourceCodeDiff.js", + "front_end/sources/SourceMapNamesResolver.js", + "front_end/sources/SourcesNavigator.js", + "front_end/sources/sourcesPanel.css", + "front_end/sources/SourcesPanel.js", + "front_end/sources/sourcesSearch.css", + "front_end/sources/SourcesSearchScope.js", + "front_end/sources/sourcesView.css", + "front_end/sources/SourcesView.js", + "front_end/sources/StyleSheetOutlineDialog.js", + "front_end/sources/TabbedEditorContainer.js", + "front_end/sources/ThreadsSidebarPane.js", + "front_end/sources/uiList.css", + "front_end/sources/UIList.js", + "front_end/sources/UISourceCodeFrame.js", + "front_end/sources/WatchExpressionsSidebarPane.js", + "front_end/sources/WorkspaceMappingTip.js", + "front_end/sources/XHRBreakpointsSidebarPane.js", + "front_end/terminal/terminal.css", + "front_end/terminal/TerminalWidget.js", + "front_end/terminal/xterm.js/addons/fit/fit.js", + "front_end/terminal/xterm.js/build/xterm.css", + "front_end/terminal/xterm.js/build/xterm.js", + "front_end/test_runner/module.json", + "front_end/test_runner/TestRunner.js", + "front_end/text_editor/cmdevtools.css", + "front_end/text_editor/CodeMirrorTextEditor.js", + "front_end/text_editor/CodeMirrorUtils.js", + "front_end/text_editor/module.json", + "front_end/text_editor/TextEditorAutocompleteController.js", + "front_end/timeline_model/module.json", + "front_end/timeline_model/TimelineFrameModel.js", + "front_end/timeline_model/TimelineIRModel.js", + "front_end/timeline_model/TimelineJSProfile.js", + "front_end/timeline_model/TimelineModel.js", + "front_end/timeline_model/TimelineProfileTree.js", + "front_end/timeline_model/TracingLayerTree.js", + "front_end/timeline/CountersGraph.js", + "front_end/timeline/invalidationsTree.css", + "front_end/timeline/MemoryCountersGraph.js", + "front_end/timeline/module.json", + "front_end/timeline/TimelineController.js", + "front_end/timeline/TimelineEventOverview.js", + "front_end/timeline/TimelineFlameChart.js", + "front_end/timeline/timelineFlamechartPopover.css", + "front_end/timeline/TimelineFlameChartView.js", + "front_end/timeline/timelineLandingPage.css", + "front_end/timeline/TimelineLandingPage.js", + "front_end/timeline/TimelineLayersView.js", + "front_end/timeline/TimelineLoader.js", + "front_end/timeline/TimelineNetworkFlameChart.js", + "front_end/timeline/timelinePaintProfiler.css", + "front_end/timeline/TimelinePaintProfilerView.js", + "front_end/timeline/timelinePanel.css", + "front_end/timeline/TimelinePanel.js", + "front_end/timeline/timelineStatusDialog.css", + "front_end/timeline/TimelineTreeView.js", + "front_end/timeline/TimelineUIUtils.js", + "front_end/toolbox_bootstrap/module.json", + "front_end/toolbox_bootstrap/Toolbox.js", + "front_end/toolbox.js", + "front_end/toolbox.json", + "front_end/ui_lazy/ChartViewport.js", + "front_end/ui_lazy/CommandMenu.js", + "front_end/ui_lazy/dataGrid.css", + "front_end/ui_lazy/DataGrid.js", + "front_end/ui_lazy/dialog.css", + "front_end/ui_lazy/filteredListWidget.css", + "front_end/ui_lazy/FilteredListWidget.js", + "front_end/ui_lazy/flameChart.css", + "front_end/ui_lazy/FlameChart.js", + "front_end/ui_lazy/module.json", + "front_end/ui_lazy/overviewGrid.css", + "front_end/ui_lazy/OverviewGrid.js", + "front_end/ui_lazy/pieChart.css", + "front_end/ui_lazy/PieChart.js", + "front_end/ui_lazy/ShowMoreDataGridNode.js", + "front_end/ui_lazy/SortableDataGrid.js", + "front_end/ui_lazy/timelineGrid.css", + "front_end/ui_lazy/TimelineGrid.js", + "front_end/ui_lazy/TimelineOverviewPane.js", + "front_end/ui_lazy/ViewportDataGrid.js", + "front_end/ui/ActionRegistry.js", "front_end/ui/bezierEditor.css", + "front_end/ui/BezierEditor.js", "front_end/ui/bezierSwatch.css", + "front_end/ui/BezierUI.js", "front_end/ui/checkboxTextLabel.css", "front_end/ui/closeButton.css", "front_end/ui/colorSwatch.css", - "front_end/ui/cssShadowEditor.css", - "front_end/ui/cssShadowSwatch.css", - "front_end/ui/dialog.css", - "front_end/ui/dropTarget.css", - "front_end/ui/emptyWidget.css", - "front_end/ui/filter.css", - "front_end/ui/infobar.css", - "front_end/ui/inspectorCommon.css", - "front_end/ui/inspectorStyle.css", - "front_end/ui/inspectorSyntaxHighlight.css", - "front_end/ui/inspectorSyntaxHighlightDark.css", - "front_end/ui/inspectorViewTabbedPane.css", - "front_end/ui/listWidget.css", - "front_end/ui/panelEnablerView.css", - "front_end/ui/popover.css", - "front_end/ui/progressIndicator.css", - "front_end/ui/radioButton.css", - "front_end/ui/reportView.css", - "front_end/ui/rootView.css", - "front_end/ui/searchableView.css", - "front_end/ui/slider.css", - "front_end/ui/softContextMenu.css", - "front_end/ui/smallBubble.css", - "front_end/ui/splitWidget.css", - "front_end/ui/toolbar.css", - "front_end/ui/tooltip.css", - "front_end/ui/suggestBox.css", - "front_end/ui/tabbedPane.css", - "front_end/ui/textButton.css", - "front_end/ui/textPrompt.css", - "front_end/ui/treeoutline.css", - "front_end/ui/viewContainers.css", - "front_end/ui/ActionRegistry.js", - "front_end/ui/BezierEditor.js", - "front_end/ui/BezierUI.js", "front_end/ui/ColorSwatch.js", "front_end/ui/Context.js", "front_end/ui/ContextMenu.js", + "front_end/ui/cssShadowEditor.css", "front_end/ui/CSSShadowEditor.js", + "front_end/ui/cssShadowSwatch.css", + "front_end/ui/dialog.css", "front_end/ui/Dialog.js", "front_end/ui/DOMSyntaxHighlighter.js", "front_end/ui/DropDownMenu.js", + "front_end/ui/dropTarget.css", "front_end/ui/DropTarget.js", + "front_end/ui/emptyWidget.css", "front_end/ui/EmptyWidget.js", + "front_end/ui/filter.css", "front_end/ui/FilterBar.js", "front_end/ui/ForwardedInputEventHandler.js", "front_end/ui/HistoryInput.js", "front_end/ui/Icon.js", + "front_end/ui/infobar.css", "front_end/ui/Infobar.js", "front_end/ui/InplaceEditor.js", - "front_end/ui/TextEditor.js", + "front_end/ui/inspectorCommon.css", + "front_end/ui/inspectorStyle.css", + "front_end/ui/inspectorSyntaxHighlight.css", + "front_end/ui/inspectorSyntaxHighlightDark.css", "front_end/ui/InspectorView.js", + "front_end/ui/inspectorViewTabbedPane.css", "front_end/ui/KeyboardShortcut.js", + "front_end/ui/listWidget.css", "front_end/ui/ListWidget.js", + "front_end/ui/module.json", "front_end/ui/Panel.js", + "front_end/ui/panelEnablerView.css", + "front_end/ui/popover.css", "front_end/ui/Popover.js", + "front_end/ui/progressIndicator.css", "front_end/ui/ProgressIndicator.js", + "front_end/ui/radioButton.css", + "front_end/ui/reportView.css", "front_end/ui/ReportView.js", "front_end/ui/ResizerWidget.js", + "front_end/ui/rootView.css", "front_end/ui/RootView.js", + "front_end/ui/searchableView.css", "front_end/ui/SearchableView.js", "front_end/ui/SettingsUI.js", "front_end/ui/ShortcutRegistry.js", + "front_end/ui/slider.css", + "front_end/ui/smallBubble.css", + "front_end/ui/softContextMenu.css", "front_end/ui/SoftContextMenu.js", + "front_end/ui/splitWidget.css", "front_end/ui/SplitWidget.js", "front_end/ui/StackView.js", - "front_end/ui/SwatchPopoverHelper.js", - "front_end/ui/Toolbar.js", - "front_end/ui/Tooltip.js", + "front_end/ui/suggestBox.css", "front_end/ui/SuggestBox.js", + "front_end/ui/SwatchPopoverHelper.js", + "front_end/ui/tabbedPane.css", "front_end/ui/TabbedPane.js", + "front_end/ui/textButton.css", + "front_end/ui/TextEditor.js", + "front_end/ui/textPrompt.css", "front_end/ui/TextPrompt.js", "front_end/ui/ThrottledWidget.js", + "front_end/ui/toolbar.css", + "front_end/ui/Toolbar.js", + "front_end/ui/tooltip.css", + "front_end/ui/Tooltip.js", + "front_end/ui/treeoutline.css", + "front_end/ui/treeoutline.js", "front_end/ui/UIUtils.js", "front_end/ui/View.js", + "front_end/ui/viewContainers.css", "front_end/ui/ViewportControl.js", "front_end/ui/Widget.js", "front_end/ui/ZoomManager.js", - "front_end/ui/treeoutline.js", -] -devtools_main_js_files = [ - "front_end/main/errorWarningCounter.css", - "front_end/main/remoteDebuggingTerminatedScreen.css", - "front_end/main/renderingOptions.css", - "front_end/main/targetCrashedScreen.css", - "front_end/main/Main.js", - "front_end/main/OverlayController.js", - "front_end/main/RenderingOptions.js", - "front_end/main/SimpleApp.js", -] -devtools_module_json_files = [ - "front_end/accessibility/module.json", - "front_end/animation/module.json", - "front_end/audits/module.json", - "front_end/audits2/module.json", - "front_end/audits2_worker/module.json", - "front_end/bindings/module.json", - "front_end/cm_modes/module.json", - "front_end/common/module.json", - "front_end/components/module.json", - "front_end/components_lazy/module.json", - "front_end/console/module.json", - "front_end/css_tracker/module.json", - "front_end/devices/module.json", - "front_end/diff/module.json", - "front_end/elements/module.json", - "front_end/emulated_devices/module.json", - "front_end/emulation/module.json", - "front_end/extensions/module.json", - "front_end/gonzales/module.json", - "front_end/heap_snapshot_worker/module.json", - "front_end/host/module.json", - "front_end/layers/module.json", - "front_end/layer_viewer/module.json", - "front_end/main/module.json", - "front_end/network/module.json", - "front_end/platform/module.json", - "front_end/profiler/module.json", - "front_end/resources/module.json", - "front_end/sass/module.json", - "front_end/security/module.json", - "front_end/screencast/module.json", - "front_end/formatter_worker/module.json", - "front_end/sdk/module.json", - "front_end/settings/module.json", - "front_end/shell/module.json", - "front_end/source_frame/module.json", - "front_end/sources/module.json", - "front_end/snippets/module.json", + "front_end/unit_test_runner.js", + "front_end/unit_test_runner.json", + "front_end/utility_shared_worker.js", + "front_end/utility_shared_worker.json", "front_end/utility_shared_worker/module.json", - "front_end/test_runner/module.json", - "front_end/text_editor/module.json", - "front_end/timeline_model/module.json", - "front_end/timeline/module.json", - "front_end/toolbox_bootstrap/module.json", - "front_end/ui/module.json", - "front_end/ui_lazy/module.json", + "front_end/utility_shared_worker/TempStorage.js", + "front_end/worker_service/ServiceDispatcher.js", + "front_end/workspace/FileManager.js", + "front_end/workspace/FileSystemMapping.js", + "front_end/workspace/IsolatedFileSystem.js", + "front_end/workspace/IsolatedFileSystemManager.js", "front_end/workspace/module.json", + "front_end/workspace/SearchConfig.js", + "front_end/workspace/UISourceCode.js", + "front_end/workspace/Workspace.js", ] -# Lazy-loaded modules. -devtools_accessibility_js_files = [ - "front_end/accessibility/accessibilityNode.css", - "front_end/accessibility/AccessibilityModel.js", - "front_end/accessibility/AccessibilitySidebarView.js", - "front_end/accessibility/AccessibilityNodeView.js", - "front_end/accessibility/AccessibilityStrings.js", - "front_end/accessibility/ARIAAttributesView.js", - "front_end/accessibility/ARIAConfig.js", - "front_end/accessibility/ARIAMetadata.js", - "front_end/accessibility/AXTreePane.js", +devtools_embedder_scripts = [ + "front_end/devtools_compatibility.js", + "front_end/Tests.js", ] -devtools_animation_js_files = [ - "front_end/animation/animationScreenshotPopover.css", - "front_end/animation/animationTimeline.css", - "front_end/animation/AnimationGroupPreviewUI.js", - "front_end/animation/AnimationModel.js", - "front_end/animation/AnimationScreenshotPopover.js", - "front_end/animation/AnimationTimeline.js", - "front_end/animation/AnimationUI.js", -] -devtools_audits_js_files = [ - "front_end/audits/auditResultTree.css", - "front_end/audits/auditsPanel.css", - "front_end/audits/auditsSidebarTree.css", - "front_end/audits/AuditCategories.js", - "front_end/audits/AuditCategory.js", - "front_end/audits/AuditController.js", - "front_end/audits/AuditExtensionCategory.js", - "front_end/audits/AuditFormatters.js", - "front_end/audits/AuditLauncherView.js", - "front_end/audits/AuditResultView.js", - "front_end/audits/AuditRules.js", - "front_end/audits/AuditsPanel.js", -] -devtools_audits2_js_files = [ "front_end/audits2/Audits2Panel.js" ] -devtools_audits2_worker_js_files = [ - "front_end/audits2_worker/Audits2Service.js", - "front_end/audits2_worker/lighthouse/lighthouse-background.js", -] -devtools_cm_modes_js_files = [ - "front_end/cm_modes/clike.js", - "front_end/cm_modes/coffeescript.js", - "front_end/cm_modes/php.js", - "front_end/cm_modes/python.js", - "front_end/cm_modes/shell.js", - "front_end/cm_modes/livescript.js", - "front_end/cm_modes/clojure.js", - "front_end/cm_modes/DefaultCodeMirrorMimeMode.js", -] -devtools_components_lazy_js_files = [ - "front_end/components_lazy/filmStripDialog.css", - "front_end/components_lazy/filmStripView.css", - "front_end/components_lazy/CookiesTable.js", - "front_end/components_lazy/FilmStripModel.js", - "front_end/components_lazy/FilmStripView.js", - "front_end/components_lazy/GCActionDelegate.js", - "front_end/components_lazy/LineLevelProfile.js", -] -devtools_console_js_files = [ - "front_end/console/consoleView.css", - "front_end/console/ConsoleContextSelector.js", - "front_end/console/ConsolePanel.js", - "front_end/console/ConsolePrompt.js", - "front_end/console/ConsoleView.js", - "front_end/console/ConsoleViewMessage.js", - "front_end/console/ConsoleViewport.js", -] -devtools_css_tracker_js_files = [ - "front_end/css_tracker/cssTrackerView.css", - "front_end/css_tracker/unusedRulesTree.css", - "front_end/css_tracker/CSSTrackerView.js", -] -devtools_devices_js_files = [ - "front_end/devices/devicesView.css", - "front_end/devices/DevicesView.js", -] -devtools_diff_js_files = [ - "front_end/diff/Diff.js", - "front_end/diff/diff_match_patch.js", -] -devtools_elements_js_files = [ - "front_end/elements/breadcrumbs.css", - "front_end/elements/computedStyleSidebarPane.css", - "front_end/elements/elementsPanel.css", - "front_end/elements/elementsTreeOutline.css", - "front_end/elements/platformFontsWidget.css", - "front_end/elements/stylesSectionTree.css", - "front_end/elements/ClassesPaneWidget.js", - "front_end/elements/ColorSwatchPopoverIcon.js", - "front_end/elements/ComputedStyleModel.js", - "front_end/elements/ElementsBreadcrumbs.js", - "front_end/elements/ElementsPanel.js", - "front_end/elements/ElementsSidebarPane.js", - "front_end/elements/ElementsTreeElement.js", - "front_end/elements/ElementsTreeElementHighlighter.js", - "front_end/elements/ElementsTreeOutline.js", - "front_end/elements/ElementStatePaneWidget.js", - "front_end/elements/EventListenersWidget.js", - "front_end/elements/InspectElementModeController.js", - "front_end/elements/MetricsSidebarPane.js", - "front_end/elements/PlatformFontsWidget.js", - "front_end/elements/PropertiesWidget.js", - "front_end/elements/StylePropertyHighlighter.js", - "front_end/elements/StylesSidebarPane.js", - "front_end/elements/ComputedStyleWidget.js", -] -devtools_emulated_devices_js_files = [] + devtools_emulated_devices_images = [ "front_end/emulated_devices/google-nexus-5-horizontal-default-1x.png", "front_end/emulated_devices/google-nexus-5-horizontal-default-2x.png", @@ -496,315 +708,6 @@ "front_end/emulated_devices/Nexus6P-landscape.svg", "front_end/emulated_devices/Nexus6P-portrait.svg", ] -devtools_extension_api_files = [ "front_end/extensions/ExtensionAPI.js" ] -devtools_extensions_js_files = - [ - "front_end/extensions/ExtensionAuditCategory.js", - "front_end/extensions/ExtensionPanel.js", - "front_end/extensions/ExtensionRegistryStub.js", - "front_end/extensions/ExtensionServer.js", - "front_end/extensions/ExtensionView.js", - ] + devtools_extension_api_files -devtools_gonzales_js_files = [ - "front_end/gonzales/gonzales-scss.js", - "front_end/gonzales/SCSSParser.js", -] -devtools_heap_snapshot_worker_js_files = [ - "front_end/common/TextUtils.js", - "front_end/common/UIString.js", - "front_end/heap_snapshot_worker/AllocationProfile.js", - "front_end/heap_snapshot_worker/HeapSnapshot.js", - "front_end/heap_snapshot_worker/HeapSnapshotLoader.js", - "front_end/heap_snapshot_worker/HeapSnapshotWorker.js", - "front_end/heap_snapshot_worker/HeapSnapshotWorkerDispatcher.js", - "front_end/platform/utilities.js", - "front_end/profiler/HeapSnapshotCommon.js", -] -devtools_layers_js_files = [ - "front_end/layers/LayerPaintProfilerView.js", - "front_end/layers/LayerTreeModel.js", - "front_end/layers/LayersPanel.js", -] -devtools_network_js_files = [ - "front_end/network/blockedURLsPane.css", - "front_end/network/eventSourceMessagesView.css", - "front_end/network/networkConfigView.css", - "front_end/network/networkLogView.css", - "front_end/network/networkManageCustomHeadersView.css", - "front_end/network/networkPanel.css", - "front_end/network/requestCookiesView.css", - "front_end/network/requestHeadersTree.css", - "front_end/network/requestHeadersView.css", - "front_end/network/webSocketFrameView.css", - "front_end/network/xmlTree.css", - "front_end/network/xmlView.css", - "front_end/network/BlockedURLsPane.js", - "front_end/network/EventSourceMessagesView.js", - "front_end/network/FilterSuggestionBuilder.js", - "front_end/network/HARWriter.js", - "front_end/network/JSONView.js", - "front_end/network/NetworkConfigView.js", - "front_end/network/NetworkDataGridNode.js", - "front_end/network/NetworkItemView.js", - "front_end/network/NetworkLogView.js", - "front_end/network/NetworkLogViewColumns.js", - "front_end/network/NetworkManageCustomHeadersView.js", - "front_end/network/NetworkOverview.js", - "front_end/network/NetworkPanel.js", - "front_end/network/NetworkTimeCalculator.js", - "front_end/network/NetworkWaterfallColumn.js", - "front_end/network/RequestCookiesView.js", - "front_end/network/RequestHeadersView.js", - "front_end/network/RequestHTMLView.js", - "front_end/network/RequestPreviewView.js", - "front_end/network/RequestResponseView.js", - "front_end/network/RequestTimingView.js", - "front_end/network/RequestView.js", - "front_end/network/ResourceWebSocketFrameView.js", - "front_end/network/XMLView.js", -] -devtools_profiler_js_files = [ - "front_end/profiler/heapProfiler.css", - "front_end/profiler/profilesPanel.css", - "front_end/profiler/profilesSidebarTree.css", - "front_end/profiler/BottomUpProfileDataGrid.js", - "front_end/profiler/CPUProfileFlameChart.js", - "front_end/profiler/CPUProfileView.js", - "front_end/profiler/HeapProfileView.js", - "front_end/profiler/HeapSnapshotCommon.js", - "front_end/profiler/HeapSnapshotDataGrids.js", - "front_end/profiler/HeapSnapshotGridNodes.js", - "front_end/profiler/HeapSnapshotProxy.js", - "front_end/profiler/HeapSnapshotView.js", - "front_end/profiler/ProfileDataGrid.js", - "front_end/profiler/ProfileLauncherView.js", - "front_end/profiler/ProfilesPanel.js", - "front_end/profiler/ProfileTypeRegistry.js", - "front_end/profiler/ProfileView.js", - "front_end/profiler/TargetsComboBoxController.js", - "front_end/profiler/TopDownProfileDataGrid.js", -] -devtools_resources_js_files = [ - "front_end/resources/appManifestView.css", - "front_end/resources/clearStorageView.css", - "front_end/resources/indexedDBViews.css", - "front_end/resources/resourcesPanel.css", - "front_end/resources/resourcesSidebar.css", - "front_end/resources/serviceWorkerCacheViews.css", - "front_end/resources/serviceWorkersView.css", - "front_end/resources/AppManifestView.js", - "front_end/resources/ApplicationCacheItemsView.js", - "front_end/resources/ClearStorageView.js", - "front_end/resources/CookieItemsView.js", - "front_end/resources/DatabaseModel.js", - "front_end/resources/DatabaseQueryView.js", - "front_end/resources/DatabaseTableView.js", - "front_end/resources/DOMStorageModel.js", - "front_end/resources/DOMStorageItemsView.js", - "front_end/resources/IndexedDBViews.js", - "front_end/resources/IndexedDBModel.js", - "front_end/resources/ResourcesPanel.js", - "front_end/resources/ServiceWorkerCacheViews.js", - "front_end/resources/ServiceWorkersView.js", -] -devtools_security_js_files = [ - "front_end/security/lockIcon.css", - "front_end/security/mainView.css", - "front_end/security/originView.css", - "front_end/security/sidebar.css", - "front_end/security/SecurityModel.js", - "front_end/security/SecurityPanel.js", -] -devtools_formatter_worker_js_files = [ - "front_end/cm/css.js", - "front_end/cm/headlesscodemirror.js", - "front_end/cm/xml.js", - "front_end/platform/utilities.js", - "front_end/formatter_worker/AcornTokenizer.js", - "front_end/formatter_worker/CSSFormatter.js", - "front_end/formatter_worker/ESTreeWalker.js", - "front_end/formatter_worker/FormattedContentBuilder.js", - "front_end/formatter_worker/JavaScriptFormatter.js", - "front_end/formatter_worker/CSSRuleParser.js", - "front_end/formatter_worker/HTMLFormatter.js", - "front_end/formatter_worker/IdentityFormatter.js", - "front_end/formatter_worker/JavaScriptOutline.js", - "front_end/formatter_worker/FormatterWorker.js", - "front_end/formatter_worker/RelaxedJSONParser.js", - "front_end/formatter_worker/acorn/acorn.js", -] -devtools_services_js_files = [ "front_end/services/ServiceManager.js" ] -devtools_settings_js_files = [ - "front_end/settings/editFileSystemView.css", - "front_end/settings/frameworkBlackboxSettingsTab.css", - "front_end/settings/settingsScreen.css", - "front_end/settings/EditFileSystemView.js", - "front_end/settings/FrameworkBlackboxSettingsTab.js", - "front_end/settings/SettingsScreen.js", -] -devtools_source_frame_js_files = [ - "front_end/source_frame/fontView.css", - "front_end/source_frame/imageView.css", - "front_end/source_frame/SourcesTextEditor.js", - "front_end/source_frame/FontView.js", - "front_end/source_frame/ImageView.js", - "front_end/source_frame/ResourceSourceFrame.js", - "front_end/source_frame/SourceFrame.js", -] -devtools_sources_js_files = [ - "front_end/sources/eventListenerBreakpoints.css", - "front_end/sources/fileBasedSearchResultsPane.css", - "front_end/sources/navigatorTree.css", - "front_end/sources/navigatorView.css", - "front_end/sources/revisionHistory.css", - "front_end/sources/serviceWorkersSidebar.css", - "front_end/sources/sourcesPanel.css", - "front_end/sources/sourcesSearch.css", - "front_end/sources/sourcesView.css", - "front_end/sources/uiList.css", - "front_end/sources/AddSourceMapURLDialog.js", - "front_end/sources/AdvancedSearchView.js", - "front_end/sources/CallStackSidebarPane.js", - "front_end/sources/CSSSourceFrame.js", - "front_end/sources/EditingLocationHistoryManager.js", - "front_end/sources/EventListenerBreakpointsSidebarPane.js", - "front_end/sources/FileBasedSearchResultsPane.js", - "front_end/sources/FilePathScoreFunction.js", - "front_end/sources/FilteredUISourceCodeListDelegate.js", - "front_end/sources/InplaceFormatterEditorAction.js", - "front_end/sources/JavaScriptBreakpointsSidebarPane.js", - "front_end/sources/JavaScriptCompiler.js", - "front_end/sources/JavaScriptOutlineDialog.js", - "front_end/sources/JavaScriptSourceFrame.js", - "front_end/sources/NavigatorView.js", - "front_end/sources/ObjectEventListenersSidebarPane.js", - "front_end/sources/OpenResourceDialog.js", - "front_end/sources/RevisionHistoryView.js", - "front_end/sources/ScopeChainSidebarPane.js", - "front_end/sources/ScriptFormatter.js", - "front_end/sources/ScriptFormatterEditorAction.js", - "front_end/sources/SimpleHistoryManager.js", - "front_end/sources/SourceCodeDiff.js", - "front_end/sources/SourceMapNamesResolver.js", - "front_end/sources/SourcesNavigator.js", - "front_end/sources/SourcesPanel.js", - "front_end/sources/SourcesSearchScope.js", - "front_end/sources/SourcesView.js", - "front_end/sources/StyleSheetOutlineDialog.js", - "front_end/sources/TabbedEditorContainer.js", - "front_end/sources/ThreadsSidebarPane.js", - "front_end/sources/UIList.js", - "front_end/sources/UISourceCodeFrame.js", - "front_end/sources/WatchExpressionsSidebarPane.js", - "front_end/sources/WorkspaceMappingTip.js", - "front_end/sources/XHRBreakpointsSidebarPane.js", -] -devtools_snippets_js_files = [ - "front_end/snippets/ScriptSnippetModel.js", - "front_end/snippets/SnippetStorage.js", -] -devtools_utility_shared_worker_js_files = - [ "front_end/utility_shared_worker/TempStorage.js" ] -devtools_text_editor_js_files = [ - "front_end/text_editor/cmdevtools.css", - "front_end/text_editor/CodeMirrorTextEditor.js", - "front_end/text_editor/CodeMirrorUtils.js", - "front_end/text_editor/TextEditorAutocompleteController.js", -] -devtools_terminal_js_files = [ - "front_end/terminal/terminal.css", - "front_end/terminal/TerminalWidget.js", - "front_end/terminal/xterm.js/addons/fit/fit.js", - "front_end/terminal/xterm.js/build/xterm.css", - "front_end/terminal/xterm.js/build/xterm.js", -] -devtools_shell_js_files = [ "front_end/shell/TestShell.js" ] -devtools_test_runner_js_files = [ "front_end/test_runner/TestRunner.js" ] -devtools_timeline_model_js_files = [ - "front_end/timeline_model/TracingLayerTree.js", - "front_end/timeline_model/TimelineFrameModel.js", - "front_end/timeline_model/TimelineIRModel.js", - "front_end/timeline_model/TimelineJSProfile.js", - "front_end/timeline_model/TimelineModel.js", - "front_end/timeline_model/TimelineProfileTree.js", -] -devtools_layer_viewer_js_files = [ - "front_end/layer_viewer/LayerDetailsView.js", - "front_end/layer_viewer/LayerTreeOutline.js", - "front_end/layer_viewer/LayerViewHost.js", - "front_end/layer_viewer/Layers3DView.js", - "front_end/layer_viewer/PaintProfilerView.js", - "front_end/layer_viewer/TransformController.js", - "front_end/layer_viewer/layerDetailsView.css", - "front_end/layer_viewer/layers3DView.css", - "front_end/layer_viewer/paintProfiler.css", -] -devtools_timeline_js_files = [ - "front_end/timeline/invalidationsTree.css", - "front_end/timeline/timelineFlamechartPopover.css", - "front_end/timeline/timelineLandingPage.css", - "front_end/timeline/timelinePaintProfiler.css", - "front_end/timeline/timelinePanel.css", - "front_end/timeline/timelineStatusDialog.css", - "front_end/timeline/CountersGraph.js", - "front_end/timeline/MemoryCountersGraph.js", - "front_end/timeline/TimelineController.js", - "front_end/timeline/TimelineEventOverview.js", - "front_end/timeline/TimelineFlameChart.js", - "front_end/timeline/TimelineFlameChartView.js", - "front_end/timeline/TimelineNetworkFlameChart.js", - "front_end/timeline/TimelineLandingPage.js", - "front_end/timeline/TimelineLayersView.js", - "front_end/timeline/TimelineLoader.js", - "front_end/timeline/TimelinePaintProfilerView.js", - "front_end/timeline/TimelinePanel.js", - "front_end/timeline/TimelineTreeView.js", - "front_end/timeline/TimelineUIUtils.js", -] -devtools_ui_lazy_js_files = [ - "front_end/ui_lazy/dataGrid.css", - "front_end/ui_lazy/dialog.css", - "front_end/ui_lazy/filteredListWidget.css", - "front_end/ui_lazy/flameChart.css", - "front_end/ui_lazy/overviewGrid.css", - "front_end/ui_lazy/pieChart.css", - "front_end/ui_lazy/timelineGrid.css", - "front_end/ui_lazy/ChartViewport.js", - "front_end/ui_lazy/CommandMenu.js", - "front_end/ui_lazy/DataGrid.js", - "front_end/ui_lazy/FilteredListWidget.js", - "front_end/ui_lazy/FlameChart.js", - "front_end/ui_lazy/OverviewGrid.js", - "front_end/ui_lazy/PieChart.js", - "front_end/ui_lazy/ShowMoreDataGridNode.js", - "front_end/ui_lazy/SortableDataGrid.js", - "front_end/ui_lazy/TimelineGrid.js", - "front_end/ui_lazy/TimelineOverviewPane.js", - "front_end/ui_lazy/ViewportDataGrid.js", -] -devtools_worker_service_js_files = - [ "front_end/worker_service/ServiceDispatcher.js" ] - -# Third-party code. -devtools_cm_css_files = [ "front_end/cm/codemirror.css" ] -devtools_cm_js_files = [ - "front_end/cm/activeline.js", - "front_end/cm/closebrackets.js", - "front_end/cm/codemirror.js", - "front_end/cm/comment.js", - "front_end/cm/css.js", - "front_end/cm/headlesscodemirror.js", - "front_end/cm/htmlembedded.js", - "front_end/cm/htmlmixed.js", - "front_end/cm/javascript.js", - "front_end/cm/markselection.js", - "front_end/cm/matchbrackets.js", - "front_end/cm/multiplex.js", - "front_end/cm/overlay.js", - "front_end/cm/simple.js", - "front_end/cm/xml.js", -] -devtools_acorn_files = [ "front_end/formatter_worker/acorn/acorn.js" ] devtools_image_files = [ "front_end/Images/accelerometer-back.png", @@ -878,41 +781,6 @@ "front_end/Images/touchCursor_2x.png", ] -devtools_core_files = - devtools_core_base_files + devtools_bindings_js_files + - devtools_common_js_files + devtools_components_js_files + - devtools_emulation_js_files + devtools_host_js_files + - devtools_main_js_files + devtools_platform_js_files + - devtools_sdk_js_files + devtools_toolbox_bootstrap_js_files + - devtools_ui_js_files + devtools_workspace_js_files + - devtools_persistence_js_files - -devtools_modules_js_files = - devtools_accessibility_js_files + devtools_audits_js_files + - devtools_audits2_js_files + devtools_audits2_worker_js_files + - devtools_animation_js_files + devtools_cm_modes_js_files + - devtools_components_lazy_js_files + devtools_console_js_files + - devtools_devices_js_files + devtools_diff_js_files + - devtools_elements_js_files + devtools_emulated_devices_js_files + - devtools_extensions_js_files + devtools_gonzales_js_files + - devtools_heap_snapshot_worker_js_files + devtools_layers_js_files + - devtools_network_js_files + devtools_profiler_js_files + - devtools_resources_js_files + devtools_sass_js_files + - devtools_security_js_files + devtools_screencast_js_files + - devtools_formatter_worker_js_files + devtools_settings_js_files + - devtools_services_js_files + devtools_shell_js_files + - devtools_snippets_js_files + devtools_source_frame_js_files + - devtools_sources_js_files + devtools_utility_shared_worker_js_files + - devtools_text_editor_js_files + devtools_test_runner_js_files + - devtools_terminal_js_files + devtools_timeline_model_js_files + - devtools_timeline_js_files + devtools_ui_lazy_js_files + - devtools_layer_viewer_js_files + devtools_worker_service_js_files + - devtools_css_tracker_js_files - -all_devtools_files = devtools_cm_css_files + devtools_cm_js_files + - devtools_core_files + devtools_module_json_files + - devtools_modules_js_files + devtools_acorn_files - resources_out_dir = "$root_out_dir/resources/inspector" generated_scripts = [ @@ -920,20 +788,16 @@ "$resources_out_dir/SupportedCSSProperties.js", ] -generated_entry_files = [ +generated_resources = [ "$resources_out_dir/inspector.html", "$resources_out_dir/inspector.js", "$resources_out_dir/toolbox.html", "$resources_out_dir/toolbox.js", -] - -generated_workers = [ "$resources_out_dir/formatter_worker.js", "$resources_out_dir/heap_snapshot_worker.js", "$resources_out_dir/utility_shared_worker.js", -] -generated_bundled_modules = [ + # this contains non-autostart non-remote modules only. "$resources_out_dir/animation/animation_module.js", "$resources_out_dir/audits/audits_module.js", "$resources_out_dir/audits2/audits2_module.js", @@ -943,8 +807,8 @@ "$resources_out_dir/devices/devices_module.js", "$resources_out_dir/diff/diff_module.js", "$resources_out_dir/elements/elements_module.js", - "$resources_out_dir/layers/layers_module.js", "$resources_out_dir/layer_viewer/layer_viewer_module.js", + "$resources_out_dir/layers/layers_module.js", "$resources_out_dir/network/network_module.js", "$resources_out_dir/profiler/profiler_module.js", "$resources_out_dir/resources/resources_module.js", @@ -1028,8 +892,7 @@ inputs += devtools_embedder_scripts generated_files = - generated_entry_files + generated_workers + generated_bundled_modules + - [ "$resources_out_dir/devtools_extension_api.js" ] + generated_resources + [ "$resources_out_dir/devtools_extension_api.js" ] images_path = "front_end/Images" @@ -1061,6 +924,7 @@ action("devtools_extension_api") { script = "scripts/build/generate_devtools_extension_api.py" + devtools_extension_api_files = [ "front_end/extensions/ExtensionAPI.js" ] inputs = devtools_extension_api_files outputs = [ "$resources_out_dir/devtools_extension_api.js", @@ -1122,8 +986,7 @@ "front_end/unit_test_runner.html", ] - outputs = generated_entry_files + generated_workers + - generated_bundled_modules + generated_remote_modules + outputs = generated_resources + generated_remote_modules args = devtools_applications + [ "--input_path",
diff --git a/third_party/WebKit/Source/devtools/front_end/profiler/CPUProfileFlameChart.js b/third_party/WebKit/Source/devtools/front_end/profiler/CPUProfileFlameChart.js index 7577cb7..60e19a7 100644 --- a/third_party/WebKit/Source/devtools/front_end/profiler/CPUProfileFlameChart.js +++ b/third_party/WebKit/Source/devtools/front_end/profiler/CPUProfileFlameChart.js
@@ -58,30 +58,6 @@ * @override * @return {number} */ - barHeight() { - return 15; - } - - /** - * @override - * @return {number} - */ - textBaseline() { - return 4; - } - - /** - * @override - * @return {number} - */ - textPadding() { - return 2; - } - - /** - * @override - * @return {number} - */ minimumBoundary() { return this._cpuProfile.profileStartTime; } @@ -162,10 +138,10 @@ */ entryFont(entryIndex) { if (!this._font) { - this._font = (this.barHeight() - 4) + 'px ' + Host.fontFamily(); + this._font = '11px ' + Host.fontFamily(); this._boldFont = 'bold ' + this._font; } - var node = this._entryNodes[entryIndex]; + const node = this._entryNodes[entryIndex]; return node.deoptReason ? this._boldFont : this._font; } @@ -207,14 +183,6 @@ /** * @override - * @return {number} - */ - paddingLeft() { - return 0; - } - - /** - * @override * @param {number} entryIndex * @return {string} */ @@ -242,6 +210,9 @@ this._overviewPane.show(this.element); this._mainPane = new UI.FlameChart(dataProvider, this._overviewPane); + this._mainPane.setBarHeight(15); + this._mainPane.setTextBaseline(4); + this._mainPane.setTextPadding(2); this._mainPane.show(this.element); this._mainPane.addEventListener(UI.FlameChart.Events.EntrySelected, this._onEntrySelected, this); this._overviewPane.addEventListener(UI.OverviewGrid.Events.WindowChanged, this._onWindowChanged, this); @@ -524,7 +495,7 @@ if (!timelineData) return; this._resetCanvas( - this._overviewContainer.clientWidth, this._overviewContainer.clientHeight - UI.FlameChart.DividersBarHeight); + this._overviewContainer.clientWidth, this._overviewContainer.clientHeight - UI.FlameChart.HeaderHeight); this._overviewCalculator._updateBoundaries(this); this._overviewGrid.updateDividers(this._overviewCalculator); this._drawOverviewCanvas();
diff --git a/third_party/WebKit/Source/devtools/front_end/timeline/TimelineController.js b/third_party/WebKit/Source/devtools/front_end/timeline/TimelineController.js index 80358bb..d6769e7 100644 --- a/third_party/WebKit/Source/devtools/front_end/timeline/TimelineController.js +++ b/third_party/WebKit/Source/devtools/front_end/timeline/TimelineController.js
@@ -24,7 +24,7 @@ } /** - * @param {!Timeline.TimelineController.CaptureOptions} options + * @param {!Timeline.TimelineController.RecordingOptions} options * @param {!Array<!Extensions.ExtensionTraceProvider>} providers */ startRecording(options, providers) { @@ -278,10 +278,11 @@ } }; -/** @typedef {!{ - * enableJSSampling: (boolean|undefined), - * capturePictures: (boolean|undefined), - * captureFilmStrip: (boolean|undefined) - * }} +/** + * @typedef {!{ + * enableJSSampling: (boolean|undefined), + * capturePictures: (boolean|undefined), + * captureFilmStrip: (boolean|undefined) + * }} */ -Timeline.TimelineController.CaptureOptions; +Timeline.TimelineController.RecordingOptions;
diff --git a/third_party/WebKit/Source/devtools/front_end/timeline/TimelineFlameChart.js b/third_party/WebKit/Source/devtools/front_end/timeline/TimelineFlameChart.js index 69637e6..2f92428 100644 --- a/third_party/WebKit/Source/devtools/front_end/timeline/TimelineFlameChart.js +++ b/third_party/WebKit/Source/devtools/front_end/timeline/TimelineFlameChart.js
@@ -29,9 +29,10 @@ */ /** + * @implements {UI.FlameChartDataProvider} * @unrestricted */ -Timeline.TimelineFlameChartDataProvider = class extends Timeline.TimelineFlameChartDataProviderBase { +Timeline.TimelineFlameChartDataProvider = class { /** * @param {!TimelineModel.TimelineModel} model * @param {!TimelineModel.TimelineFrameModel} frameModel @@ -39,7 +40,8 @@ * @param {!Array<!TimelineModel.TimelineModel.Filter>} filters */ constructor(model, frameModel, irModel, filters) { - super(); + this.reset(); + this._font = '11px ' + Host.fontFamily(); this._model = model; this._filters = filters; /** @type {?UI.FlameChart.TimelineData} */ @@ -51,7 +53,6 @@ new UI.FlameChart.ColorGenerator({min: 30, max: 55}, {min: 70, max: 100, count: 6}, 50, 0.7); this._extensionColorGenerator = new UI.FlameChart.ColorGenerator({min: 210, max: 300}, {min: 70, max: 100, count: 6}, 70, 0.7); - const font = this.font(); const defaultGroupStyle = { padding: 4, @@ -59,34 +60,21 @@ collapsible: true, color: UI.themeSupport.patchColor('#222', UI.ThemeSupport.ColorUsage.Foreground), backgroundColor: UI.themeSupport.patchColor('white', UI.ThemeSupport.ColorUsage.Background), - font: font, + font: this._font, nestingLevel: 0, shareHeaderLine: true }; this._headerLevel1 = /** @type {!UI.FlameChart.GroupStyle} */ - (Object.assign({}, defaultGroupStyle, { - shareHeaderLine: false - })); + (Object.assign({}, defaultGroupStyle, {shareHeaderLine: false})); this._headerLevel2 = /** @type {!UI.FlameChart.GroupStyle} */ - (Object.assign({}, defaultGroupStyle, { - padding: 2, - nestingLevel: 1, - collapsible: false - })); + (Object.assign({}, defaultGroupStyle, {padding: 2, nestingLevel: 1, collapsible: false})); this._staticHeader = /** @type {!UI.FlameChart.GroupStyle} */ - (Object.assign({}, defaultGroupStyle, { - collapsible: false - })); + (Object.assign({}, defaultGroupStyle, {collapsible: false})); this._interactionsHeaderLevel1 = /** @type {!UI.FlameChart.GroupStyle} */ - (Object.assign({ - useFirstLineForOverview: true - }, defaultGroupStyle)); + (Object.assign({useFirstLineForOverview: true}, defaultGroupStyle)); this._interactionsHeaderLevel2 = /** @type {!UI.FlameChart.GroupStyle} */ - (Object.assign({}, defaultGroupStyle, { - padding: 2, - nestingLevel: 1 - })); + (Object.assign({}, defaultGroupStyle, {padding: 2, nestingLevel: 1})); } /** @@ -128,17 +116,20 @@ */ textColor(index) { var event = this._entryData[index]; - if (event && event._blackboxRoot) - return '#888'; - else - return super.textColor(index); + return event && event._blackboxRoot ? '#888' : Timeline.FlameChartStyle.textColor; } /** * @override + * @param {number} index + * @return {?string} */ + entryFont(index) { + return this._font; + } + reset() { - super.reset(); + this._currentLevel = 0; this._timelineData = null; /** @type {!Array<!SDK.TracingModel.Event|!TimelineModel.TimelineFrame|!TimelineModel.TimelineIRModel.Phases>} */ this._entryData = []; @@ -158,6 +149,14 @@ /** * @override + * @return {number} + */ + maxStackDepth() { + return this._currentLevel; + } + + /** + * @override * @return {!UI.FlameChart.TimelineData} */ timelineData() { @@ -236,6 +235,22 @@ } /** + * @override + * @return {number} + */ + minimumBoundary() { + return this._minimumBoundary; + } + + /** + * @override + * @return {number} + */ + totalTime() { + return this._timeSpan; + } + + /** * @param {number} level * @param {!TimelineModel.TimelineModel.PageFrame} frame */ @@ -701,7 +716,6 @@ } /** - * @override * @param {number} entryIndex * @return {?Timeline.TimelineSelection} */ @@ -721,6 +735,25 @@ } /** + * @override + * @param {number} value + * @param {number=} precision + * @return {string} + */ + formatValue(value, precision) { + return Number.preciseMillisToString(value, precision); + } + + /** + * @override + * @param {number} entryIndex + * @return {boolean} + */ + canJumpToEntry(entryIndex) { + return false; + } + + /** * @param {?Timeline.TimelineSelection} selection * @return {number} */
diff --git a/third_party/WebKit/Source/devtools/front_end/timeline/TimelineFlameChartView.js b/third_party/WebKit/Source/devtools/front_end/timeline/TimelineFlameChartView.js index 66c7252..0b4d4d7 100644 --- a/third_party/WebKit/Source/devtools/front_end/timeline/TimelineFlameChartView.js +++ b/third_party/WebKit/Source/devtools/front_end/timeline/TimelineFlameChartView.js
@@ -2,187 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -/** - * @implements {UI.FlameChartDataProvider} - * @unrestricted - */ -Timeline.TimelineFlameChartDataProviderBase = class { - constructor() { - UI.FlameChartDataProvider.call(this); - this.reset(); - this._font = '11px ' + Host.fontFamily(); - } - - /** @return {string} */ - font() { - return this._font; - } - - /** - * @override - * @return {number} - */ - barHeight() { - return 17; - } - - /** - * @override - * @return {number} - */ - textBaseline() { - return 5; - } - - /** - * @override - * @return {number} - */ - textPadding() { - return 4; - } - - /** - * @override - * @param {number} entryIndex - * @return {string} - */ - entryFont(entryIndex) { - return this._font; - } - - /** - * @override - * @param {number} entryIndex - * @return {?string} - */ - entryTitle(entryIndex) { - return null; - } - - reset() { - this._timelineData = null; - } - - /** - * @override - * @return {number} - */ - minimumBoundary() { - return this._minimumBoundary; - } - - /** - * @override - * @return {number} - */ - totalTime() { - return this._timeSpan; - } - - /** - * @override - * @param {number} value - * @param {number=} precision - * @return {string} - */ - formatValue(value, precision) { - return Number.preciseMillisToString(value, precision); - } - - /** - * @override - * @return {number} - */ - maxStackDepth() { - return this._currentLevel; - } - - /** - * @override - * @param {number} entryIndex - * @return {?Element} - */ - prepareHighlightedEntryInfo(entryIndex) { - return null; - } - - /** - * @override - * @param {number} entryIndex - * @return {boolean} - */ - canJumpToEntry(entryIndex) { - return false; - } - - /** - * @override - * @param {number} entryIndex - * @return {string} - */ - entryColor(entryIndex) { - return 'red'; - } - - /** - * @override - * @param {number} index - * @return {boolean} - */ - forceDecoration(index) { - return false; - } - - /** - * @override - * @param {number} entryIndex - * @param {!CanvasRenderingContext2D} context - * @param {?string} text - * @param {number} barX - * @param {number} barY - * @param {number} barWidth - * @param {number} barHeight - * @param {number} unclippedBarX - * @param {number} timeToPixels - * @return {boolean} - */ - decorateEntry(entryIndex, context, text, barX, barY, barWidth, barHeight, unclippedBarX, timeToPixels) { - return false; - } - - /** - * @override - * @return {number} - */ - paddingLeft() { - return 0; - } - - /** - * @override - * @param {number} entryIndex - * @return {string} - */ - textColor(entryIndex) { - return '#333'; - } - - /** - * @param {number} entryIndex - * @return {?Timeline.TimelineSelection} - */ - createSelection(entryIndex) { - return null; - } - - /** - * @override - * @return {!UI.FlameChart.TimelineData} - */ - timelineData() { - throw new Error('Not implemented'); - } +Timeline.FlameChartStyle = { + textColor: '#333' }; /** @@ -299,6 +120,7 @@ var mainViewGroupExpansionSetting = Common.settings.createSetting('timelineFlamechartMainViewGroupExpansion', {}); this._mainView = new UI.FlameChart(this._dataProvider, this, mainViewGroupExpansionSetting); this._mainView.alwaysShowVerticalScroll(); + this._mainView.enableRuler(false); var networkViewGroupExpansionSetting = Common.settings.createSetting('timelineFlamechartNetworkViewGroupExpansion', {});
diff --git a/third_party/WebKit/Source/devtools/front_end/timeline/TimelineLandingPage.js b/third_party/WebKit/Source/devtools/front_end/timeline/TimelineLandingPage.js index 1187d0da..7bb3c02 100644 --- a/third_party/WebKit/Source/devtools/front_end/timeline/TimelineLandingPage.js +++ b/third_party/WebKit/Source/devtools/front_end/timeline/TimelineLandingPage.js
@@ -22,7 +22,9 @@ tab.appendDescription(createElement('p')); tab.appendDescription(Common.UIString( 'The basic profile collects network, JavaScript and browser activity as you interact with the page.')); - tab.appendOption(config.screenshots, true); + tab.appendOption(config.screenshots); + tab.appendOption(config.javascript, true); + tab.appendOption(config.paints, false); this._tabbedPane.appendTab(Timeline.TimelineLandingPage.PageId.Basic, Common.UIString('Basic'), tab); tab = new Timeline.TimelineLandingPage.PerspectiveTabWidget(); @@ -30,9 +32,9 @@ 'Select what additional details you’d like to record. ' + 'By default, the advanced profile will collect all data of the basic profile.\u2002')); tab.appendDescription(learnMore()); - tab.appendOption(config.screenshots, true); - tab.appendOption(config.javascript, true); - tab.appendOption(config.paints, false); + tab.appendOption(config.screenshots); + tab.appendOption(config.javascript); + tab.appendOption(config.paints); this._tabbedPane.appendTab(Timeline.TimelineLandingPage.PageId.Advanced, Common.UIString('Advanced'), tab); this._tabbedPane.addEventListener(UI.TabbedPane.Events.TabSelected, this._tabSelected, this); @@ -49,14 +51,29 @@ } } - _tabSelected() { + /** + * @return {!Timeline.TimelineController.RecordingOptions} + */ + recordingOptions() { const tabWidget = /** @type {!Timeline.TimelineLandingPage.PerspectiveTabWidget} */ (this._tabbedPane.visibleView); + return tabWidget.recordingOptions(); + } + + _tabSelected() { this._currentTabSetting.set(this._tabbedPane.selectedTabId); - tabWidget.activate(); } }; -/** @typedef {!{id: string, title: string, description: string, setting: string}} */ +/** + * @typedef {!{ + * id: string, + * title: string, + * description: string, + * settingName: string, + * captureOptionName: string, + * value: boolean + * }} + */ Timeline.TimelineLandingPage.RecordingOption; /** @type {!Object<string, !Timeline.TimelineLandingPage.RecordingOption>} */ @@ -65,21 +82,27 @@ id: 'javascript', title: Common.UIString('JavaScript'), description: Common.UIString('Use sampling CPU profiler to collect JavaScript stacks.'), - setting: 'timelineEnableJSSampling' + settingName: 'timelineEnableJSSampling', + captureOptionName: 'enableJSSampling', + value: true }, screenshots: { id: 'screenshots', title: Common.UIString('Screenshots'), description: Common.UIString( 'Collect page screenshots, so you can observe how the page was evolving during recording (moderate performance overhead).'), - setting: 'timelineCaptureFilmStrip' + settingName: 'timelineCaptureFilmStrip', + captureOptionName: 'captureFilmStrip', + value: true }, paints: { id: 'paints', title: Common.UIString('Paints'), description: Common.UIString( 'Capture graphics layer positions and rasterization draw calls (significant performance overhead).'), - setting: 'timelineCaptureLayersAndPictures' + settingName: 'timelineCaptureLayersAndPictures', + captureOptionName: 'capturePictures', + value: false } }; @@ -93,12 +116,12 @@ constructor() { super(false); this.contentElement.classList.add('timeline-perspective-body'); - this._enabledOptions = new Set([Timeline.TimelineLandingPage.RecordingConfig.javascript.id]); + /** @type {!Map<string, boolean>} */ + this._forceEnable = new Map(); this._descriptionDiv = this.contentElement.createChild('div', 'timeline-perspective-description'); this._actionButtonDiv = this.contentElement.createChild('div'); - this._actionButtonDiv.appendChild(createTextButton(Common.UIString('Start profiling'), this._record.bind(this))); - this._actionButtonDiv.appendChild( - createTextButton(Common.UIString('Profile page load'), this._recordPageLoad.bind(this))); + this._actionButtonDiv.appendChild(createTextButton(Common.UIString('Start profiling'), this._record)); + this._actionButtonDiv.appendChild(createTextButton(Common.UIString('Profile page load'), this._recordPageLoad)); } /** @@ -113,26 +136,32 @@ /** * @param {!Timeline.TimelineLandingPage.RecordingOption} option - * @param {boolean} enabled + * @param {boolean=} forceEnable */ - appendOption(option, enabled) { - if (enabled) - this._enabledOptions.add(option.id); + appendOption(option, forceEnable) { + if (typeof forceEnable === 'boolean') { + this._forceEnable.set(option.id, forceEnable); + return; + } const div = createElementWithClass('div', 'recording-setting'); - const value = this._enabledOptions.has(option.id); - const setting = Common.settings.createSetting(option.setting, value); + const setting = Common.settings.createSetting(option.settingName, option.value); div.appendChild(UI.SettingsUI.createSettingCheckbox(option.title, setting, true)); if (option.description) div.createChild('div', 'recording-setting-description').textContent = option.description; this.contentElement.insertBefore(div, this._actionButtonDiv); } - activate() { + /** + * @return {!Timeline.TimelineController.RecordingOptions} + */ + recordingOptions() { + const options = {}; for (const id in Timeline.TimelineLandingPage.RecordingConfig) { const config = Timeline.TimelineLandingPage.RecordingConfig[id]; - const setting = Common.settings.createSetting(config.setting, false); - setting.set(this._enabledOptions.has(id)); + const setting = Common.settings.createSetting(config.settingName, config.value); + options[config.captureOptionName] = this._forceEnable.has(id) ? this._forceEnable.get(id) : setting.get(); } + return options; } _record() {
diff --git a/third_party/WebKit/Source/devtools/front_end/timeline/TimelineNetworkFlameChart.js b/third_party/WebKit/Source/devtools/front_end/timeline/TimelineNetworkFlameChart.js index 974a0f7..99b668d 100644 --- a/third_party/WebKit/Source/devtools/front_end/timeline/TimelineNetworkFlameChart.js +++ b/third_party/WebKit/Source/devtools/front_end/timeline/TimelineNetworkFlameChart.js
@@ -3,17 +3,17 @@ // found in the LICENSE file. /** + * @implements {UI.FlameChartDataProvider} * @unrestricted */ -Timeline.TimelineFlameChartNetworkDataProvider = class extends Timeline.TimelineFlameChartDataProviderBase { +Timeline.TimelineFlameChartNetworkDataProvider = class { /** * @param {!TimelineModel.TimelineModel} model */ constructor(model) { - super(); + this.reset(); + this._font = '11px ' + Host.fontFamily(); this._model = model; - /** @type {?UI.FlameChart.TimelineData} */ - this._timelineData = null; var loadingCategory = Timeline.TimelineUIUtils.categories()['loading']; this._waitingColor = loadingCategory.childColor; this._processingColor = loadingCategory.color; @@ -23,7 +23,7 @@ height: 17, collapsible: true, color: UI.themeSupport.patchColor('#222', UI.ThemeSupport.ColorUsage.Foreground), - font: this.font(), + font: this._font, backgroundColor: UI.themeSupport.patchColor('white', UI.ThemeSupport.ColorUsage.Background), nestingLevel: 0, useFirstLineForOverview: false, @@ -34,6 +34,14 @@ /** * @override + * @return {number} + */ + maxStackDepth() { + return this._maxLevel; + } + + /** + * @override * @return {!UI.FlameChart.TimelineData} */ timelineData() { @@ -48,9 +56,22 @@ /** * @override + * @return {number} */ + minimumBoundary() { + return this._minimumBoundary; + } + + /** + * @override + * @return {number} + */ + totalTime() { + return this._timeSpan; + } + reset() { - super.reset(); + this._maxLevel = 0; this._timelineData = null; /** @type {!Array<!TimelineModel.TimelineModel.NetworkRequest>} */ this._requests = []; @@ -67,20 +88,6 @@ } /** - * @override - * @param {number} index - * @return {?Timeline.TimelineSelection} - */ - createSelection(index) { - if (index === -1) - return null; - var request = this._requests[index]; - this._lastSelection = - new Timeline.TimelineFlameChartView.Selection(Timeline.TimelineSelection.fromNetworkRequest(request), index); - return this._lastSelection.timelineSelection; - } - - /** * @param {?Timeline.TimelineSelection} selection * @return {number} */ @@ -116,11 +123,30 @@ /** * @override * @param {number} index + * @return {string} + */ + textColor(index) { + return Timeline.FlameChartStyle.textColor; + } + + /** + * @override + * @param {number} index * @return {?string} */ entryTitle(index) { - var request = /** @type {!TimelineModel.TimelineModel.NetworkRequest} */ (this._requests[index]); - return request.url || null; + const request = /** @type {!TimelineModel.TimelineModel.NetworkRequest} */ (this._requests[index]); + const parsedURL = new Common.ParsedURL(request.url || ''); + return parsedURL.isValid ? `${parsedURL.displayName} (${parsedURL.host})` : request.url || null; + } + + /** + * @override + * @param {number} index + * @return {?string} + */ + entryFont(index) { + return this._font; } /** @@ -197,19 +223,17 @@ const textStart = Math.max(sendStart, 0); const textWidth = finish - textStart; const minTextWidthPx = 20; - const textPadding = 6; - var gearPadding = 0; if (textWidth >= minTextWidthPx) { - const text = this.entryTitle(index); - if (text && text.length) { + text = this.entryTitle(index) || ''; + if (request.fromServiceWorker) + text = 'âš™ ' + text; + if (text) { + const textPadding = 4; + const textBaseline = 5; + const textBaseHeight = barHeight - textBaseline; + const trimmedText = UI.trimTextEnd(context, text, textWidth - 2 * textPadding); context.fillStyle = '#333'; - const textBaseHeight = barHeight - this.textBaseline(); - if (request.fromServiceWorker) { - context.fillText('âš™', textStart + textPadding, barY + textBaseHeight); - gearPadding = UI.measureTextWidth(context, 'âš™ '); - } - const trimmedText = UI.trimTextMiddle(context, text, textWidth - 2 * textPadding - gearPadding); - context.fillText(trimmedText, textStart + textPadding + gearPadding, barY + textBaseHeight); + context.fillText(trimmedText, textStart + textPadding, barY + textBaseHeight); } } @@ -307,7 +331,7 @@ this._timelineData = new UI.FlameChart.TimelineData( this._timelineData.entryLevels, this._timelineData.entryTotalTimes, this._timelineData.entryStartTimes, [this._group]); - this._currentLevel = maxLevel; + this._maxLevel = maxLevel; } @@ -325,6 +349,25 @@ * @return {number} */ preferredHeight() { - return this._style.height * (this._group.expanded ? Number.constrain(this._currentLevel + 1, 4, 8) : 2) + 2; + return this._style.height * (this._group.expanded ? Number.constrain(this._maxLevel + 1, 4, 8) : 2) + 2; + } + + /** + * @override + * @param {number} value + * @param {number=} precision + * @return {string} + */ + formatValue(value, precision) { + return Number.preciseMillisToString(value, precision); + } + + /** + * @override + * @param {number} entryIndex + * @return {boolean} + */ + canJumpToEntry(entryIndex) { + return false; } };
diff --git a/third_party/WebKit/Source/devtools/front_end/timeline/TimelinePanel.js b/third_party/WebKit/Source/devtools/front_end/timeline/TimelinePanel.js index 3ae124b..8abad64 100644 --- a/third_party/WebKit/Source/devtools/front_end/timeline/TimelinePanel.js +++ b/third_party/WebKit/Source/devtools/front_end/timeline/TimelinePanel.js
@@ -103,6 +103,8 @@ SDK.targetManager.addEventListener(SDK.TargetManager.Events.PageReloadRequested, this._pageReloadRequested, this); SDK.targetManager.addEventListener(SDK.TargetManager.Events.Load, this._loadEventFired, this); + this._landingPage = new Timeline.TimelineLandingPage(); + // Create top level properties splitter. this._detailsSplitWidget = new UI.SplitWidget(false, true, 'timelinePanelDetailsSplitViewState'); this._detailsSplitWidget.element.classList.add('timeline-details-split'); @@ -305,7 +307,7 @@ // Record const newButton = new UI.ToolbarButton(Common.UIString('New recording'), 'largeicon-add', Common.UIString('New')); - newButton.setEnabled(!this._landingPage); + newButton.setEnabled(!this._model.isEmpty()); newButton.addEventListener(UI.ToolbarButton.Events.Click, this._clear, this); this._panelToolbar.appendToolbarItem(newButton); this._panelToolbar.appendSeparator(); @@ -543,14 +545,9 @@ var enabledTraceProviders = Extensions.extensionServer.traceProviders().filter( provider => Timeline.TimelinePanel._settingForTraceProvider(provider).get()); - var captureOptions = { - enableJSSampling: this._captureJSProfileSetting.get(), - capturePictures: this._captureLayersAndPicturesSetting.get(), - captureFilmStrip: this._captureFilmStripSetting.get() - }; - + const recordingOptions = this._landingPage.recordingOptions(); this._controller = new Timeline.TimelineController(mainTarget, this, this._tracingModel); - this._controller.startRecording(captureOptions, enabledTraceProviders); + this._controller.startRecording(recordingOptions, enabledTraceProviders); this._recordingStartTime = Date.now(); for (var i = 0; i < this._overviewControls.length; ++i) @@ -665,18 +662,12 @@ } _showLandingPage() { - if (this._landingPage) - return; this._timelinePane.detach(); - this._landingPage = new Timeline.TimelineLandingPage(); this._landingPage.show(this.element); } _hideLandingPage() { - if (!this._landingPage) - return; this._landingPage.detach(); - this._landingPage = null; this._timelinePane.show(this.element); }
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/UIUtils.js b/third_party/WebKit/Source/devtools/front_end/ui/UIUtils.js index 3a62614d..0b6be95 100644 --- a/third_party/WebKit/Source/devtools/front_end/ui/UIUtils.js +++ b/third_party/WebKit/Source/devtools/front_end/ui/UIUtils.js
@@ -1611,17 +1611,18 @@ }; /** - * @param {!CanvasRenderingContext2D} context - * @param {string} text - * @param {number} maxWidth - * @return {string} - */ -UI.trimTextMiddle = function(context, text, maxWidth) { + * @param {!CanvasRenderingContext2D} context + * @param {string} text + * @param {number} maxWidth + * @param {function(string, number):string} trimFunction + * @return {string} + */ +UI.trimText = function(context, text, maxWidth, trimFunction) { const maxLength = 200; if (maxWidth <= 10) return ''; if (text.length > maxLength) - text = text.trimMiddle(maxLength); + text = trimFunction(text, maxLength); const textWidth = UI.measureTextWidth(context, text); if (textWidth <= maxWidth) return text; @@ -1632,7 +1633,7 @@ var rv = textWidth; while (l < r && lv !== rv && lv !== maxWidth) { const m = Math.ceil(l + (r - l) * (maxWidth - lv) / (rv - lv)); - const mv = UI.measureTextWidth(context, text.trimMiddle(m)); + const mv = UI.measureTextWidth(context, trimFunction(text, m)); if (mv <= maxWidth) { l = m; lv = mv; @@ -1641,13 +1642,33 @@ rv = mv; } } - text = text.trimMiddle(l); + text = trimFunction(text, l); return text !== '\u2026' ? text : ''; }; /** * @param {!CanvasRenderingContext2D} context * @param {string} text + * @param {number} maxWidth + * @return {string} + */ +UI.trimTextMiddle = function(context, text, maxWidth) { + return UI.trimText(context, text, maxWidth, (text, width) => text.trimMiddle(width)); +}; + +/** + * @param {!CanvasRenderingContext2D} context + * @param {string} text + * @param {number} maxWidth + * @return {string} + */ +UI.trimTextEnd = function(context, text, maxWidth) { + return UI.trimText(context, text, maxWidth, (text, width) => text.trimEnd(width)); +}; + +/** + * @param {!CanvasRenderingContext2D} context + * @param {string} text * @return {number} */ UI.measureTextWidth = function(context, text) {
diff --git a/third_party/WebKit/Source/devtools/front_end/ui_lazy/FlameChart.js b/third_party/WebKit/Source/devtools/front_end/ui_lazy/FlameChart.js index 5f95e5f3..d3479bb 100644 --- a/third_party/WebKit/Source/devtools/front_end/ui_lazy/FlameChart.js +++ b/third_party/WebKit/Source/devtools/front_end/ui_lazy/FlameChart.js
@@ -27,6 +27,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ + /** * @interface */ @@ -79,14 +80,17 @@ this._highlightElement = this.viewportElement.createChild('div', 'flame-chart-highlight-element'); this._selectedElement = this.viewportElement.createChild('div', 'flame-chart-selected-element'); + this._rulerEnabled = true; this._windowLeft = 0.0; this._windowRight = 1.0; this._timeWindowLeft = 0; this._timeWindowRight = Infinity; this._rangeSelectionStart = 0; this._rangeSelectionEnd = 0; - this._barHeight = dataProvider.barHeight(); - this._paddingLeft = this._dataProvider.paddingLeft(); + this._barHeight = 17; + this._textBaseline = 5; + this._textPadding = 5; + this._paddingLeft = 0; var markerPadding = 2; this._markerRadius = this._barHeight / 2 - markerPadding; @@ -119,6 +123,41 @@ } /** + * @param {number} value + */ + setBarHeight(value) { + this._barHeight = value; + } + + /** + * @param {number} value + */ + setTextBaseline(value) { + this._textBaseline = value; + } + + /** + * @param {number} value + */ + setTextPadding(value) { + this._textPadding = value; + } + + /** + * @param {number} value + */ + setPaddingLeft(value) { + this._paddingLeft = value; + } + + /** + * @param {boolean} enable + */ + enableRuler(enable) { + this._rulerEnabled = enable; + } + + /** * @param {number} entryIndex */ highlightEntry(entryIndex) { @@ -210,7 +249,7 @@ } _updateHighlight() { - var inDividersBar = this._lastMouseOffsetY < UI.FlameChart.DividersBarHeight; + var inDividersBar = this._lastMouseOffsetY < UI.FlameChart.HeaderHeight; this._highlightedMarkerIndex = inDividersBar ? this._markerIndexAtPosition(this._lastMouseOffsetX) : -1; this._updateMarkerHighlight(); @@ -549,7 +588,7 @@ var titleIndices = []; var markerIndices = []; - var textPadding = this._dataProvider.textPadding(); + var textPadding = this._textPadding; var minTextWidth = 2 * textPadding + UI.measureTextWidth(context, '\u2026'); var barHeight = this._barHeight; var minVisibleBarLevel = Math.max(this._visibleLevelOffsets.upperBound(top) - 1, 0); @@ -633,7 +672,7 @@ context.stroke(); context.textBaseline = 'alphabetic'; - var textBaseHeight = this._barHeight - this._dataProvider.textBaseline(); + var textBaseHeight = this._barHeight - this._textBaseline; for (var i = 0; i < titleIndices.length; ++i) { var entryIndex = titleIndices[i]; @@ -662,7 +701,7 @@ this._drawGroupHeaders(width, height); this._drawMarkers(); - const headerHeight = 15; + const headerHeight = this._rulerEnabled ? UI.FlameChart.HeaderHeight : 0; UI.TimelineGrid.drawCanvasGrid(context, this._calculator, 3, headerHeight); this._updateElementPosition(this._highlightElement, this._highlightedEntryIndex); @@ -679,7 +718,7 @@ var top = this.getScrollOffset(); var ratio = window.devicePixelRatio; var barHeight = this._barHeight; - var textBaseHeight = barHeight - this._dataProvider.textBaseline(); + var textBaseHeight = barHeight - this._textBaseline; var groups = this._rawTimelineData.groups || []; if (!groups.length) return; @@ -895,7 +934,8 @@ context.save(); var ratio = window.devicePixelRatio; context.scale(ratio, ratio); - var height = UI.FlameChart.DividersBarHeight - 1; + context.translate(0, 3); + var height = UI.FlameChart.HeaderHeight - 1; for (var i = left; i < markers.length; i++) { var timestamp = markers[i].startTime(); if (timestamp > rightBoundary) @@ -969,11 +1009,12 @@ this._groupOffsets = new Uint32Array(groups.length + 1); var groupIndex = -1; - var currentOffset = UI.FlameChart.DividersBarHeight; + var currentOffset = this._rulerEnabled ? UI.FlameChart.HeaderHeight : 2; var visible = true; /** @type !Array<{nestingLevel: number, visible: boolean}> */ var groupStack = [{nestingLevel: -1, visible: true}]; - for (var level = 0; level < levelCount; ++level) { + var lastGroupLevel = Math.max(levelCount, groups.peekLast().startLevel + 1); + for (var level = 0; level < lastGroupLevel; ++level) { while (groupIndex < groups.length - 1 && level === groups[groupIndex + 1].startLevel) { ++groupIndex; var style = groups[groupIndex].style; @@ -995,8 +1036,10 @@ } var isFirstOnLevel = groupIndex >= 0 && level === groups[groupIndex].startLevel; var thisLevelIsVisible = visible || isFirstOnLevel && groups[groupIndex].style.useFirstLineForOverview; - this._visibleLevels[level] = thisLevelIsVisible; - this._visibleLevelOffsets[level] = currentOffset; + if (level < levelCount) { + this._visibleLevels[level] = thisLevelIsVisible; + this._visibleLevelOffsets[level] = currentOffset; + } if (thisLevelIsVisible || (parentGroupIsVisible && style.shareHeaderLine && isFirstOnLevel)) currentOffset += this._barHeight; } @@ -1158,7 +1201,7 @@ } }; -UI.FlameChart.DividersBarHeight = 18; +UI.FlameChart.HeaderHeight = 15; UI.FlameChart.MinimalTimeWindowMs = 0.5; @@ -1211,11 +1254,6 @@ /** * @return {number} */ - barHeight() {}, - - /** - * @return {number} - */ minimumBoundary() {}, /** @@ -1295,21 +1333,6 @@ * @return {string} */ textColor(entryIndex) {}, - - /** - * @return {number} - */ - textBaseline() {}, - - /** - * @return {number} - */ - textPadding() {}, - - /** - * @return {number} - */ - paddingLeft() {}, }; /**
diff --git a/third_party/WebKit/Source/devtools/front_end/ui_lazy/TimelineGrid.js b/third_party/WebKit/Source/devtools/front_end/ui_lazy/TimelineGrid.js index 871d15c..bc212bc9 100644 --- a/third_party/WebKit/Source/devtools/front_end/ui_lazy/TimelineGrid.js +++ b/third_party/WebKit/Source/devtools/front_end/ui_lazy/TimelineGrid.js
@@ -97,7 +97,7 @@ * @param {!CanvasRenderingContext2D} context * @param {!UI.TimelineGrid.Calculator} calculator * @param {number} paddingTop - * @param {number} headerHeight + * @param {number=} headerHeight * @param {number=} freeZoneAtLeft */ static drawCanvasGrid(context, calculator, paddingTop, headerHeight, freeZoneAtLeft) { @@ -110,8 +110,10 @@ var dividerOffsets = dividersData.offsets; var precision = dividersData.precision; - context.fillStyle = UI.themeSupport.patchColor('rgba(255, 255, 255, 0.5)', UI.ThemeSupport.ColorUsage.Background); - context.fillRect(0, 0, width, headerHeight); + if (headerHeight) { + context.fillStyle = UI.themeSupport.patchColor('rgba(255, 255, 255, 0.5)', UI.ThemeSupport.ColorUsage.Background); + context.fillRect(0, 0, width, headerHeight); + } context.fillStyle = UI.themeSupport.patchColor('#333', UI.ThemeSupport.ColorUsage.Foreground); context.strokeStyle = UI.themeSupport.patchColor('rgba(0, 0, 0, 0.1)', UI.ThemeSupport.ColorUsage.Foreground); @@ -124,13 +126,15 @@ for (var i = 0; i < dividerOffsets.length; ++i) { var time = dividerOffsets[i]; var position = calculator.computePosition(time); + context.moveTo(position, 0); + context.lineTo(position, height); + if (!headerHeight) + continue; var text = calculator.formatValue(time, precision); var textWidth = context.measureText(text).width; var textPosition = position - textWidth - paddingRight; if (!freeZoneAtLeft || freeZoneAtLeft < textPosition) context.fillText(text, textPosition, paddingTop); - context.moveTo(position, 0); - context.lineTo(position, height); } context.stroke(); context.restore();
diff --git a/third_party/WebKit/Source/modules/payments/HTMLIFrameElementPayments.cpp b/third_party/WebKit/Source/modules/payments/HTMLIFrameElementPayments.cpp index d06a96aa..d67bf7b3 100644 --- a/third_party/WebKit/Source/modules/payments/HTMLIFrameElementPayments.cpp +++ b/third_party/WebKit/Source/modules/payments/HTMLIFrameElementPayments.cpp
@@ -49,7 +49,7 @@ // static bool HTMLIFrameElementPayments::allowPaymentRequest( HTMLIFrameElement& element) { - return RuntimeEnabledFeatures::paymentRequestIFrameEnabled() && + return RuntimeEnabledFeatures::paymentRequestEnabled() && element.fastHasAttribute(HTMLNames::allowpaymentrequestAttr); }
diff --git a/third_party/WebKit/Source/modules/payments/HTMLIFrameElementPayments.idl b/third_party/WebKit/Source/modules/payments/HTMLIFrameElementPayments.idl index 90b92ae12..384e459 100644 --- a/third_party/WebKit/Source/modules/payments/HTMLIFrameElementPayments.idl +++ b/third_party/WebKit/Source/modules/payments/HTMLIFrameElementPayments.idl
@@ -5,7 +5,7 @@ // https://w3c.github.io/browser-payment-api/#paymentrequest-and-iframes [ - RuntimeEnabled=PaymentRequestIFrame + RuntimeEnabled=PaymentRequest ] partial interface HTMLIFrameElement { [CEReactions, Reflect] attribute boolean allowPaymentRequest; };
diff --git a/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp b/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp index 05ee7d6a..5878b4d 100644 --- a/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp +++ b/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp
@@ -493,10 +493,8 @@ // is an iframe element with an |allowpaymentrequest| attribute specified, and // whose node document is allowed to use the feature indicated by // |allowpaymentrequest|, then return true. - if (RuntimeEnabledFeatures::paymentRequestIFrameEnabled() && frame->owner() && - frame->owner()->allowPaymentRequest()) { + if (frame->owner() && frame->owner()->allowPaymentRequest()) return allowedToUsePaymentRequest(frame->tree().parent()); - } // 4. Return false. return false; @@ -694,10 +692,8 @@ if (!allowedToUsePaymentRequest(document.frame())) { exceptionState.throwSecurityError( - RuntimeEnabledFeatures::paymentRequestIFrameEnabled() - ? "Must be in a top-level browsing context or an iframe needs to " - "specify 'allowpaymentrequest' explicitly" - : "Must be in a top-level browsing context"); + "Must be in a top-level browsing context or an iframe needs to specify " + "'allowpaymentrequest' explicitly"); return; }
diff --git a/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.in b/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.in index de0dc54..1e60d01 100644 --- a/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.in +++ b/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.in
@@ -184,7 +184,6 @@ PaymentDetailsModifierData status=experimental // PaymentRequest is enabled by default on Android PaymentRequest status=experimental -PaymentRequestIFrame status=experimental PaymentRequestPayerName status=stable PerformanceObserver status=stable PermissionDelegation status=test
diff --git a/third_party/WebKit/Source/platform/graphics/test/FakeWebGraphicsContext3DProvider.h b/third_party/WebKit/Source/platform/graphics/test/FakeWebGraphicsContext3DProvider.h index 18fff934..b70853d 100644 --- a/third_party/WebKit/Source/platform/graphics/test/FakeWebGraphicsContext3DProvider.h +++ b/third_party/WebKit/Source/platform/graphics/test/FakeWebGraphicsContext3DProvider.h
@@ -5,18 +5,17 @@ #include "gpu/command_buffer/client/gles2_interface.h" #include "gpu/command_buffer/common/capabilities.h" #include "public/platform/WebGraphicsContext3DProvider.h" +#include "third_party/skia/include/core/SkRefCnt.h" #include "third_party/skia/include/gpu/GrContext.h" #include "third_party/skia/include/gpu/gl/GrGLInterface.h" -#include "wtf/RefPtr.h" namespace blink { class FakeWebGraphicsContext3DProvider : public WebGraphicsContext3DProvider { public: FakeWebGraphicsContext3DProvider(gpu::gles2::GLES2Interface* gl) : m_gl(gl) { - RefPtr<const GrGLInterface> glInterface = - adoptRef(GrGLCreateNullInterface()); - m_grContext = adoptRef(GrContext::Create( + sk_sp<const GrGLInterface> glInterface(GrGLCreateNullInterface()); + m_grContext.reset(GrContext::Create( kOpenGL_GrBackend, reinterpret_cast<GrBackendContext>(glInterface.get()))); } @@ -37,7 +36,7 @@ private: gpu::gles2::GLES2Interface* m_gl; - RefPtr<GrContext> m_grContext; + sk_sp<GrContext> m_grContext; }; } // namespace blink
diff --git a/third_party/WebKit/Source/web/tests/VisualViewportTest.cpp b/third_party/WebKit/Source/web/tests/VisualViewportTest.cpp index 4d3d200..0379b0d 100644 --- a/third_party/WebKit/Source/web/tests/VisualViewportTest.cpp +++ b/third_party/WebKit/Source/web/tests/VisualViewportTest.cpp
@@ -2399,4 +2399,59 @@ RuntimeEnabledFeatures::setInertTopControlsEnabled(originalInertTopControls); } +TEST_P(VisualViewportTest, InvalidateLayoutViewWhenDocumentSmallerThanView) { + bool originalInertTopControls = + RuntimeEnabledFeatures::inertTopControlsEnabled(); + RuntimeEnabledFeatures::setInertTopControlsEnabled(true); + + std::unique_ptr<FrameTestHelpers::TestWebViewClient> + fakeCompositingWebViewClient = + WTF::makeUnique<FrameTestHelpers::TestWebViewClient>(); + FrameTestHelpers::WebViewHelper webViewHelper; + WebViewImpl* webViewImpl = webViewHelper.initialize( + true, nullptr, fakeCompositingWebViewClient.get(), nullptr, + &configureAndroidCompositing); + + int pageWidth = 320; + int pageHeight = 590; + float browserControlsHeight = 50.0f; + int largestHeight = pageHeight + browserControlsHeight; + + webViewImpl->resizeWithBrowserControls(WebSize(pageWidth, pageHeight), + browserControlsHeight, true); + + FrameTestHelpers::loadFrame(webViewImpl->mainFrame(), "about:blank"); + webViewImpl->updateAllLifecyclePhases(); + + Document* document = + toLocalFrame(webViewImpl->page()->mainFrame())->document(); + + // Do a resize to check for invalidations. + document->view()->setTracksPaintInvalidations(true); + webViewImpl->resizeWithBrowserControls(WebSize(pageWidth, largestHeight), + browserControlsHeight, false); + + // The layout size should not have changed. + ASSERT_EQ(pageWidth, document->view()->layoutSize().width()); + ASSERT_EQ(pageHeight, document->view()->layoutSize().height()); + + // The entire viewport should have been invalidated. + { + const RasterInvalidationTracking* invalidationTracking = + document->layoutView() + ->layer() + ->graphicsLayerBacking() + ->getRasterInvalidationTracking(); + ASSERT_TRUE(invalidationTracking); + const auto* rasterInvalidations = + &invalidationTracking->trackedRasterInvalidations; + ASSERT_EQ(1u, rasterInvalidations->size()); + EXPECT_EQ(IntRect(0, 0, pageWidth, largestHeight), + (*rasterInvalidations)[0].rect); + } + + document->view()->setTracksPaintInvalidations(false); + RuntimeEnabledFeatures::setInertTopControlsEnabled(originalInertTopControls); +} + } // namespace
diff --git a/third_party/WebKit/Source/wtf/text/StringImpl.h b/third_party/WebKit/Source/wtf/text/StringImpl.h index 98e639bf..680b40a 100644 --- a/third_party/WebKit/Source/wtf/text/StringImpl.h +++ b/third_party/WebKit/Source/wtf/text/StringImpl.h
@@ -289,12 +289,8 @@ ALWAYS_INLINE void ref() { ++m_refCount; } ALWAYS_INLINE void deref() { - if (hasOneRef()) { + if (!--m_refCount) destroyIfNotStatic(); - return; - } - - --m_refCount; } static StringImpl* empty();
diff --git a/third_party/WebKit/Source/wtf/text/StringView.cpp b/third_party/WebKit/Source/wtf/text/StringView.cpp index d3d53e6..6774c5f 100644 --- a/third_party/WebKit/Source/wtf/text/StringView.cpp +++ b/third_party/WebKit/Source/wtf/text/StringView.cpp
@@ -16,8 +16,9 @@ #if DCHECK_IS_ON() StringView::~StringView() { DCHECK(m_impl); - DCHECK(!m_impl->hasOneRef()) << "StringView does not own the StringImpl, it " - "must not have the last ref."; + DCHECK(!m_impl->hasOneRef() || m_impl->isStatic()) + << "StringView does not own the StringImpl, it " + "must not have the last ref."; } #endif
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/host_mock.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/host_mock.py index 238fff7..9a62e2a 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/host_mock.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/host_mock.py
@@ -40,12 +40,19 @@ class MockHost(MockSystemHost): - def __init__(self, log_executive=False, executive_throws_when_run=None, - initialize_scm_by_default=True, web=None, scm=None, os_name=None, os_version=None, + def __init__(self, + log_executive=False, + initialize_scm_by_default=True, + web=None, + scm=None, + os_name=None, + os_version=None, time_return_val=123): - - MockSystemHost.__init__(self, log_executive, executive_throws_when_run, os_name=os_name, - os_version=os_version, time_return_val=time_return_val) + super(MockHost, self).__init__( + log_executive=log_executive, + os_name=os_name, + os_version=os_version, + time_return_val=time_return_val) add_unit_tests_to_mock_filesystem(self.filesystem) self.web = web or MockWeb()
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/memoized.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/memoized.py index 7a9a925..b9566dd7 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/memoized.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/memoized.py
@@ -45,10 +45,10 @@ result = self._function(*args) self._results_cache[args] = result return result - except TypeError as e: + except TypeError as error: raise TypeError( 'Cannot call memoized function %s with unhashable ' - 'arguments: %s' % (self._function.__name__, e.message)) + 'arguments: %s' % (self._function.__name__, error.message)) # Use python "descriptor" protocol __get__ to appear # invisible during property access.
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/memoized_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/memoized_unittest.py index 417556b..2f4e567 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/memoized_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/memoized_unittest.py
@@ -71,8 +71,8 @@ try: test.memoized_add_one([]) self.fail('Expected TypeError.') - except TypeError as e: + except TypeError as error: self.assertEqual( - e.message, + error.message, 'Cannot call memoized function memoized_add_one with ' 'unhashable arguments: unhashable type: \'list\'')
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/net/network_transaction.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/net/network_transaction.py index 5924e481..7198e02 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/net/network_transaction.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/net/network_transaction.py
@@ -58,12 +58,12 @@ while True: try: return request() - except urllib2.HTTPError as e: - if self._convert_404_to_None and e.code == 404: + except urllib2.HTTPError as error: + if self._convert_404_to_None and error.code == 404: return None self._check_for_timeout() _log.warning("Received HTTP status %s loading \"%s\". Retrying in %s seconds...", - e.code, e.filename, self._backoff_seconds) + error.code, error.filename, self._backoff_seconds) self._sleep() def _check_for_timeout(self):
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/executive.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/executive.py index 25bb0060..c0afd688 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/executive.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/executive.py
@@ -99,31 +99,6 @@ def cpu_count(self): return multiprocessing.cpu_count() - @staticmethod - def interpreter_for_script(script_path, fs=None): - fs = fs or FileSystem() - lines = fs.read_text_file(script_path).splitlines() - if not len(lines): - return None - first_line = lines[0] - if not first_line.startswith('#!'): - return None - if first_line.find('python') > -1: - return sys.executable - if first_line.find('ruby') > -1: - return 'ruby' - return None - - @staticmethod - def shell_command_for_script(script_path, fs=None): - fs = fs or FileSystem() - # Win32 does not support shebang. We need to detect the interpreter ourself. - if sys.platform == 'win32': - interpreter = Executive.interpreter_for_script(script_path, fs) - if interpreter: - return [interpreter, script_path] - return [script_path] - def kill_process(self, pid): """Attempts to kill the given pid. Will fail silently if pid does not exist or insufficient permissions. @@ -146,19 +121,19 @@ retries_left -= 1 os.kill(pid, signal.SIGKILL) _ = os.waitpid(pid, os.WNOHANG) - except OSError as e: - if e.errno == errno.EAGAIN: + except OSError as error: + if error.errno == errno.EAGAIN: if retries_left <= 0: _log.warning("Failed to kill pid %s. Too many EAGAIN errors.", pid) continue - if e.errno == errno.ESRCH: # The process does not exist. + if error.errno == errno.ESRCH: # The process does not exist. return - if e.errno == errno.EPIPE: # The process has exited already on cygwin + if error.errno == errno.EPIPE: # The process has exited already on cygwin return - if e.errno == errno.ECHILD: + if error.errno == errno.ECHILD: # Can't wait on a non-child process, but the kill worked. return - if e.errno == errno.EACCES and sys.platform == 'cygwin': + if error.errno == errno.EACCES and sys.platform == 'cygwin': # Cygwin python sometimes can't kill native processes. return raise @@ -283,14 +258,6 @@ seconds_left -= sleep_length time.sleep(sleep_length) - def _windows_image_name(self, process_name): - name, extension = os.path.splitext(process_name) - if not extension: - # taskkill expects processes to end in .exe - # If necessary we could add a flag to disable appending .exe. - process_name = "%s.exe" % name - return process_name - def interrupt(self, pid): interrupt_signal = signal.SIGINT # Note: The python docs seem to suggest that on Windows, we may want to use @@ -440,16 +407,9 @@ # The Windows implementation of Popen cannot handle unicode strings. :( return map(self._encode_argument_if_needed, string_args) - # The only required argument to popen is named "args", the rest are optional keyword arguments. def popen(self, args, **kwargs): - # FIXME: We should always be stringifying the args, but callers who pass shell=True - # expect that the exact bytes passed will get passed to the shell (even if they're wrongly encoded). - # shell=True is wrong for many other reasons, and we should remove this - # hack as soon as we can fix all callers to not use shell=True. - if kwargs.get('shell') == True: - string_args = args - else: - string_args = self._stringify_args(args) + assert not kwargs.get('shell') + string_args = self._stringify_args(args) return subprocess.Popen(string_args, **kwargs) def call(self, args, **kwargs):
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/executive_mock.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/executive_mock.py index d5c918a..0678254aeb 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/executive_mock.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/executive_mock.py
@@ -67,16 +67,19 @@ pass def __init__(self, should_log=False, should_throw=False, - should_throw_when_run=None, should_return_zero_when_run=None): + output="MOCK output of child process", stderr='', + exit_code=0, exception=None, run_command_fn=None): self._should_log = should_log self._should_throw = should_throw - self._should_throw_when_run = should_throw_when_run or set() - self._should_return_zero_when_run = should_return_zero_when_run or set() # FIXME: Once executive wraps os.getpid() we can just use a static pid for "this" process. self._running_pids = {'test-webkitpy': os.getpid()} - self.calls = [] - self._output = "MOCK output of child process" + self._output = output + self._stderr = stderr + self._exit_code = exit_code + self._exception = exception + self._run_command_fn = run_command_fn self._proc = None + self.calls = [] def check_running_pid(self, pid): return pid in self._running_pids.values() @@ -94,22 +97,23 @@ string_args = map(unicode, args) return " ".join(string_args) + # The argument list should match Executive.run_command, even if + # some arguments are not used. pylint: disable=unused-argument def run_command(self, args, cwd=None, - input=None, - # pylint: disable=unused-argument - timeout_seconds=None, + input=None, # pylint: disable=redefined-builtin + timeout_seconds=False, error_handler=None, return_exit_code=False, return_stderr=True, decode_output=False, env=None, debug_logging=False): - self.calls.append(args) assert isinstance(args, list) or isinstance(args, tuple) + if self._should_log: env_string = "" if env: @@ -119,14 +123,23 @@ input_string = ", input=%s" % input _log.info("MOCK run_command: %s, cwd=%s%s%s", args, cwd, env_string, input_string) - if self._should_throw_when_run.intersection(args): - raise ScriptError("Exception for %s" % args, output="MOCK command output") - + if self._exception: + raise self._exception # pylint: disable=raising-bad-type if self._should_throw: raise ScriptError("MOCK ScriptError", output=self._output) - if return_exit_code and self._should_return_zero_when_run.intersection(args): - return 0 + if self._run_command_fn: + return self._run_command_fn(args) + + if return_exit_code: + return self._exit_code + + if self._exit_code and error_handler: + script_error = ScriptError(script_args=args, exit_code=self._exit_code, output=self._output) + error_handler(script_error) + + if return_stderr: + return self._output + self._stderr return self._output @@ -139,7 +152,7 @@ def kill_process(self, pid): pass - def popen(self, args, cwd=None, env=None, **kwargs): + def popen(self, args, cwd=None, env=None, **_): assert all(isinstance(arg, basestring) for arg in args) self.calls.append(args) if self._should_log: @@ -154,7 +167,7 @@ self._proc = MockProcess(self._output) return self._proc - def call(self, args, **kwargs): + def call(self, args, **_): assert all(isinstance(arg, basestring) for arg in args) self.calls.append(args) _log.info('Mock call: %s', args)
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/executive_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/executive_unittest.py index 487256b..37dce818 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/executive_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/executive_unittest.py
@@ -39,7 +39,6 @@ sys.path.append(script_dir) from webkitpy.common.system.executive import Executive, ScriptError -from webkitpy.common.system.filesystem_mock import MockFileSystem class ScriptErrorTest(unittest.TestCase): @@ -78,27 +77,6 @@ class ExecutiveTest(unittest.TestCase): - def assert_interpreter_for_content(self, interpreter, content): - fs = MockFileSystem() - - tempfile, temp_name = fs.open_binary_tempfile('') - tempfile.write(content) - tempfile.close() - file_interpreter = Executive.interpreter_for_script(temp_name, fs) - - self.assertEqual(file_interpreter, interpreter) - - def test_interpreter_for_script(self): - self.assert_interpreter_for_content(None, '') - self.assert_interpreter_for_content(None, 'abcd\nefgh\nijklm') - self.assert_interpreter_for_content(None, '##/usr/bin/env python') - self.assert_interpreter_for_content(sys.executable, '#!/usr/bin/env python') - self.assert_interpreter_for_content(sys.executable, '#!/usr/bin/env python\nfirst\nsecond') - self.assert_interpreter_for_content(sys.executable, '#!/usr/bin/python') - self.assert_interpreter_for_content('ruby', '#!/usr/bin/env ruby') - self.assert_interpreter_for_content('ruby', '#!/usr/bin/env ruby\nfirst\nsecond') - self.assert_interpreter_for_content('ruby', '#!/usr/bin/ruby') - def test_run_command_with_bad_command(self): def run_bad_command(): Executive().run_command(["foo_bar_command_blah"], error_handler=Executive.ignore_error, return_exit_code=True) @@ -180,20 +158,6 @@ executive = Executive() executive.run_command(command_line('sleep', '0'), timeout_seconds=1000) - def _assert_windows_image_name(self, name, expected_windows_name): - executive = Executive() - windows_name = executive._windows_image_name(name) - self.assertEqual(windows_name, expected_windows_name) - - def test_windows_image_name(self): - self._assert_windows_image_name("foo", "foo.exe") - self._assert_windows_image_name("foo.exe", "foo.exe") - self._assert_windows_image_name("foo.com", "foo.com") - # If the name looks like an extension, even if it isn't - # supposed to, we have no choice but to return the original name. - self._assert_windows_image_name("foo.baz", "foo.baz") - self._assert_windows_image_name("foo.baz.exe", "foo.baz.exe") - def test_check_running_pid(self): executive = Executive() self.assertTrue(executive.check_running_pid(os.getpid()))
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/filesystem.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/filesystem.py index 7673332..63a84c7 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/filesystem.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/filesystem.py
@@ -174,8 +174,8 @@ """Create the specified directory if it doesn't already exist.""" try: os.makedirs(self.join(*path)) - except OSError as e: - if e.errno != errno.EEXIST: + except OSError as error: + if error.errno != errno.EEXIST: raise def move(self, source, destination): @@ -258,11 +258,11 @@ try: osremove(path) return True - except exceptions.WindowsError as e: + except exceptions.WindowsError: time.sleep(sleep_interval) retry_timeout_sec -= sleep_interval if retry_timeout_sec < 0: - raise e + raise def rmtree(self, path): """Delete the directory rooted at path, whether empty or not."""
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/system_host_mock.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/system_host_mock.py index 1bff4c6..fcdd1e8 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/system_host_mock.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/system_host_mock.py
@@ -37,10 +37,15 @@ class MockSystemHost(object): - def __init__(self, log_executive=False, executive_throws_when_run=None, os_name=None, - os_version=None, executive=None, filesystem=None, time_return_val=123): + def __init__(self, + log_executive=False, + os_name=None, + os_version=None, + executive=None, + filesystem=None, + time_return_val=123): self.executable = 'python' - self.executive = executive or MockExecutive(should_log=log_executive, should_throw_when_run=executive_throws_when_run) + self.executive = executive or MockExecutive(should_log=log_executive) self.filesystem = filesystem or MockFileSystem() self.user = MockUser() self.platform = MockPlatformInfo()
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/workspace.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/workspace.py index b4db25d..ffb50a0 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/workspace.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/workspace.py
@@ -67,8 +67,8 @@ # So, for now we depend on the environment having "zip" installed (likely fails on Win32) try: self._executive.run_command(['zip', '-9', '-r', zip_path, '.'], cwd=source_path) - except ScriptError as e: - _log.error("Workspace.create_zip failed in %s:\n%s", source_path, e.message_with_output()) + except ScriptError as error: + _log.error("Workspace.create_zip failed in %s:\n%s", source_path, error.message_with_output()) return None return zip_class(zip_path)
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/formatter/main_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/formatter/main_unittest.py index aab5128..65abcec 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/formatter/main_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/formatter/main_unittest.py
@@ -16,7 +16,7 @@ bar = "bar" long_list = ['this is a list of strings that should be wrapped', "and consistently quoted"] longer_list = ['this is a list of strings that should be wrapped', "and consistently quoted", "because it's important to test quoting"] - except Exception, e: + except Exception, error: pass ''' @@ -31,7 +31,7 @@ 'this is a list of strings that should be wrapped', 'and consistently quoted', "because it's important to test quoting"] - except Exception as e: + except Exception as error: pass ''' @@ -48,7 +48,7 @@ 'this is a list of strings that should be wrapped', 'and consistently quoted', "because it's important to test quoting"] - except Exception as e: + except Exception as error: pass ''' @@ -59,7 +59,7 @@ bar = "bar" long_list = ["this is a list of strings that should be wrapped", "and consistently quoted"] longer_list = ["this is a list of strings that should be wrapped", "and consistently quoted", "because it's important to test quoting"] - except Exception, e: + except Exception, error: pass '''
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/breakpad/dump_reader_win.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/breakpad/dump_reader_win.py index 2a29af4..a130a7d 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/breakpad/dump_reader_win.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/breakpad/dump_reader_win.py
@@ -124,8 +124,8 @@ '%s\\Debuggers\\x86' % win_sdk, '%s\\Debuggers\\x64' % win_sdk, ]) - except OSError as e: - if e.errno != errno.ENOENT: + except OSError as error: + if error.errno != errno.ENOENT: raise for cdb_path in possible_cdb_locations:
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_finder.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_finder.py index e0f6205..c3802e7 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_finder.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_finder.py
@@ -138,8 +138,8 @@ line = self._strip_comments(line) if line: tests.append(line) - except IOError as e: - if e.errno == errno.ENOENT: + except IOError as error: + if error.errno == errno.ENOENT: _log.critical('') _log.critical('--test-list file "%s" not found', file) raise
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_runner.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_runner.py index acabb22..0e0c7e7f 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_runner.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_runner.py
@@ -126,15 +126,15 @@ if num_workers > 0: with message_pool.get(self, self._worker_factory, num_workers, self._port.host) as pool: pool.run(('test_list', shard.name, shard.test_inputs) for shard in self._shards_to_redo) - except TestRunInterruptedException as e: - _log.warning(e.reason) + except TestRunInterruptedException as error: + _log.warning(error.reason) run_results.interrupted = True except KeyboardInterrupt: self._printer.flush() self._printer.writeln('Interrupted, exiting ...') run_results.keyboard_interrupted = True - except Exception as e: - _log.debug('%s("%s") raised, exiting', e.__class__.__name__, str(e)) + except Exception as error: + _log.debug('%s("%s") raised, exiting', error.__class__.__name__, error) raise finally: run_results.run_time = time.time() - start_time
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py index dbcc2a0c..7f38a66 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py
@@ -292,12 +292,12 @@ timestamp = time.strftime( "%Y-%m-%d-%H-%M-%S", time.localtime( self._filesystem.mtime(self._filesystem.join(self._results_directory, "results.html")))) - except (IOError, OSError) as e: + except (IOError, OSError) as error: # It might be possible that results.html was not generated in previous run, because the test # run was interrupted even before testing started. In those cases, don't archive the folder. # Simply override the current folder contents with new results. import errno - if e.errno == errno.EEXIST or e.errno == errno.ENOENT: + if error.errno in (errno.EEXIST, errno.ENOENT): self._printer.write_update("No results.html file found in previous run, skipping it.") return None archived_name = ''.join((self._filesystem.basename(self._results_directory), "_", timestamp))
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/single_test_runner.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/single_test_runner.py index 3005053..7508de9 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/single_test_runner.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/single_test_runner.py
@@ -50,8 +50,8 @@ secondary_driver, test_input, stop_when_done) try: return runner.run() - except DeviceFailure as e: - _log.error("device failed: %s", str(e)) + except DeviceFailure as error: + _log.error("device failed: %s", error) return TestResult(test_input.test_name, device_failed=True)
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/lint_test_expectations.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/lint_test_expectations.py index d3ae88c..d2074280 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/lint_test_expectations.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/lint_test_expectations.py
@@ -63,9 +63,9 @@ test_expectations.TestExpectations(port_to_lint, expectations_dict={expectations_file: expectations_dict[expectations_file]}, is_lint_mode=True) - except test_expectations.ParseError as e: + except test_expectations.ParseError as error: _log.error('') - for warning in e.warnings: + for warning in error.warnings: _log.error(warning) failures.append('%s: %s' % (expectations_file, warning)) _log.error('') @@ -143,8 +143,8 @@ exit_status = run_checks(host, options, stderr) except KeyboardInterrupt: exit_status = INTERRUPTED_EXIT_STATUS - except Exception as e: - print >> stderr, '\n%s raised: %s' % (e.__class__.__name__, str(e)) + except Exception as error: # pylint: disable=broad-except + print >> stderr, '\n%s raised: %s' % (error.__class__.__name__, error) traceback.print_exc(file=stderr) exit_status = EXCEPTIONAL_EXIT_STATUS
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/android.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/android.py index 24ebfcc..bafeaab 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/android.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/android.py
@@ -392,9 +392,9 @@ try: d._setup_test(log_safely) log_safely("device prepared", throttled=False) - except (ScriptError, driver.DeviceFailure) as e: + except (ScriptError, driver.DeviceFailure) as error: with lock: - _log.warning("[%s] failed to prepare_device: %s", serial, str(e)) + _log.warning("[%s] failed to prepare_device: %s", serial, error) except KeyboardInterrupt: if pool: pool.terminate() @@ -943,8 +943,8 @@ try: if self._start_once(pixel_tests, per_test_args): return - except ScriptError as e: - self._abort('ScriptError("%s") in _start()' % str(e)) + except ScriptError as error: + self._abort('ScriptError("%s") in _start()' % error) self._log_error('Failed to start the content_shell application. Retries=%d. Log:%s' % (retries, self._get_logcat())) self.stop()
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/android_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/android_unittest.py index f4eb155c..96d89904 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/android_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/android_unittest.py
@@ -93,6 +93,8 @@ def test_check_build(self): host = MockSystemHost() port = self.make_port(host=host, options=optparse.Values({'child_processes': 1})) + # Checking the devices is not tested in this unit test. + port._check_devices = lambda _: None host.filesystem.exists = lambda p: True port.check_build(needs_http=True, printer=port_testcase.FakePrinter())
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/base.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/base.py index 0023261..838ff12 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/base.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/base.py
@@ -411,8 +411,8 @@ """Checks whether we can use the PrettyPatch ruby script.""" try: _ = self._executive.run_command(['ruby', '--version']) - except OSError as e: - if e.errno in [errno.ENOENT, errno.EACCES, errno.ECHILD]: + except OSError as error: + if error.errno in [errno.ENOENT, errno.EACCES, errno.ECHILD]: if more_logging: _log.warning("Ruby is not installed; can't generate pretty patches.") _log.warning('') @@ -510,8 +510,8 @@ result = self._filesystem.read_binary_file(native_diff_filename) else: err_str = "Image diff returned an exit code of %s. See http://crbug.com/278596" % exit_code - except OSError as e: - err_str = 'error running image diff: %s' % str(e) + except OSError as error: + err_str = 'error running image diff: %s' % error finally: self._filesystem.rmtree(str(tempdir)) @@ -1451,14 +1451,14 @@ try: # It's possible to raise a ScriptError we pass wdiff invalid paths. return self._run_wdiff(actual_filename, expected_filename) - except OSError as e: - if e.errno in [errno.ENOENT, errno.EACCES, errno.ECHILD]: + except OSError as error: + if error.errno in (errno.ENOENT, errno.EACCES, errno.ECHILD): # Silently ignore cases where wdiff is missing. self._wdiff_available = False return "" raise - except ScriptError as e: - _log.error("Failed to run wdiff: %s", e) + except ScriptError as error: + _log.error("Failed to run wdiff: %s", error) self._wdiff_available = False return self._wdiff_error_html @@ -1476,16 +1476,16 @@ # Diffs are treated as binary (we pass decode_output=False) as they # may contain multiple files of conflicting encodings. return self._executive.run_command(command, decode_output=False) - except OSError as e: + except OSError as error: # If the system is missing ruby log the error and stop trying. self._pretty_patch_available = False - _log.error("Failed to run PrettyPatch (%s): %s", command, e) + _log.error("Failed to run PrettyPatch (%s): %s", command, error) return self._pretty_patch_error_html - except ScriptError as e: + except ScriptError as error: # If ruby failed to run for some reason, log the command # output and stop trying. self._pretty_patch_available = False - _log.error("Failed to run PrettyPatch (%s):\n%s", command, e.message_with_output()) + _log.error("Failed to run PrettyPatch (%s):\n%s", command, error.message_with_output()) return self._pretty_patch_error_html def default_configuration(self): @@ -1645,8 +1645,8 @@ try: test_suite_json = json.loads(self._filesystem.read_text_file(path_to_virtual_test_suites)) self._virtual_test_suites = [VirtualTestSuite(**d) for d in test_suite_json] - except ValueError as e: - raise ValueError("LayoutTests/VirtualTestSuites is not a valid JSON file: %s" % str(e)) + except ValueError as error: + raise ValueError("LayoutTests/VirtualTestSuites is not a valid JSON file: %s" % error) return self._virtual_test_suites def _all_virtual_tests(self, suites):
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py index cab72ad7..3ec9665 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py
@@ -145,8 +145,8 @@ test_socket = socket.socket() test_socket.connect((host, port)) self.fail() - except IOError as e: - self.assertTrue(e.errno in (errno.ECONNREFUSED, errno.ECONNRESET)) + except IOError as error: + self.assertTrue(error.errno in (errno.ECONNREFUSED, errno.ECONNRESET)) finally: test_socket.close()
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/server_process.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/server_process.py index 9767eb1..1d86668 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/server_process.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/server_process.py
@@ -272,10 +272,10 @@ select_fds = (out_fd, err_fd) try: read_fds, _, _ = select.select(select_fds, [], select_fds, max(deadline - time.time(), 0)) - except select.error as e: + except select.error as error: # We can ignore EINVAL since it's likely the process just crashed and we'll # figure that out the next time through the loop in _read(). - if e.args[0] == errno.EINVAL: + if error.args[0] == errno.EINVAL: return raise @@ -298,9 +298,9 @@ self._crashed = True self._log_data('ERR', data) self._error += data - except IOError as e: - # We can ignore the IOErrors because we will detect if the subporcess crashed - # the next time through the loop in _read() + except IOError: + # We can ignore the IOErrors because we will detect if the + # subprocess crashed the next time through the loop in _read(). pass def _wait_for_data_and_update_buffers_using_win32_apis(self, deadline): @@ -331,8 +331,8 @@ if avail > 0: _, buf = win32file.ReadFile(handle, avail, None) return buf - except Exception as e: - if e[0] not in (109, errno.ESHUTDOWN): # 109 == win32 ERROR_BROKEN_PIPE + except Exception as error: # pylint: disable=broad-except + if error[0] not in (109, errno.ESHUTDOWN): # 109 == win32 ERROR_BROKEN_PIPE raise return None
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/win.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/win.py index 202ac18..863d886 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/win.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/win.py
@@ -31,11 +31,12 @@ import errno import logging +# The _winreg library is only available on Windows. +# https://docs.python.org/2/library/_winreg.html try: - import _winreg -except ImportError as e: - _winreg = None - WindowsError = Exception # this shuts up pylint. + import _winreg # pylint: disable=import-error +except ImportError: + _winreg = None # pylint: disable=invalid-name from webkitpy.layout_tests.breakpad.dump_reader_win import DumpReaderWin from webkitpy.layout_tests.models import test_run_results @@ -120,9 +121,9 @@ # existing entry points to a valid path and has the right command line. if len(args) == 2 and self._filesystem.exists(args[0]) and args[0].endswith('perl.exe') and args[1] == '-wT': return True - except WindowsError as e: - if e.errno != errno.ENOENT: - raise e + except WindowsError as error: # WindowsError is not defined on non-Windows platforms - pylint: disable=undefined-variable + if error.errno != errno.ENOENT: + raise # The key simply probably doesn't exist. # Note that we write to HKCU so that we don't need privileged access
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py index 1f42c52f..639cdda 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py
@@ -58,9 +58,9 @@ try: port = host.port_factory.get(options.platform, options) - except (NotImplementedError, ValueError) as e: + except (NotImplementedError, ValueError) as error: # FIXME: is this the best way to handle unsupported port names? - print >> stderr, str(e) + print >> stderr, str(error) return test_run_results.UNEXPECTED_ERROR_EXIT_STATUS try: @@ -69,12 +69,12 @@ # We need to still handle KeyboardInterrupt, at least for webkitpy unittest cases. except KeyboardInterrupt: return test_run_results.INTERRUPTED_EXIT_STATUS - except test_run_results.TestRunException as e: - print >> stderr, e.msg - return e.code - except BaseException as e: - if isinstance(e, Exception): - print >> stderr, '\n%s raised: %s' % (e.__class__.__name__, str(e)) + except test_run_results.TestRunException as error: + print >> stderr, error.msg + return error.code + except BaseException as error: + if isinstance(error, Exception): + print >> stderr, '\n%s raised: %s' % (error.__class__.__name__, error) traceback.print_exc(file=stderr) return test_run_results.UNEXPECTED_ERROR_EXIT_STATUS
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/servers/server_base.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/servers/server_base.py index 988d650..5dad347 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/servers/server_base.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/servers/server_base.py
@@ -255,10 +255,10 @@ try: s.connect(('localhost', port)) _log.debug("Server running on %d", port) - except IOError as e: - if e.errno not in (errno.ECONNREFUSED, errno.ECONNRESET): + except IOError as error: + if error.errno not in (errno.ECONNREFUSED, errno.ECONNRESET): raise - _log.debug("Server NOT running on %d: %s", port, e) + _log.debug("Server NOT running on %d: %s", port, error) return False finally: s.close() @@ -272,10 +272,10 @@ port = mapping['port'] try: s.bind(('localhost', port)) - except IOError as e: - if e.errno in (errno.EALREADY, errno.EADDRINUSE): + except IOError as error: + if error.errno in (errno.EALREADY, errno.EADDRINUSE): raise ServerError('Port %d is already in use.' % port) - elif self._platform.is_win() and e.errno in (errno.WSAEACCES,): # pylint: disable=no-member + elif self._platform.is_win() and error.errno in (errno.WSAEACCES,): # pylint: disable=no-member raise ServerError('Port %d is already in use.' % port) else: raise
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/jsonchecker.py b/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/jsonchecker.py index dc254766..1693d70d 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/jsonchecker.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/jsonchecker.py
@@ -39,7 +39,9 @@ try: json.loads('\n'.join(lines) + '\n') except ValueError as error: - self._handle_style_error(self.line_number_from_json_exception(error), 'json/syntax', 5, str(error)) + self._handle_style_error( + self.line_number_from_json_exception(error), + 'json/syntax', 5, str(error)) @staticmethod def line_number_from_json_exception(error):
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/thirdparty/wpt/wpt/tools/serve/serve.py b/third_party/WebKit/Tools/Scripts/webkitpy/thirdparty/wpt/wpt/tools/serve/serve.py index 90ccbc7..211c644 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/thirdparty/wpt/wpt/tools/serve/serve.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/thirdparty/wpt/wpt/tools/serve/serve.py
@@ -275,7 +275,7 @@ domain = "%s.%s" % (punycode, host) try: urllib2.urlopen("http://%s:%d/" % (domain, port)) - except Exception as e: + except Exception as error: logger.critical("Failed probing domain %s. You may need to edit /etc/hosts or similar." % domain) sys.exit(1)
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/thirdparty/wpt/wpt/tools/wptserve/wptserve/handlers.py b/third_party/WebKit/Tools/Scripts/webkitpy/thirdparty/wpt/wpt/tools/wptserve/wptserve/handlers.py index 9cc1f73..3ded61d 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/thirdparty/wpt/wpt/tools/wptserve/wptserve/handlers.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/thirdparty/wpt/wpt/tools/wptserve/wptserve/handlers.py
@@ -120,7 +120,7 @@ if "Range" in request.headers: try: byte_ranges = RangeParser()(request.headers['Range'], file_size) - except HTTPException as e: + except HTTPException as error: if e.code == 416: response.headers.set("Content-Range", "bytes */%i" % file_size) raise
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/thirdparty/wpt/wpt/tools/wptserve/wptserve/server.py b/third_party/WebKit/Tools/Scripts/webkitpy/thirdparty/wpt/wpt/tools/wptserve/wptserve/server.py index 0ab512c..954a026 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/thirdparty/wpt/wpt/tools/wptserve/wptserve/server.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/thirdparty/wpt/wpt/tools/wptserve/wptserve/server.py
@@ -252,9 +252,9 @@ else: try: handler(request, response) - except HTTPException as e: + except HTTPException as error: response.set_error(e.code, e.message) - except Exception as e: + except Exception as error: if e.message: err = [e.message] else: @@ -281,12 +281,12 @@ # Ensure that the whole request has been read from the socket request.raw_input.read() - except socket.timeout as e: + except socket.timeout as error: self.log_error("Request timed out: %r", e) self.close_connection = True return - except Exception as e: + except Exception as error: err = traceback.format_exc() if response: response.set_error(500, err)
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/tool/bot/commit_announcer.py b/third_party/WebKit/Tools/Scripts/webkitpy/tool/bot/commit_announcer.py index f73d641..11d3982c 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/tool/bot/commit_announcer.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/tool/bot/commit_announcer.py
@@ -119,8 +119,8 @@ return False try: self.git.ensure_cleanly_tracking_remote_master() - except ScriptError as e: - _log.error('Failed to clean repository: %s', e) + except ScriptError as error: + _log.error('Failed to clean repository: %s', error) return False attempts = 1 @@ -139,9 +139,9 @@ try: self.git.pull(timeout_seconds=PULL_TIMEOUT_SECONDS) return True - except ScriptError as e: - _log.error('Error pulling from server: %s', e) - _log.error('Output: %s', e.output) + except ScriptError as error: + _log.error('Error pulling from server: %s', error) + _log.error('Output: %s', error.output) attempts += 1 _log.error('Exceeded pull attempts') _log.error('Aborting at time: %s', self._time())
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/auto_rebaseline_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/auto_rebaseline_unittest.py index ef4dcda0..72ba0f54 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/auto_rebaseline_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/auto_rebaseline_unittest.py
@@ -245,6 +245,7 @@ ['git', 'pull'], ['git', 'cl', 'land', '-f', '-v'], ['git', 'config', 'branch.auto-rebaseline-temporary-branch.rietveldissue'], + ['git', 'cl', 'set_close'], ]) # The mac ports should both be removed since they're the only ones in builders._exact_matches. @@ -349,6 +350,7 @@ ['git', 'pull'], ['git', 'cl', 'land', '-f', '-v'], ['git', 'config', 'branch.auto-rebaseline-temporary-branch.rietveldissue'], + ['git', 'cl', 'set_close'], ]) # The mac ports should both be removed since they're the only ones in builders._exact_matches. @@ -400,6 +402,7 @@ ['git', 'pull'], ['git', 'cl', 'land', '-f', '-v'], ['git', 'config', 'branch.auto-rebaseline-alt-temporary-branch.rietveldissue'], + ['git', 'cl', 'set_close'], ]) self.assertEqual(self.tool.filesystem.read_text_file(test_port.path_to_generic_test_expectations_file()), """ @@ -452,6 +455,7 @@ ['git', 'pull'], ['git', 'cl', 'land', '-f', '-v'], ['git', 'config', 'branch.auto-rebaseline-temporary-branch.rietveldissue'], + ['git', 'cl', 'set_close'], ]) self.assertEqual(self.tool.filesystem.read_text_file(test_port.path_to_generic_test_expectations_file()), """ @@ -515,6 +519,7 @@ ['git', 'pull'], ['git', 'cl', 'land', '-f', '-v', '--auth-refresh-token-json', rietveld_refresh_token], ['git', 'config', 'branch.auto-rebaseline-temporary-branch.rietveldissue'], + ['git', 'cl', 'set_close', '--auth-refresh-token-json', rietveld_refresh_token], ], auth_refresh_token_json=rietveld_refresh_token)
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/pretty_diff.py b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/pretty_diff.py index 5293ccb..e6e53a8 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/pretty_diff.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/pretty_diff.py
@@ -73,10 +73,10 @@ # We return the pretty_diff_file here because we need to keep the # file alive until the user has had a chance to confirm the diff. return pretty_diff_file - except ScriptError as e: + except ScriptError as error: _log.warning("PrettyPatch failed. :(") - _log.error(e.message_with_output()) - self._exit(e.exit_code or 2) + _log.error(error.message_with_output()) + self._exit(error.exit_code or 2) except OSError: _log.warning("PrettyPatch unavailable.")
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/chromium_commit_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/chromium_commit_unittest.py index 2304b452..63d3aae 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/chromium_commit_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/chromium_commit_unittest.py
@@ -6,9 +6,10 @@ from webkitpy.common.host_mock import MockHost from webkitpy.common.system.executive_mock import MockExecutive2 from webkitpy.w3c.chromium_commit import ChromiumCommit -from webkitpy.w3c.test_exporter import CHROMIUM_WPT_DIR from webkitpy.w3c.test_exporter_unittest import mock_command_exec +CHROMIUM_WPT_DIR = 'third_party/WebKit/LayoutTests/imported/wpt/' + class ChromiumCommitTest(unittest.TestCase):
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/local_wpt.py b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/local_wpt.py index d7217c0..cec54e9 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/local_wpt.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/local_wpt.py
@@ -6,6 +6,7 @@ import logging +from webkitpy.common.system.executive import ScriptError from webkitpy.w3c.chromium_commit import ChromiumCommit WPT_REPO_URL = 'https://chromium.googlesource.com/external/w3c/web-platform-tests.git' @@ -107,6 +108,31 @@ return branch_name + def test_patch(self, patch): + """Returns the expected output of a patch against origin/master. + + Args: + patch: The patch to test against. + + Returns: + A string containing the diff the patch produced. + """ + self.clean() + + # Remove Chromium WPT directory prefix. + patch = patch.replace(CHROMIUM_WPT_DIR, '') + + try: + self.run(['git', 'apply', '-'], input=patch) + self.run(['git', 'add', '.']) + output = self.run(['git', 'diff', 'origin/master']) + except ScriptError as error: + _log.error('Error while applying patch: %s', error) + output = '' + + self.clean() + return output + def commits_behind_master(self, commit): """Returns the number of commits after the given commit on origin/master.
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_exporter.py b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_exporter.py index 4700f29..2124534 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_exporter.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_exporter.py
@@ -6,10 +6,8 @@ from webkitpy.w3c.local_wpt import LocalWPT from webkitpy.w3c.chromium_commit import ChromiumCommit -from webkitpy.w3c.deps_updater import DepsUpdater _log = logging.getLogger(__name__) - CHROMIUM_WPT_DIR = 'third_party/WebKit/LayoutTests/imported/wpt/' @@ -18,6 +16,7 @@ def __init__(self, host, wpt_github, dry_run=False): self.host = host self.wpt_github = wpt_github + self.local_wpt = LocalWPT(self.host) self.dry_run = dry_run def run(self): @@ -46,15 +45,14 @@ # Second, look for exportable commits in Chromium # At this point, no in-flight PRs should exist # If there was an issue merging, it should have errored out - local_wpt = LocalWPT(self.host, use_github=False) # TODO(jeffcarp): have the script running this fetch Chromium origin/master # TODO(jeffcarp): move WPT fetch out of its constructor to match planned ChromiumWPT pattern - wpt_commit, chromium_commit = local_wpt.most_recent_chromium_commit() + wpt_commit, chromium_commit = self.local_wpt.most_recent_chromium_commit() assert chromium_commit, 'No Chromium commit found, this is impossible' - wpt_behind_master = local_wpt.commits_behind_master(wpt_commit) + wpt_behind_master = self.local_wpt.commits_behind_master(wpt_commit) _log.info('\nLast Chromium export commit in web-platform-tests:') _log.info('web-platform-tests@%s', wpt_commit) @@ -91,7 +89,7 @@ _log.info(patch) return - local_branch_name = local_wpt.create_branch_with_patch(message, patch) + local_branch_name = self.local_wpt.create_branch_with_patch(message, patch) response_data = self.wpt_github.create_pr( local_branch_name=local_branch_name, @@ -118,21 +116,12 @@ chromium_commits = [ChromiumCommit(self.host, sha=c) for c in commits] def is_exportable(chromium_commit): - message = chromium_commit.message() + patch = chromium_commit.format_patch() return ( - 'NOEXPORT=true' not in message - and not message.startswith('Import ') - # TODO(jeffcarp): change this to allow any commit with - # any non-expectation changes to be exportable - and not self._has_expectations(chromium_commit) + patch + and self.local_wpt.test_patch(patch) + and 'NOEXPORT=true' not in chromium_commit.message() + and not chromium_commit.message().startswith('Import ') ) - return filter(is_exportable, chromium_commits) - - def _has_expectations(self, chromium_commit): - files = self.host.executive.run_command([ - 'git', 'diff-tree', '--no-commit-id', - '--name-only', '-r', chromium_commit.sha - ]).splitlines() - - return any(DepsUpdater.is_baseline(f) for f in files) + return [c for c in chromium_commits if is_exportable(c)]
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_exporter_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_exporter_unittest.py index 9d5640d..00e0e11 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_exporter_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_exporter_unittest.py
@@ -60,18 +60,16 @@ host = MockHost() def mock_command(args): - git_command = args[1] - if git_command == 'rev-list': - return 'facebeef\ncafedad5' - elif git_command == 'footers': - return 'fake-cr-position' - elif git_command == 'show': - if 'cafedad5' in args: - return 'newer fake text' - elif 'facebeef' in args: - return 'older fake text' - else: - return '' + canned_git_outputs = { + 'show': 'newer fake text' if 'cafedad5' in args else 'older fake text', + 'rev-list': 'facebeef\ncafedad5', + 'footers': 'fake-cr-position', + 'remote': 'github', + 'format-patch': 'fake patch', + 'diff': 'fake patch diff', + 'diff-tree': 'fake\n\files\nchanged', + } + return canned_git_outputs.get(args[1], '') host.executive = MockExecutive2(run_command_fn=mock_command) wpt_github = MockWPTGitHub(pull_requests=[]) @@ -99,10 +97,24 @@ self.assertEqual(len(commits), 1) self.assertIsInstance(commits[0], ChromiumCommit) self.assertEqual(self.host.executive.calls, [ + ['git', 'clone', 'https://chromium.googlesource.com/external/w3c/web-platform-tests.git', '/tmp/wpt'], ['git', 'rev-parse', '--show-toplevel'], - ['git', 'rev-list', 'beefcafe..HEAD', '--reverse', '--', 'badbeef8/third_party/WebKit/LayoutTests/imported/wpt/'], + ['git', 'rev-list', 'beefcafe..HEAD', '--reverse', '--', + 'badbeef8/third_party/WebKit/LayoutTests/imported/wpt/'], + ['git', 'diff-tree', '--name-only', '--no-commit-id', '-r', + 'badbeef8', '--', '/mock-checkout/third_party/WebKit/LayoutTests/imported/wpt'], + ['git', 'format-patch', '-1', '--stdout', 'badbeef8', '--', 'some', 'files'], + ['git', 'reset', '--hard', 'HEAD'], + ['git', 'clean', '-fdx'], + ['git', 'checkout', 'origin/master'], + ['git', 'apply', '-'], + ['git', 'add', '.'], + ['git', 'diff', 'origin/master'], + ['git', 'reset', '--hard', 'HEAD'], + ['git', 'clean', '-fdx'], + ['git', 'checkout', 'origin/master'], ['git', 'show', '--format=%B', '--no-patch', 'badbeef8'], - ['git', 'diff-tree', '--no-commit-id', '--name-only', '-r', 'badbeef8']]) + ['git', 'show', '--format=%B', '--no-patch', 'badbeef8']]) def test_ignores_commits_with_noexport_true(self): self.host.executive = mock_command_exec({ @@ -116,9 +128,12 @@ commits = test_exporter.exportable_commits_since('beefcafe') self.assertEqual(len(commits), 0) self.assertEqual(self.host.executive.calls, [ + ['git', 'clone', 'https://chromium.googlesource.com/external/w3c/web-platform-tests.git', '/tmp/wpt'], ['git', 'rev-parse', '--show-toplevel'], - ['git', 'rev-list', 'beefcafe..HEAD', '--reverse', '--', 'badbeef8/third_party/WebKit/LayoutTests/imported/wpt/'], - ['git', 'show', '--format=%B', '--no-patch', 'badbeef8']]) + ['git', 'rev-list', 'beefcafe..HEAD', '--reverse', '--', + 'badbeef8/third_party/WebKit/LayoutTests/imported/wpt/'], + ['git', 'diff-tree', '--name-only', '--no-commit-id', '-r', 'badbeef8', '--', + '/mock-checkout/third_party/WebKit/LayoutTests/imported/wpt']]) def test_ignores_reverted_commits_with_noexport_true(self): self.host.executive = mock_command_exec({ @@ -133,9 +148,12 @@ commits = test_exporter.exportable_commits_since('beefcafe') self.assertEqual(len(commits), 0) self.assertEqual(self.host.executive.calls, [ + ['git', 'clone', 'https://chromium.googlesource.com/external/w3c/web-platform-tests.git', '/tmp/wpt'], ['git', 'rev-parse', '--show-toplevel'], - ['git', 'rev-list', 'beefcafe..HEAD', '--reverse', '--', 'badbeef8/third_party/WebKit/LayoutTests/imported/wpt/'], - ['git', 'show', '--format=%B', '--no-patch', 'badbeef8']]) + ['git', 'rev-list', 'beefcafe..HEAD', '--reverse', '--', + 'badbeef8/third_party/WebKit/LayoutTests/imported/wpt/'], + ['git', 'diff-tree', '--name-only', '--no-commit-id', '-r', 'badbeef8', '--', + '/mock-checkout/third_party/WebKit/LayoutTests/imported/wpt']]) def test_ignores_commits_that_start_with_import(self): self.host.executive = mock_command_exec({ @@ -150,6 +168,9 @@ commits = test_exporter.exportable_commits_since('beefcafe') self.assertEqual(len(commits), 0) self.assertEqual(self.host.executive.calls, [ + ['git', 'clone', 'https://chromium.googlesource.com/external/w3c/web-platform-tests.git', '/tmp/wpt'], ['git', 'rev-parse', '--show-toplevel'], - ['git', 'rev-list', 'beefcafe..HEAD', '--reverse', '--', 'badbeef8/third_party/WebKit/LayoutTests/imported/wpt/'], - ['git', 'show', '--format=%B', '--no-patch', 'badbeef8']]) + ['git', 'rev-list', 'beefcafe..HEAD', '--reverse', '--', + 'badbeef8/third_party/WebKit/LayoutTests/imported/wpt/'], + ['git', 'diff-tree', '--name-only', '--no-commit-id', '-r', 'badbeef8', '--', + '/mock-checkout/third_party/WebKit/LayoutTests/imported/wpt']])
diff --git a/tools/clang-format-js b/tools/clang-format-js index d09925d..4b04d8dc 100755 --- a/tools/clang-format-js +++ b/tools/clang-format-js
@@ -16,6 +16,9 @@ for arg in "${@}"; do dir=`readlink -f "${arg}"` + if [[ -d "${dir}" ]]; then + dir="${dir}/stripped-by-dirname-on-next-line" + fi while dir=`dirname ${dir}`; do if [[ -f "${dir}/.clang-format" ]]; then echo "Using style from: ${dir}/.clang-format";
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index 9ea96f3..565e6e6 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml
@@ -9236,6 +9236,30 @@ </summary> </histogram> +<histogram name="DataReductionProxy.UserViewedOriginalSize" units="KB"> + <owner>tbansal@chromium.org</owner> + <summary> + The total original content size displayed to the user. Computed over the + last 30 days. Recorded when the user views the data savings in the UI. + </summary> +</histogram> + +<histogram name="DataReductionProxy.UserViewedSavingsPercent" units="%"> + <owner>tbansal@chromium.org</owner> + <summary> + The percentage of data savings displayed to users. Computed over the last 30 + days. Recorded when the user views the data savings in the UI. + </summary> +</histogram> + +<histogram name="DataReductionProxy.UserViewedSavingsSize" units="KB"> + <owner>tbansal@chromium.org</owner> + <summary> + The total data saved displayed to the user. Computed over the last 30 days. + Recorded when the user views the data savings in the UI. + </summary> +</histogram> + <histogram name="DataReductionProxy.WarmupURL.FetchInitiated" units="count"> <owner>tbansal@chromium.org</owner> <summary> @@ -30755,6 +30779,9 @@ <histogram name="Net.DailyUserVisibleSavingsPercent_DataReductionProxyEnabled" units="%"> + <obsolete> + Removed in Chrome 57. + </obsolete> <owner>kundaji@chromium.org</owner> <owner>bengr@chromium.org</owner> <summary> @@ -30766,6 +30793,9 @@ <histogram name="Net.DailyUserVisibleSavingsSize_DataReductionProxyEnabled" units="KB"> + <obsolete> + Removed in Chrome 57. + </obsolete> <owner>kundaji@chromium.org</owner> <owner>bengr@chromium.org</owner> <summary>
diff --git a/tools/origin_trials/generate_token.py b/tools/origin_trials/generate_token.py index a79f169..76ae3b4f 100755 --- a/tools/origin_trials/generate_token.py +++ b/tools/origin_trials/generate_token.py
@@ -20,6 +20,7 @@ import re import os import struct +import subprocess import sys import time import urlparse @@ -39,6 +40,9 @@ # Default key file, relative to script_dir. DEFAULT_KEY_FILE = 'eftest.key' +# Default location of validate subdomain utility, relative to script_dir. +DEFAULT_TARGET_PATH = '../../out/Default/' + def HostnameFromArg(arg): """Determines whether a string represents a valid hostname. @@ -86,6 +90,28 @@ return int(args.expire_timestamp) return (int(time.time()) + (int(args.expire_days) * 86400)) +def ValidateSubdomainTokenOrigin(origin, target_path): + """ Calls validate_subdomain_origin utility to check the origin + + If the utility is not found, prints a warning for manual validation, and + returns True + """ + utility_path = "%s/validate_subdomain_origin" % target_path + if not os.path.exists(utility_path): + print "WARNING!" + print "Origin not validated for use in subdomain token" + print " (missing '%s' utility)" % utility_path + print "Must manually check origin against the Public Suffix List" + print + return True + + rc = subprocess.call([utility_path, "--quiet", origin]) + if (rc < 0 or rc > 4): + print("Unexpected return code from %s: %d" % (utility_path, rc)) + sys.exit(1) + + return rc == 0 + def GenerateTokenData(origin, is_subdomain, feature_name, expiry): data = {"origin": origin, "feature": feature_name, @@ -106,6 +132,7 @@ def main(): default_key_file_absolute = os.path.join(script_dir, DEFAULT_KEY_FILE) + default_target_path_absolute = os.path.join(script_dir, DEFAULT_TARGET_PATH) parser = argparse.ArgumentParser( description="Generate tokens for enabling experimental features") @@ -145,6 +172,11 @@ "00:00:00 UTC) when the token should expire", type=int) + parser.add_argument("--target", + help="Path to the output directory for compiled " + "resources", + default=default_target_path_absolute) + args = parser.parse_args() expiry = ExpiryFromArgs(args) @@ -159,6 +191,13 @@ print("Unable to use the specified private key file.") sys.exit(1) + # For subdomain tokens, validate that the origin is allowed + if args.is_subdomain: + target_path = os.path.expanduser(args.target) + if not ValidateSubdomainTokenOrigin(args.origin, target_path): + print "The specified origin is not valid for use in a subdomain token." + sys.exit(1) + token_data = GenerateTokenData(args.origin, args.is_subdomain, args.trial_name, expiry) data_to_sign = GenerateDataToSign(VERSION, token_data)
diff --git a/tools/origin_trials/validate_subdomain_origin/BUILD.gn b/tools/origin_trials/validate_subdomain_origin/BUILD.gn new file mode 100644 index 0000000..d28b3ae --- /dev/null +++ b/tools/origin_trials/validate_subdomain_origin/BUILD.gn
@@ -0,0 +1,20 @@ +# Copyright 2016 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. + +if (current_toolchain == host_toolchain) { + executable("validate_subdomain_origin") { + output_name = "validate_subdomain_origin" + sources = [ + "validate_subdomain_origin.cc", + ] + + configs += [ "//build/config/compiler:wexit_time_destructors" ] + + deps = [ + "//base", + "//net", + "//url", + ] + } +}
diff --git a/tools/origin_trials/validate_subdomain_origin/DEPS b/tools/origin_trials/validate_subdomain_origin/DEPS new file mode 100644 index 0000000..631b5ad3 --- /dev/null +++ b/tools/origin_trials/validate_subdomain_origin/DEPS
@@ -0,0 +1,3 @@ +include_rules = [ + '+net/base' +]
diff --git a/tools/origin_trials/validate_subdomain_origin/test_validate.py b/tools/origin_trials/validate_subdomain_origin/test_validate.py new file mode 100755 index 0000000..c2ff5f2 --- /dev/null +++ b/tools/origin_trials/validate_subdomain_origin/test_validate.py
@@ -0,0 +1,100 @@ +#!/usr/bin/env python +# Copyright (c) 2016 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. + +"""Tests for the validate_subdomain_origin utility + +usage: test_validate.py [-h] [--utility-path UTILITY_PATH] + +""" +import argparse +import os +import subprocess +import sys + +script_dir = os.path.dirname(os.path.realpath(__file__)) + +STATUS_VALID = 0 +STATUS_INVALID_ORIGIN = 1 +STATUS_IN_PUBLIC_SUFFIX_LIST = 2 +STATUS_ERROR = 3 +STATUS_IP_ADDRESS = 4 + +TestOrigins = { + 'https//': STATUS_INVALID_ORIGIN, + 'https://example.com:xx': STATUS_INVALID_ORIGIN, + 'https://google.com': STATUS_VALID, + 'google.com': STATUS_VALID, + 'http://10.0.0.1': STATUS_IP_ADDRESS, + '10.0.0.1': STATUS_IP_ADDRESS, + 'https://com': STATUS_IN_PUBLIC_SUFFIX_LIST, + 'https://com:443': STATUS_IN_PUBLIC_SUFFIX_LIST, + 'com': STATUS_IN_PUBLIC_SUFFIX_LIST, + 'co.uk': STATUS_IN_PUBLIC_SUFFIX_LIST, + 'github.io': STATUS_IN_PUBLIC_SUFFIX_LIST, + 'githubusercontent.com': STATUS_IN_PUBLIC_SUFFIX_LIST, + 'https://adsf': STATUS_VALID, + 'adsf': STATUS_VALID, +} + +# Default utility path, relative to script_dir. +# - Assumes utility is compiled to standard output directory, e.g. +# <chromium dir>/src/out/Default +DEFAULT_UTILITY_PATH = '../../../out/Default/validate_subdomain_origin' + +def main(): + default_utility_path = os.path.join(script_dir, DEFAULT_UTILITY_PATH) + + parser = argparse.ArgumentParser( + description="Test the validate_subdomain_origin utility") + parser.add_argument("--utility-path", + help="Path to the compiled utility", + default=default_utility_path) + + args = parser.parse_args() + + utility_path = os.path.expanduser(args.utility_path) + if not os.path.exists(utility_path): + print "ERROR" + print "Utility not found at: %s" % utility_path + print + sys.exit(1) + + print "Using compiled utility found at: %s" % utility_path + print + + failed_tests = 0 + + # Test handling of number of arguments + no_args_rc = subprocess.call(utility_path) + if no_args_rc != STATUS_ERROR: + failed_tests += 1 + print "Test failed for no arguments: expected %d, actual %d" % ( + STATUS_ERROR, no_args_rc) + + too_many_args_rc = subprocess.call([utility_path, "first", "second"]) + if too_many_args_rc != STATUS_ERROR: + failed_tests += 1 + print "Test failed for 2 arguments: expected %d, actual %d" % ( + STATUS_ERROR, too_many_args_rc) + + # Test validation of various origins, and formats + for origin, expected_result in TestOrigins.items(): + rc = subprocess.call([utility_path, origin]) + if rc != expected_result: + failed_tests += 1 + print "Test failed for '%s': expected %d, actual %d" % ( + origin, expected_result, rc) + print + continue + + if failed_tests > 0: + print "Failed %d tests" % failed_tests + print + sys.exit(1) + + print "All tests passed" + +if __name__ == "__main__": + main()
diff --git a/tools/origin_trials/validate_subdomain_origin/validate_subdomain_origin.cc b/tools/origin_trials/validate_subdomain_origin/validate_subdomain_origin.cc new file mode 100644 index 0000000..7139b92 --- /dev/null +++ b/tools/origin_trials/validate_subdomain_origin/validate_subdomain_origin.cc
@@ -0,0 +1,173 @@ +// Copyright (c) 2016 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. + +#include <stddef.h> +#include <stdint.h> + +#include <iostream> +#include <string> + +#include "base/command_line.h" +#include "base/memory/ptr_util.h" +#include "base/strings/string_piece.h" +#include "base/strings/utf_string_conversions.h" +#include "net/base/registry_controlled_domains/registry_controlled_domain.h" +#include "net/base/url_util.h" +#include "url/gurl.h" + +using net::registry_controlled_domains::GetCanonicalHostRegistryLength; +using net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES; +using net::registry_controlled_domains::EXCLUDE_UNKNOWN_REGISTRIES; +using net::registry_controlled_domains::INCLUDE_UNKNOWN_REGISTRIES; + +// Return codes used by this utility. +static const int kStatusValid = 0; +static const int kStatusInvalidOrigin = 1; +static const int kStatusInPublicSuffixList = 2; +static const int kStatusError = 3; +static const int kStatusIPAddress = 4; + +// Causes the app to suppress logging/verbose output +static const char kOptionQuiet[] = "quiet"; + +void PrintHelp() { + std::cerr + << "Usage:\n" + " validate_subdomain_origin [--quiet] <origin>\n" + " Checks that the origin can be used in a token that matches\n" + " subdomains, returning 0 when the origin is valid for such use.\n" + " The origin may be specified as an url (e.g. " + "'https://example.com'),\n" + " or as bare hostname (e.g. 'example.com').\n" + " The caller is responsible for ensuring that a well-formed " + "origin\n" + " is provided, there are no checks for correctness.\n" + " Pass \"--quiet\" to suppress any output.\n"; +} + +void PrintValidHost(const base::StringPiece origin) { + std::cout << "validate_subdomain_origin: Valid origin - " << origin + << std::endl; +} + +void PrintIPAddressNotSupported(const base::StringPiece origin) { + std::cout << "validate_subdomain_origin: Origin is an IP address - " + << origin << std::endl; +} + +void PrintInvalidUrl(const base::StringPiece origin) { + std::cout << "validate_subdomain_origin: Invalid url format for origin - " + << origin << std::endl; +} + +void PrintInvalidOrigin(const base::StringPiece origin) { + std::cout << "validate_subdomain_origin: Invalid origin - " << origin + << std::endl; +} + +void PrintInPublicSuffixList(const base::StringPiece origin) { + std::cout << "validate_subdomain_origin: Origin in Public Suffix List - " + << origin << std::endl; +} + +int CheckOrigin(const base::StringPiece origin, bool verbose) { + base::StringPiece host; + std::unique_ptr<std::string> canon_host = nullptr; + + // Validate the origin, which may be provided as an url (with scheme prefix), + // or just as a hostname. Regardless of format, if the origin is identified + // as an IP address, that is valid for subdomain tokens. + GURL gurl(origin); + if (gurl.is_valid()) { + if (gurl.HostIsIPAddress()) { + if (verbose) { + PrintIPAddressNotSupported(origin); + } + return kStatusIPAddress; + } + host = gurl.host_piece(); + } else { + // Doesn't look like an url, try the origin as a hostname + url::CanonHostInfo host_info; + canon_host = base::MakeUnique<std::string>( + net::CanonicalizeHost(origin, &host_info)); + if (canon_host->empty()) { + if (verbose) { + PrintInvalidOrigin(origin); + } + return kStatusInvalidOrigin; + } + if (host_info.IsIPAddress()) { + if (verbose) { + PrintIPAddressNotSupported(origin); + } + return kStatusIPAddress; + } + host.set(canon_host->c_str()); + } + + size_t registry_length = GetCanonicalHostRegistryLength( + host, INCLUDE_UNKNOWN_REGISTRIES, INCLUDE_PRIVATE_REGISTRIES); + + if (registry_length > 0) { + // Host has at least one subcomponent (e.g. a.b), and the host is not just + // a registry (e.g. co.uk). + if (verbose) { + PrintValidHost(origin); + } + return kStatusValid; + } + + // If registry length is 0, then the host may be a registry, or it has no + // subcomponents. If there are subcomponents, the host must be a registry, + // which makes it invalid. + if (host.find('.') != std::string::npos) { + if (verbose) { + PrintInPublicSuffixList(origin); + } + return kStatusInPublicSuffixList; + } + + // There are no subcomponents, but still don't know if this a registry + // (e.g. host = "com"), or a private/internal address (e.g. host = "bar"). + // Test by adding a subcomponent, and re-checking the registry. In this case, + // exclude unknown registries. That means that "prefix.com" will match the + // "com" registry, and return a non-zero length. Conversely, "prefix.bar" will + // not match any known registry, and return a zero length. + std::string test_host("prefix."); + test_host.append(host.as_string()); + + size_t test_registry_length = GetCanonicalHostRegistryLength( + test_host, EXCLUDE_UNKNOWN_REGISTRIES, INCLUDE_PRIVATE_REGISTRIES); + if (test_registry_length > 0) { + if (verbose) { + PrintInPublicSuffixList(origin); + } + return kStatusInPublicSuffixList; + } + + if (verbose) { + PrintValidHost(origin); + } + return kStatusValid; +} + +int main(int argc, const char* argv[]) { + base::CommandLine::Init(argc, argv); + const base::CommandLine& parsed_command_line = + *base::CommandLine::ForCurrentProcess(); + const base::CommandLine::StringVector& args = parsed_command_line.GetArgs(); + bool quiet = parsed_command_line.HasSwitch(kOptionQuiet); + if (args.size() == 1) { +#if defined(OS_WIN) + std::string origin = base::UTF16ToUTF8(args[0]); + return CheckOrigin(origin, !quiet); +#else + return CheckOrigin(args[0], !quiet); +#endif + } + + PrintHelp(); + return kStatusError; +}
diff --git a/ui/gfx/blit_unittest.cc b/ui/gfx/blit_unittest.cc index 50e7952..2bce0dc 100644 --- a/ui/gfx/blit_unittest.cc +++ b/ui/gfx/blit_unittest.cc
@@ -152,9 +152,10 @@ base::SharedMemory shared_mem; ASSERT_TRUE(shared_mem.CreateAnonymous(kCanvasWidth * kCanvasHeight)); base::SharedMemoryHandle section = shared_mem.handle(); - std::unique_ptr<SkCanvas> canvas = skia::CreatePlatformCanvas( - kCanvasWidth, kCanvasHeight, true, section.GetHandle(), - skia::RETURN_NULL_ON_FAILURE); + std::unique_ptr<SkCanvas> canvas = + skia::CreatePlatformCanvasWithSharedSection(kCanvasWidth, kCanvasHeight, + true, section.GetHandle(), + skia::RETURN_NULL_ON_FAILURE); ASSERT_TRUE(canvas); shared_mem.Close();
diff --git a/ui/strings/ui_strings.grd b/ui/strings/ui_strings.grd index 1b7bceb..522e2ba 100644 --- a/ui/strings/ui_strings.grd +++ b/ui/strings/ui_strings.grd
@@ -656,6 +656,11 @@ <message name="IDS_APP_LIST_SPEECH_NETWORK_ERROR_HINT_TEXT" desc="The text label in the speech recognition UI to show the speech recognition can't start because of network error."> No internet connection </message> + + <!-- Strings describing the touch calibration UX --> + <message name="IDS_DISPLAY_TOUCH_CALIBRATION_EXIT_LABEL" desc="A message to notify the user about using the escape key to exit the calibration mode."> + To exit calibration press Esc. + </message> <!-- Display names --> <message name="IDS_DISPLAY_NAME_UNKNOWN" desc="The name used for a display whose name is unknown, which is shown in the display settings and ash tray.">
diff --git a/ui/surface/transport_dib_posix.cc b/ui/surface/transport_dib_posix.cc index 8beba1f..5f68581 100644 --- a/ui/surface/transport_dib_posix.cc +++ b/ui/surface/transport_dib_posix.cc
@@ -63,9 +63,9 @@ bool opaque) { if ((!memory() && !Map()) || !VerifyCanvasSize(w, h)) return NULL; - return skia::CreatePlatformCanvas(w, h, opaque, - reinterpret_cast<uint8_t*>(memory()), - skia::RETURN_NULL_ON_FAILURE); + return skia::CreatePlatformCanvasWithPixels( + w, h, opaque, reinterpret_cast<uint8_t*>(memory()), + skia::RETURN_NULL_ON_FAILURE); } bool TransportDIB::Map() {
diff --git a/ui/surface/transport_dib_win.cc b/ui/surface/transport_dib_win.cc index 61f5a1b..f845480 100644 --- a/ui/surface/transport_dib_win.cc +++ b/ui/surface/transport_dib_win.cc
@@ -68,9 +68,10 @@ // We can't check the canvas size before mapping, but it's safe because // Windows will fail to map the section if the dimensions of the canvas // are too large. - std::unique_ptr<SkCanvas> canvas = skia::CreatePlatformCanvas( - w, h, opaque, shared_memory_.handle().GetHandle(), - skia::RETURN_NULL_ON_FAILURE); + std::unique_ptr<SkCanvas> canvas = + skia::CreatePlatformCanvasWithSharedSection( + w, h, opaque, shared_memory_.handle().GetHandle(), + skia::RETURN_NULL_ON_FAILURE); // Calculate the size for the memory region backing the canvas. if (canvas)
diff --git a/ui/views/view.cc b/ui/views/view.cc index 9222315..79ba97a7 100644 --- a/ui/views/view.cc +++ b/ui/views/view.cc
@@ -11,6 +11,7 @@ #include <memory> #include <utility> +#include "base/containers/adapters.h" #include "base/logging.h" #include "base/macros.h" #include "base/memory/ptr_util.h" @@ -89,6 +90,28 @@ return root; } +#if DCHECK_IS_ON() + class ScopedChildrenLock { + public: + explicit ScopedChildrenLock(const View* view) : view_(view) { + DCHECK(!view->iterating_); + view->iterating_ = true; + } + + ~ScopedChildrenLock() { view_->iterating_ = false; } + + private: + const View* view_; + DISALLOW_COPY_AND_ASSIGN(ScopedChildrenLock); + }; +#else + class ScopedChildrenLock { + public: + explicit ScopedChildrenLock(const View* view) {} + ~ScopedChildrenLock() {} + }; +#endif + } // namespace // static @@ -104,6 +127,9 @@ id_(0), group_(-1), parent_(NULL), +#if DCHECK_IS_ON() + iterating_(false), +#endif visible_(true), enabled_(true), notify_enter_exit_on_child_(false), @@ -129,10 +155,13 @@ ViewStorage::GetInstance()->ViewRemoved(this); - for (Views::const_iterator i(children_.begin()); i != children_.end(); ++i) { - (*i)->parent_ = NULL; - if (!(*i)->owned_by_client_) - delete *i; + { + ScopedChildrenLock(this); + for (auto* child : children_) { + child->parent_ = NULL; + if (!child->owned_by_client_) + delete child; + } } // Release ownership of the native accessibility object, but it's @@ -179,6 +208,9 @@ InitFocusSiblings(view, index); view->parent_ = this; +#if DCHECK_IS_ON() + DCHECK(!iterating_); +#endif children_.insert(children_.begin() + index, view); // Ensure the layer tree matches the view tree before calling to any client @@ -237,6 +269,9 @@ const Views::iterator i(std::find(children_.begin(), children_.end(), view)); DCHECK(i != children_.end()); +#if DCHECK_IS_ON() + DCHECK(!iterating_); +#endif children_.erase(i); // Unlink the view first @@ -554,8 +589,8 @@ // weren't changed by the layout manager. If there is no layout manager, we // just propagate the Layout() call down the hierarchy, so whoever receives // the call can take appropriate action. - for (int i = 0, count = child_count(); i < count; ++i) { - View* child = child_at(i); + ScopedChildrenLock(this); + for (auto* child : children_) { if (child->needs_layout_ || !layout_manager_.get()) { TRACE_EVENT1("views", "View::Layout", "class", child->GetClassName()); child->needs_layout_ = false; @@ -621,8 +656,9 @@ if (id == id_) return const_cast<View*>(this); - for (int i = 0, count = child_count(); i < count; ++i) { - const View* view = child_at(i)->GetViewByID(id); + ScopedChildrenLock(this); + for (auto* child : children_) { + const View* view = child->GetViewByID(id); if (view) return view; } @@ -651,8 +687,9 @@ if (group_ == group) views->push_back(this); - for (int i = 0, count = child_count(); i < count; ++i) - child_at(i)->GetViewsInGroup(group, views); + ScopedChildrenLock(this); + for (auto* child : children_) + child->GetViewsInGroup(group, views); } View* View::GetSelectedViewForGroup(int group) { @@ -917,8 +954,7 @@ // Walk the child Views recursively looking for the View that most // tightly encloses the specified point. - for (int i = child_count() - 1; i >= 0; --i) { - View* child = child_at(i); + for (auto* child : base::Reversed(children_)) { if (!child->visible()) continue; @@ -1437,9 +1473,11 @@ void View::PaintChildren(const ui::PaintContext& context) { TRACE_EVENT1("views", "View::PaintChildren", "class", GetClassName()); - for (int i = 0, count = child_count(); i < count; ++i) - if (!child_at(i)->layer()) - child_at(i)->Paint(context); + ScopedChildrenLock(this); + for (auto* child : children_) { + if (!child->layer()) + child->Paint(context); + } } void View::OnPaint(gfx::Canvas* canvas) { @@ -1505,8 +1543,9 @@ SetLayerBounds(gfx::Rect(local_point.x(), local_point.y(), width(), height())); } else { - for (int i = 0, count = child_count(); i < count; ++i) - child_at(i)->MoveLayerToParent(parent_layer, local_point); + ScopedChildrenLock(this); + for (auto* child : children_) + child->MoveLayerToParent(parent_layer, local_point); } } @@ -1522,8 +1561,9 @@ if (layer()) { layer()->SetVisible(ancestor_visible && visible_); } else { - for (int i = 0, count = child_count(); i < count; ++i) - child_at(i)->UpdateChildLayerVisibility(ancestor_visible && visible_); + ScopedChildrenLock(this); + for (auto* child : children_) + child->UpdateChildLayerVisibility(ancestor_visible && visible_); } } @@ -1531,8 +1571,8 @@ if (layer()) { SetLayerBounds(GetLocalBounds() + offset); } else { - for (int i = 0, count = child_count(); i < count; ++i) { - View* child = child_at(i); + ScopedChildrenLock(this); + for (auto* child : children_) { child->UpdateChildLayerBounds( offset + gfx::Vector2d(child->GetMirroredX(), child->y())); } @@ -1588,9 +1628,9 @@ // Iterate backwards through the children so that a child with a layer // which is further to the back is stacked above one which is further to // the front. - for (Views::reverse_iterator it(children_.rbegin()); - it != children_.rend(); ++it) { - (*it)->ReorderChildLayers(parent_layer); + ScopedChildrenLock(this); + for (auto* child : base::Reversed(children_)) { + child->ReorderChildLayers(parent_layer); } } } @@ -1765,8 +1805,8 @@ } // Children. - for (int i = 0, count = view_with_children->child_count(); i < count; ++i) - result.append(view_with_children->child_at(i)->PrintViewGraph(false)); + for (auto* child : view_with_children->children_) + result.append(child->PrintViewGraph(false)); if (first) result.append("}\n"); @@ -1862,6 +1902,9 @@ if (delete_removed_view && !view->owned_by_client_) view_to_be_deleted.reset(view); +#if DCHECK_IS_ON() + DCHECK(!iterating_); +#endif children_.erase(i); if (update_tool_tip) @@ -1875,8 +1918,11 @@ } void View::PropagateRemoveNotifications(View* old_parent, View* new_parent) { - for (int i = 0, count = child_count(); i < count; ++i) - child_at(i)->PropagateRemoveNotifications(old_parent, new_parent); + { + ScopedChildrenLock(this); + for (auto* child : children_) + child->PropagateRemoveNotifications(old_parent, new_parent); + } ViewHierarchyChangedDetails details(false, old_parent, this, new_parent); for (View* v = this; v; v = v->parent_) @@ -1885,14 +1931,20 @@ void View::PropagateAddNotifications( const ViewHierarchyChangedDetails& details) { - for (int i = 0, count = child_count(); i < count; ++i) - child_at(i)->PropagateAddNotifications(details); + { + ScopedChildrenLock(this); + for (auto* child : children_) + child->PropagateAddNotifications(details); + } ViewHierarchyChangedImpl(true, details); } void View::PropagateNativeViewHierarchyChanged() { - for (int i = 0, count = child_count(); i < count; ++i) - child_at(i)->PropagateNativeViewHierarchyChanged(); + { + ScopedChildrenLock(this); + for (auto* child : children_) + child->PropagateNativeViewHierarchyChanged(); + } NativeViewHierarchyChanged(); } @@ -1916,16 +1968,22 @@ } void View::PropagateNativeThemeChanged(const ui::NativeTheme* theme) { - for (int i = 0, count = child_count(); i < count; ++i) - child_at(i)->PropagateNativeThemeChanged(theme); + { + ScopedChildrenLock(this); + for (auto* child : children_) + child->PropagateNativeThemeChanged(theme); + } OnNativeThemeChanged(theme); } // Size and disposition -------------------------------------------------------- void View::PropagateVisibilityNotifications(View* start, bool is_visible) { - for (int i = 0, count = child_count(); i < count; ++i) - child_at(i)->PropagateVisibilityNotifications(start, is_visible); + { + ScopedChildrenLock(this); + for (auto* child : children_) + child->PropagateVisibilityNotifications(start, is_visible); + } VisibilityChangedImpl(start, is_visible); } @@ -2106,8 +2164,11 @@ void View::CreateLayer() { // A new layer is being created for the view. So all the layers of the // sub-tree can inherit the visibility of the corresponding view. - for (int i = 0, count = child_count(); i < count; ++i) - child_at(i)->UpdateChildLayerVisibility(true); + { + ScopedChildrenLock(this); + for (auto* child : children_) + child->UpdateChildLayerVisibility(true); + } SetLayer(base::MakeUnique<ui::Layer>()); layer()->set_delegate(this); @@ -2145,8 +2206,9 @@ return false; } bool result = false; - for (int i = 0, count = child_count(); i < count; ++i) { - if (child_at(i)->UpdateParentLayers()) + ScopedChildrenLock(this); + for (auto* child : children_) { + if (child->UpdateParentLayers()) result = true; } return result; @@ -2161,8 +2223,9 @@ // necessary to orphan the child layers. return; } - for (int i = 0, count = child_count(); i < count; ++i) - child_at(i)->OrphanLayers(); + ScopedChildrenLock(this); + for (auto* child : children_) + child->OrphanLayers(); } void View::ReparentLayer(const gfx::Vector2d& offset, ui::Layer* parent_layer) { @@ -2345,11 +2408,14 @@ // the last focusable element. Let's try to find an element with no next // focusable element to link to. View* last_focusable_view = NULL; - for (Views::iterator i(children_.begin()); i != children_.end(); ++i) { - if (!(*i)->next_focusable_view_) { - last_focusable_view = *i; + { + ScopedChildrenLock(this); + for (auto* child : children_) { + if (!child->next_focusable_view_) { + last_focusable_view = child; break; } + } } if (last_focusable_view == NULL) { // Hum... there is a cycle in the focus list. Let's just insert ourself @@ -2391,20 +2457,29 @@ // System events --------------------------------------------------------------- void View::PropagateThemeChanged() { - for (int i = child_count() - 1; i >= 0; --i) - child_at(i)->PropagateThemeChanged(); + { + ScopedChildrenLock(this); + for (auto* child : base::Reversed(children_)) + child->PropagateThemeChanged(); + } OnThemeChanged(); } void View::PropagateLocaleChanged() { - for (int i = child_count() - 1; i >= 0; --i) - child_at(i)->PropagateLocaleChanged(); + { + ScopedChildrenLock(this); + for (auto* child : base::Reversed(children_)) + child->PropagateLocaleChanged(); + } OnLocaleChanged(); } void View::PropagateDeviceScaleFactorChanged(float device_scale_factor) { - for (int i = child_count() - 1; i >= 0; --i) - child_at(i)->PropagateDeviceScaleFactorChanged(device_scale_factor); + { + ScopedChildrenLock(this); + for (auto* child : base::Reversed(children_)) + child->PropagateDeviceScaleFactorChanged(device_scale_factor); + } // If the view is drawing to the layer, OnDeviceScaleFactorChanged() is called // through LayerDelegate callback.
diff --git a/ui/views/view.h b/ui/views/view.h index a6811af..5c88e2c 100644 --- a/ui/views/view.h +++ b/ui/views/view.h
@@ -84,6 +84,10 @@ class RootView; } +namespace { +class ScopedChildrenLock; +} + ///////////////////////////////////////////////////////////////////////////// // // View class @@ -1230,6 +1234,7 @@ friend class internal::PostEventDispatchHandler; friend class internal::RootView; friend class FocusManager; + friend class ScopedChildrenLock; friend class ViewLayerTest; friend class Widget; @@ -1466,6 +1471,12 @@ // This view's children. Views children_; +#if DCHECK_IS_ON() + // True while iterating over |children_|. Used to detect and DCHECK when + // |children_| is mutated during iteration. + mutable bool iterating_; +#endif + // Size and disposition ------------------------------------------------------ // This View's bounds in the parent coordinate system.
diff --git a/ui/webui/resources/.clang-format b/ui/webui/resources/.clang-format index d27bf2e..8fd4c4a 100644 --- a/ui/webui/resources/.clang-format +++ b/ui/webui/resources/.clang-format
@@ -3,3 +3,11 @@ # Renaming quotes in <include> and <if> break things. # For normal JS code, please prefer ' to ". JavaScriptQuotes: Leave + +AllowShortBlocksOnASingleLine: false +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: Empty +AllowShortIfStatementsOnASingleLine: false +AllowShortLoopsOnASingleLine: false +SpacesInContainerLiterals: false +SpacesInSquareBrackets: false
diff --git a/ui/webui/resources/cr_elements/cr_action_menu/cr_action_menu.js b/ui/webui/resources/cr_elements/cr_action_menu/cr_action_menu.js index 7b912fa..ba7728b 100644 --- a/ui/webui/resources/cr_elements/cr_action_menu/cr_action_menu.js +++ b/ui/webui/resources/cr_elements/cr_action_menu/cr_action_menu.js
@@ -41,7 +41,9 @@ }, /** override */ - detached: function() { this.removeResizeListener_(); }, + detached: function() { + this.removeResizeListener_(); + }, /** @private */ removeResizeListener_: function() {
diff --git a/ui/webui/resources/cr_elements/cr_dialog/cr_dialog.js b/ui/webui/resources/cr_elements/cr_dialog/cr_dialog.js index 0114ebd..d15ed9b 100644 --- a/ui/webui/resources/cr_elements/cr_dialog/cr_dialog.js +++ b/ui/webui/resources/cr_elements/cr_dialog/cr_dialog.js
@@ -55,5 +55,7 @@ }, /** @return {!PaperIconButtonElement} */ - getCloseButton: function() { return this.$.close; }, + getCloseButton: function() { + return this.$.close; + }, });
diff --git a/ui/webui/resources/cr_elements/cr_expand_button/cr_expand_button.js b/ui/webui/resources/cr_elements/cr_expand_button/cr_expand_button.js index 1a4d7b7..27d57d37 100644 --- a/ui/webui/resources/cr_elements/cr_expand_button/cr_expand_button.js +++ b/ui/webui/resources/cr_elements/cr_expand_button/cr_expand_button.js
@@ -38,5 +38,7 @@ * @param {Event} event * @private */ - stopTap_: function(event) { event.stopPropagation(); }, + stopTap_: function(event) { + event.stopPropagation(); + }, });
diff --git a/ui/webui/resources/cr_elements/cr_lazy_render/cr_lazy_render.js b/ui/webui/resources/cr_elements/cr_lazy_render/cr_lazy_render.js index 47ed5bed..8fac4f4 100644 --- a/ui/webui/resources/cr_elements/cr_lazy_render/cr_lazy_render.js +++ b/ui/webui/resources/cr_elements/cr_lazy_render/cr_lazy_render.js
@@ -37,7 +37,9 @@ * @return {?Element} The element contained in the template, if it has * already been stamped. */ - getIfExists: function() { return this.child_; }, + getIfExists: function() { + return this.child_; + }, /** @private */ render_: function() {
diff --git a/ui/webui/resources/cr_elements/cr_profile_avatar_selector/cr_profile_avatar_selector.js b/ui/webui/resources/cr_elements/cr_profile_avatar_selector/cr_profile_avatar_selector.js index df8421e..d59203c 100644 --- a/ui/webui/resources/cr_elements/cr_profile_avatar_selector/cr_profile_avatar_selector.js +++ b/ui/webui/resources/cr_elements/cr_profile_avatar_selector/cr_profile_avatar_selector.js
@@ -18,7 +18,12 @@ * The list of profile avatar URLs and labels. * @type {!Array<!AvatarIcon>} */ - avatars: {type: Array, value: function() { return []; }}, + avatars: { + type: Array, + value: function() { + return []; + } + }, /** * The currently selected profile avatar URL. May be a data URI. @@ -37,5 +42,7 @@ * @return {string} A CSS imageset for multiple scale factors. * @private */ - getIconImageset_: function(iconUrl) { return cr.icon.getImage(iconUrl); }, + getIconImageset_: function(iconUrl) { + return cr.icon.getImage(iconUrl); + }, });
diff --git a/ui/webui/resources/cr_elements/cr_search_field/cr_search_field_behavior.js b/ui/webui/resources/cr_elements/cr_search_field/cr_search_field_behavior.js index 8729c86..68c15d4f 100644 --- a/ui/webui/resources/cr_elements/cr_search_field/cr_search_field_behavior.js +++ b/ui/webui/resources/cr_elements/cr_search_field/cr_search_field_behavior.js
@@ -36,7 +36,9 @@ /** * @return {string} The value of the search field. */ - getValue: function() { return this.getSearchInput().value; }, + getValue: function() { + return this.getSearchInput().value; + }, /** * Sets the value of the search field.
diff --git a/ui/webui/resources/cr_elements/cr_toolbar/cr_toolbar.js b/ui/webui/resources/cr_elements/cr_toolbar/cr_toolbar.js index 10986a9..09ddc81 100644 --- a/ui/webui/resources/cr_elements/cr_toolbar/cr_toolbar.js +++ b/ui/webui/resources/cr_elements/cr_toolbar/cr_toolbar.js
@@ -52,13 +52,19 @@ ], /** @return {!CrToolbarSearchFieldElement} */ - getSearchField: function() { return this.$.search; }, + getSearchField: function() { + return this.$.search; + }, /** @private */ - onClosePromoTap_: function() { this.fire('cr-toolbar-menu-promo-close'); }, + onClosePromoTap_: function() { + this.fire('cr-toolbar-menu-promo-close'); + }, /** @private */ - onMenuTap_: function() { this.fire('cr-toolbar-menu-tap'); }, + onMenuTap_: function() { + this.fire('cr-toolbar-menu-tap'); + }, /** @private */ possiblyShowMenuPromo_: function() {
diff --git a/ui/webui/resources/cr_elements/cr_toolbar/cr_toolbar_search_field.js b/ui/webui/resources/cr_elements/cr_toolbar/cr_toolbar_search_field.js index 916d7d5..3de204c 100644 --- a/ui/webui/resources/cr_elements/cr_toolbar/cr_toolbar_search_field.js +++ b/ui/webui/resources/cr_elements/cr_toolbar/cr_toolbar_search_field.js
@@ -50,7 +50,9 @@ }, /** @return {!HTMLInputElement} */ - getSearchInput: function() { return this.$.searchInput; }, + getSearchInput: function() { + return this.$.searchInput; + }, /** * Sets the value of the search field. Overridden from CrSearchFieldBehavior. @@ -64,7 +66,9 @@ }, /** @return {boolean} */ - isSearchFocused: function() { return this.searchFocused_; }, + isSearchFocused: function() { + return this.searchFocused_; + }, showAndFocus: function() { this.showingSearch = true; @@ -72,14 +76,18 @@ }, /** @private */ - focus_: function() { this.getSearchInput().focus(); }, + focus_: function() { + this.getSearchInput().focus(); + }, /** * @param {boolean} narrow * @return {number} * @private */ - computeIconTabIndex_: function(narrow) { return narrow ? 0 : -1; }, + computeIconTabIndex_: function(narrow) { + return narrow ? 0 : -1; + }, /** * @return {boolean} @@ -90,7 +98,9 @@ }, /** @private */ - onInputFocus_: function() { this.searchFocused_ = true; }, + onInputFocus_: function() { + this.searchFocused_ = true; + }, /** @private */ onInputBlur_: function() {
diff --git a/ui/webui/resources/cr_elements/network/cr_network_list.js b/ui/webui/resources/cr_elements/network/cr_network_list.js index 595ea7b..e1ded9a 100644 --- a/ui/webui/resources/cr_elements/network/cr_network_list.js +++ b/ui/webui/resources/cr_elements/network/cr_network_list.js
@@ -26,13 +26,23 @@ * The list of network state properties for the items to display. * @type {!Array<!CrOnc.NetworkStateProperties>} */ - networks: {type: Array, value: function() { return []; }}, + networks: { + type: Array, + value: function() { + return []; + } + }, /** * The list of custom items to display after the list of networks. * @type {!Array<!CrNetworkList.CustomItemState>} */ - customItems: {type: Array, value: function() { return []; }}, + customItems: { + type: Array, + value: function() { + return []; + } + }, /** True if action buttons should be shown for the itmes. */ showButtons: { @@ -68,7 +78,9 @@ }, /** @private */ - listChanged_: function() { this.updateScrollableContents(); }, + listChanged_: function() { + this.updateScrollableContents(); + }, /** * Returns a combined list of networks and custom items.
diff --git a/ui/webui/resources/cr_elements/network/cr_network_list_item.js b/ui/webui/resources/cr_elements/network/cr_network_list_item.js index 37b63313..4ec86667 100644 --- a/ui/webui/resources/cr_elements/network/cr_network_list_item.js +++ b/ui/webui/resources/cr_elements/network/cr_network_list_item.js
@@ -101,7 +101,9 @@ }, /** @private */ - isStateTextConnected_() { return this.isListItem && this.isConnected_(); }, + isStateTextConnected_() { + return this.isListItem && this.isConnected_(); + }, /** * This only gets called for network items once networkState is set.
diff --git a/ui/webui/resources/cr_elements/network/cr_network_select.js b/ui/webui/resources/cr_elements/network/cr_network_select.js index 30e67e81..de4cdef 100644 --- a/ui/webui/resources/cr_elements/network/cr_network_select.js +++ b/ui/webui/resources/cr_elements/network/cr_network_select.js
@@ -76,7 +76,12 @@ * List of all network state data for all visible networks. * @type {!Array<!CrOnc.NetworkStateProperties>} */ - networkStateList: {type: Array, value: function() { return []; }}, + networkStateList: { + type: Array, + value: function() { + return []; + } + }, /** * The list of custom items to display after the list of networks. @@ -85,7 +90,9 @@ */ customItems: { type: Array, - value: function() { return []; }, + value: function() { + return []; + }, }, /**
diff --git a/ui/webui/resources/js/action_link.js b/ui/webui/resources/js/action_link.js index 4cfcc95..a9e1ffd6 100644 --- a/ui/webui/resources/js/action_link.js +++ b/ui/webui/resources/js/action_link.js
@@ -54,7 +54,9 @@ } }); - function preventDefault(e) { e.preventDefault(); } + function preventDefault(e) { + e.preventDefault(); + } function removePreventDefault() { document.removeEventListener('selectstart', preventDefault); @@ -73,8 +75,9 @@ this.classList.add('no-outline'); }); - this.addEventListener( - 'blur', function() { this.classList.remove('no-outline'); }); + this.addEventListener('blur', function() { + this.classList.remove('no-outline'); + }); }, /** @type {boolean} */ @@ -85,7 +88,9 @@ HTMLAnchorElement.prototype.removeAttribute.call(this, 'disabled'); this.tabIndex = disabled ? -1 : 0; }, - get disabled() { return this.hasAttribute('disabled'); }, + get disabled() { + return this.hasAttribute('disabled'); + }, /** @override */ setAttribute: function(attr, val) {
diff --git a/ui/webui/resources/js/assert.js b/ui/webui/resources/js/assert.js index a404b68..42fb523 100644 --- a/ui/webui/resources/js/assert.js +++ b/ui/webui/resources/js/assert.js
@@ -21,7 +21,9 @@ if (opt_message) message = message + ': ' + opt_message; var error = new Error(message); - var global = function() { return this; }(); + var global = function() { + return this; + }(); if (global.traceAssertionsForTesting) console.warn(error.stack); throw error;
diff --git a/ui/webui/resources/js/chromeos/ui_account_tweaks.js b/ui/webui/resources/js/chromeos/ui_account_tweaks.js index 278af2eb..1aa9123 100644 --- a/ui/webui/resources/js/chromeos/ui_account_tweaks.js +++ b/ui/webui/resources/js/chromeos/ui_account_tweaks.js
@@ -166,7 +166,9 @@ element.nodeName == 'BUTTON') { element.disabled = true; } else if (element.nodeName == 'A') { - element.onclick = function() { return false; }; + element.onclick = function() { + return false; + }; } };
diff --git a/ui/webui/resources/js/cr.js b/ui/webui/resources/js/cr.js index 14bccfb..c185695 100644 --- a/ui/webui/resources/js/cr.js +++ b/ui/webui/resources/js/cr.js
@@ -109,13 +109,19 @@ switch (kind) { case PropertyKind.JS: var privateName = name + '_'; - return function() { return this[privateName]; }; + return function() { + return this[privateName]; + }; case PropertyKind.ATTR: var attributeName = getAttributeName(name); - return function() { return this.getAttribute(attributeName); }; + return function() { + return this.getAttribute(attributeName); + }; case PropertyKind.BOOL_ATTR: var attributeName = getAttributeName(name); - return function() { return this.hasAttribute(attributeName); }; + return function() { + return this.hasAttribute(attributeName); + }; } // TODO(dbeam): replace with assertNotReached() in assert.js when I can coax @@ -214,7 +220,9 @@ /** * @return {number} A new unique ID. */ - function createUid() { return uidCounter++; } + function createUid() { + return uidCounter++; + } /** * Returns a unique ID for the item. This mutates the item so it needs to be @@ -440,24 +448,38 @@ webUIListenerCallback: webUIListenerCallback, webUIResponse: webUIResponse, - get doc() { return document; }, + get doc() { + return document; + }, /** Whether we are using a Mac or not. */ - get isMac() { return /Mac/.test(navigator.platform); }, + get isMac() { + return /Mac/.test(navigator.platform); + }, /** Whether this is on the Windows platform or not. */ - get isWindows() { return /Win/.test(navigator.platform); }, + get isWindows() { + return /Win/.test(navigator.platform); + }, /** Whether this is on chromeOS or not. */ - get isChromeOS() { return /CrOS/.test(navigator.userAgent); }, + get isChromeOS() { + return /CrOS/.test(navigator.userAgent); + }, /** Whether this is on vanilla Linux (not chromeOS). */ - get isLinux() { return /Linux/.test(navigator.userAgent); }, + get isLinux() { + return /Linux/.test(navigator.userAgent); + }, /** Whether this is on Android. */ - get isAndroid() { return /Android/.test(navigator.userAgent); }, + get isAndroid() { + return /Android/.test(navigator.userAgent); + }, /** Whether this is on iOS. */ - get isIOS() { return /iPad|iPhone|iPod/.test(navigator.platform); } + get isIOS() { + return /iPad|iPhone|iPod/.test(navigator.platform); + } }; }();
diff --git a/ui/webui/resources/js/cr/event_target.js b/ui/webui/resources/js/cr/event_target.js index c9e09140..24cdf294 100644 --- a/ui/webui/resources/js/cr/event_target.js +++ b/ui/webui/resources/js/cr/event_target.js
@@ -76,7 +76,9 @@ // Since we are using DOM Event objects we need to override some of the // properties and methods so that we can emulate this correctly. var self = this; - event.__defineGetter__('target', function() { return self; }); + event.__defineGetter__('target', function() { + return self; + }); var type = event.type; var prevented = 0;
diff --git a/ui/webui/resources/js/cr/link_controller.js b/ui/webui/resources/js/cr/link_controller.js index 589f6aa..67515e8 100644 --- a/ui/webui/resources/js/cr/link_controller.js +++ b/ui/webui/resources/js/cr/link_controller.js
@@ -46,7 +46,9 @@ * links. * @constructor */ - function LinkController(localStrings) { this.localStrings_ = localStrings; } + function LinkController(localStrings) { + this.localStrings_ = localStrings; + } LinkController.prototype = { /** @@ -99,7 +101,9 @@ * @param {string} url The URL to open. * @param {cr.LinkKind} kind The kind of open we want to do. */ - openUrl: function(url, kind) { this.openUrls([url], kind); }, + openUrl: function(url, kind) { + this.openUrls([url], kind); + }, /** * Opens URLs in new tab, window or incognito mode. @@ -118,8 +122,9 @@ // Fix '#124' URLs since opening those in a new window does not work. We // prepend the base URL when we encounter those. var base = this.window.location.href.split('#')[0]; - urls = - urls.map(function(url) { return url[0] == '#' ? base + url : url; }); + urls = urls.map(function(url) { + return url[0] == '#' ? base + url : url; + }); var incognito = kind == cr.LinkKind.INCOGNITO; if (kind == cr.LinkKind.WINDOW || incognito) {
diff --git a/ui/webui/resources/js/cr/ui/array_data_model.js b/ui/webui/resources/js/cr/ui/array_data_model.js index 5138cefe..d63fbb6 100644 --- a/ui/webui/resources/js/cr/ui/array_data_model.js +++ b/ui/webui/resources/js/cr/ui/array_data_model.js
@@ -41,7 +41,9 @@ * The length of the data model. * @type {number} */ - get length() { return this.array_.length; }, + get length() { + return this.array_.length; + }, /** * Returns the item at the given index. @@ -61,7 +63,9 @@ * @param {string} field The field to get compare function for. * @return {function(*, *): number} Compare function set for given field. */ - compareFunction: function(field) { return this.compareFunctions_[field]; }, + compareFunction: function(field) { + return this.compareFunctions_[field]; + }, /** * Sets compare function for given field. @@ -243,7 +247,9 @@ * This runs sort after updating. * @param {number} index The index of the item to update. */ - updateIndex: function(index) { this.updateIndexes([index]); }, + updateIndex: function(index) { + this.updateIndexes([index]); + }, /** * Notifies of update of the items in the array. This does not remove and @@ -294,7 +300,9 @@ * @param {function()} callback The function to invoke when preparation * is complete. */ - prepareSort: function(field, callback) { callback(); }, + prepareSort: function(field, callback) { + callback(); + }, /** * Sorts data model according to given field and direction and dispathes
diff --git a/ui/webui/resources/js/cr/ui/autocomplete_list.js b/ui/webui/resources/js/cr/ui/autocomplete_list.js index 0c140cb..ccd9400 100644 --- a/ui/webui/resources/js/cr/ui/autocomplete_list.js +++ b/ui/webui/resources/js/cr/ui/autocomplete_list.js
@@ -133,7 +133,9 @@ * By default, clears and hides the autocomplete popup. Note that the * keydown event bubbles up, so the input field can handle the event. */ - handleEnterKeydown: function() { this.suggestions = []; }, + handleEnterKeydown: function() { + this.suggestions = []; + }, /** * Handles the selected suggestion. Called when a suggestion is selected. @@ -222,7 +224,9 @@ * @return {HTMLElement} The text field the autocomplete popup is currently * attached to, if any. */ - get targetInput() { return this.targetInput_; }, + get targetInput() { + return this.targetInput_; + }, /** * Handles input field key events that should be interpreted as autocomplete
diff --git a/ui/webui/resources/js/cr/ui/bubble.js b/ui/webui/resources/js/cr/ui/bubble.js index a2cc09d..fe97030 100644 --- a/ui/webui/resources/js/cr/ui/bubble.js +++ b/ui/webui/resources/js/cr/ui/bubble.js
@@ -291,7 +291,9 @@ * Attach the bubble to the document's DOM. * @private */ - attachToDOM_: function() { document.body.appendChild(this); }, + attachToDOM_: function() { + document.body.appendChild(this); + }, /** * Update the arrow so that it appears at the correct position.
diff --git a/ui/webui/resources/js/cr/ui/card_slider.js b/ui/webui/resources/js/cr/ui/card_slider.js index 4de3934..1dc27400 100644 --- a/ui/webui/resources/js/cr/ui/card_slider.js +++ b/ui/webui/resources/js/cr/ui/card_slider.js
@@ -228,32 +228,42 @@ * Returns the index of the current card. * @return {number} index of the current card. */ - get currentCard() { return this.currentCard_; }, + get currentCard() { + return this.currentCard_; + }, /** * Allows setting the current card index. * @param {number} index A new index to set the current index to. * @return {number} The new index after having been set. */ - set currentCard(index) { return (this.currentCard_ = index); }, + set currentCard(index) { + return (this.currentCard_ = index); + }, /** * Returns the number of cards. * @return {number} number of cards. */ - get cardCount() { return this.cards_.length; }, + get cardCount() { + return this.cards_.length; + }, /** * Returns the current card itself. * @return {!Element} the currently shown card. */ - get currentCardValue() { return this.cards_[this.currentCard_]; }, + get currentCardValue() { + return this.cards_[this.currentCard_]; + }, /** * Returns the frame holding the cards. * @return {Element} The frame used to position the cards. */ - get frame() { return this.frame_; }, + get frame() { + return this.frame_; + }, /** * Handle horizontal scrolls to flip between pages. @@ -458,7 +468,9 @@ * the likely event it needs to be updated by a card being inserted or * removed in the flow. */ - repositionFrame: function() { this.transformToCurrentCard_(); }, + repositionFrame: function() { + this.transformToCurrentCard_(); + }, /** * Checks the the given |index| exists in this.cards_.
diff --git a/ui/webui/resources/js/cr/ui/command.js b/ui/webui/resources/js/cr/ui/command.js index 3f857aff..783bba5 100644 --- a/ui/webui/resources/js/cr/ui/command.js +++ b/ui/webui/resources/js/cr/ui/command.js
@@ -129,7 +129,9 @@ * @type {string} */ shortcut_: '', - get shortcut() { return this.shortcut_; }, + get shortcut() { + return this.shortcut_; + }, set shortcut(shortcut) { var oldShortcut = this.shortcut_; if (shortcut !== oldShortcut) { @@ -310,7 +312,9 @@ * @type {boolean} */ canExecute_: false, - get canExecute() { return this.canExecute_; }, + get canExecute() { + return this.canExecute_; + }, set canExecute(canExecute) { this.canExecute_ = !!canExecute; this.stopPropagation();
diff --git a/ui/webui/resources/js/cr/ui/context_menu_handler.js b/ui/webui/resources/js/cr/ui/context_menu_handler.js index 2266801..8e0ccff8 100644 --- a/ui/webui/resources/js/cr/ui/context_menu_handler.js +++ b/ui/webui/resources/js/cr/ui/context_menu_handler.js
@@ -14,7 +14,9 @@ * @extends {cr.EventTarget} * @implements {EventListener} */ - function ContextMenuHandler() { this.showingEvents_ = new EventTracker(); } + function ContextMenuHandler() { + this.showingEvents_ = new EventTracker(); + } ContextMenuHandler.prototype = { __proto__: EventTarget.prototype, @@ -23,7 +25,10 @@ * The menu that we are currently showing. * @type {cr.ui.Menu} */ - menu_: null, get menu() { return this.menu_; }, + menu_: null, + get menu() { + return this.menu_; + }, /** * Shows a menu as a context menu. @@ -217,8 +222,9 @@ elementOrClass.prototype : elementOrClass; - target.__defineGetter__( - 'contextMenu', function() { return this.contextMenu_; }); + target.__defineGetter__('contextMenu', function() { + return this.contextMenu_; + }); target.__defineSetter__('contextMenu', function(menu) { var oldContextMenu = this.contextMenu;
diff --git a/ui/webui/resources/js/cr/ui/controlled_indicator.js b/ui/webui/resources/js/cr/ui/controlled_indicator.js index 249c90a..a30d225 100644 --- a/ui/webui/resources/js/cr/ui/controlled_indicator.js +++ b/ui/webui/resources/js/cr/ui/controlled_indicator.js
@@ -63,7 +63,9 @@ * implementation does not set any strings. * @return {Object} */ - getDefaultStrings: function() { return {}; }, + getDefaultStrings: function() { + return {}; + }, /** * Returns the text shown in the bubble.
diff --git a/ui/webui/resources/js/cr/ui/dialogs.js b/ui/webui/resources/js/cr/ui/dialogs.js index 4ec7ed4..96693e0 100644 --- a/ui/webui/resources/js/cr/ui/dialogs.js +++ b/ui/webui/resources/js/cr/ui/dialogs.js
@@ -171,8 +171,10 @@ /** @private */ BaseDialog.prototype.findFocusableElements_ = function(doc) { - var elements = Array.prototype.filter.call( - doc.querySelectorAll('*'), function(n) { return n.tabIndex >= 0; }); + var elements = + Array.prototype.filter.call(doc.querySelectorAll('*'), function(n) { + return n.tabIndex >= 0; + }); var iframes = doc.querySelectorAll('iframe'); for (var i = 0; i < iframes.length; i++) { @@ -217,7 +219,9 @@ this.tabIndexes_ = this.deactivatedNodes_.map(function(n) { return n.getAttribute('tabindex'); }); - this.deactivatedNodes_.forEach(function(n) { n.tabIndex = -1; }); + this.deactivatedNodes_.forEach(function(n) { + n.tabIndex = -1; + }); this.previousActiveElement_ = this.document_.activeElement; this.parentNode_.appendChild(this.container_); @@ -306,7 +310,9 @@ * @constructor * @extends {cr.ui.dialogs.BaseDialog} */ - function ConfirmDialog(parentNode) { BaseDialog.call(this, parentNode); } + function ConfirmDialog(parentNode) { + BaseDialog.call(this, parentNode); + } ConfirmDialog.prototype = {__proto__: BaseDialog.prototype}; @@ -357,7 +363,9 @@ this, message, opt_onOk, opt_onCancel, opt_onShow); }; - PromptDialog.prototype.getValue = function() { return this.input_.value; }; + PromptDialog.prototype.getValue = function() { + return this.input_.value; + }; /** @private */ PromptDialog.prototype.onOkClick_ = function(event) {
diff --git a/ui/webui/resources/js/cr/ui/drag_wrapper.js b/ui/webui/resources/js/cr/ui/drag_wrapper.js index 60d7cef..005814a9 100644 --- a/ui/webui/resources/js/cr/ui/drag_wrapper.js +++ b/ui/webui/resources/js/cr/ui/drag_wrapper.js
@@ -41,7 +41,9 @@ * @param {!cr.ui.DragWrapperDelegate} delegate * @constructor */ - function DragWrapper(target, delegate) { this.initialize(target, delegate); } + function DragWrapper(target, delegate) { + this.initialize(target, delegate); + } DragWrapper.prototype = { initialize: function(target, delegate) {
diff --git a/ui/webui/resources/js/cr/ui/expandable_bubble.js b/ui/webui/resources/js/cr/ui/expandable_bubble.js index 16a7635..8844079 100644 --- a/ui/webui/resources/js/cr/ui/expandable_bubble.js +++ b/ui/webui/resources/js/cr/ui/expandable_bubble.js
@@ -75,7 +75,9 @@ * is clicked. By default is set to this.hide. * @param {Function} func A function with no parameters. */ - set handleCloseEvent(func) { this.handleCloseEvent_ = func; }, + set handleCloseEvent(func) { + this.handleCloseEvent_ = func; + }, /** * Temporarily suppresses the bubble from view (and toggles it back).
diff --git a/ui/webui/resources/js/cr/ui/focus_grid.js b/ui/webui/resources/js/cr/ui/focus_grid.js index e2dc5ad..40c782e 100644 --- a/ui/webui/resources/js/cr/ui/focus_grid.js +++ b/ui/webui/resources/js/cr/ui/focus_grid.js
@@ -43,7 +43,9 @@ else this.lastFocused_ = e.currentTarget; - this.rows.forEach(function(r) { r.makeActive(r == row); }); + this.rows.forEach(function(r) { + r.makeActive(r == row); + }); }, /** @override */ @@ -77,7 +79,9 @@ * Unregisters event handlers and removes all |this.rows|. */ destroy: function() { - this.rows.forEach(function(row) { row.destroy(); }); + this.rows.forEach(function(row) { + row.destroy(); + }); this.rows.length = 0; }, @@ -109,7 +113,9 @@ * Adds |row| to the end of this list. * @param {!cr.ui.FocusRow} row The row that needs to be added to this grid. */ - addRow: function(row) { this.addRowBefore(row, null); }, + addRow: function(row) { + this.addRowBefore(row, null); + }, /** * Adds |row| before |nextRow|. If |nextRow| is not in the list or it's
diff --git a/ui/webui/resources/js/cr/ui/focus_manager.js b/ui/webui/resources/js/cr/ui/focus_manager.js index 8fb528d..e2c8347d 100644 --- a/ui/webui/resources/js/cr/ui/focus_manager.js +++ b/ui/webui/resources/js/cr/ui/focus_manager.js
@@ -36,7 +36,9 @@ * allowed to receive focus. * @return {Element} The element containing focusable elements. */ - getFocusParent: function() { return document.body; }, + getFocusParent: function() { + return document.body; + }, /** * Returns the elements on the page capable of receiving focus.
diff --git a/ui/webui/resources/js/cr/ui/focus_outline_manager.js b/ui/webui/resources/js/cr/ui/focus_outline_manager.js index 8ca4f92..23ef1520 100644 --- a/ui/webui/resources/js/cr/ui/focus_outline_manager.js +++ b/ui/webui/resources/js/cr/ui/focus_outline_manager.js
@@ -31,11 +31,13 @@ var self = this; - doc.addEventListener( - 'keydown', function(e) { self.focusByKeyboard_ = true; }, true); + doc.addEventListener('keydown', function(e) { + self.focusByKeyboard_ = true; + }, true); - doc.addEventListener( - 'mousedown', function(e) { self.focusByKeyboard_ = false; }, true); + doc.addEventListener('mousedown', function(e) { + self.focusByKeyboard_ = false; + }, true); doc.addEventListener('focus', function(event) { // Update visibility only when focus is actually changed. @@ -62,14 +64,20 @@ */ focusByKeyboard_: true, - updateVisibility: function() { this.visible = this.focusByKeyboard_; }, + updateVisibility: function() { + this.visible = this.focusByKeyboard_; + }, /** * Whether the focus outline should be visible. * @type {boolean} */ - set visible(visible) { this.classList_.toggle(CLASS_NAME, visible); }, - get visible() { return this.classList_.contains(CLASS_NAME); } + set visible(visible) { + this.classList_.toggle(CLASS_NAME, visible); + }, + get visible() { + return this.classList_.contains(CLASS_NAME); + } }; /**
diff --git a/ui/webui/resources/js/cr/ui/focus_row.js b/ui/webui/resources/js/cr/ui/focus_row.js index 36b5865..652b0353 100644 --- a/ui/webui/resources/js/cr/ui/focus_row.js +++ b/ui/webui/resources/js/cr/ui/focus_row.js
@@ -126,7 +126,9 @@ }, /** Dereferences nodes and removes event handlers. */ - destroy: function() { this.eventTracker.removeAll(); }, + destroy: function() { + this.eventTracker.removeAll(); + }, /** * @param {!Element} sampleElement An element for to find an equivalent for.
diff --git a/ui/webui/resources/js/cr/ui/grid.js b/ui/webui/resources/js/cr/ui/grid.js index aa0b9288..a71bf6b 100644 --- a/ui/webui/resources/js/cr/ui/grid.js +++ b/ui/webui/resources/js/cr/ui/grid.js
@@ -73,7 +73,9 @@ * Shows a warning at the setter because cr.ui.Grid does not support this. * @type {boolean} */ - get fixedHeight() { return true; }, + get fixedHeight() { + return true; + }, set fixedHeight(fixedHeight) { if (!fixedHeight) console.warn('cr.ui.Grid does not support fixedHeight = false'); @@ -206,14 +208,18 @@ * of multiple columns. * @override */ - getItemRow: function(index) { return Math.floor(index / this.columns); }, + getItemRow: function(index) { + return Math.floor(index / this.columns); + }, /** * @param {number} row The row. * @return {number} The index of the first item in the row. * @override */ - getFirstItemInRow: function(row) { return row * this.columns; }, + getFirstItemInRow: function(row) { + return row * this.columns; + }, /** * Creates the selection controller to use internally. @@ -404,7 +410,9 @@ * @return {number} The index before or -1 if not found. * @override */ - getIndexBefore: function(index) { return index - 1; }, + getIndexBefore: function(index) { + return index - 1; + }, /** * Returns the index after (x axis) the given element.
diff --git a/ui/webui/resources/js/cr/ui/list.js b/ui/webui/resources/js/cr/ui/list.js index a5a0b99..99196c6 100644 --- a/ui/webui/resources/js/cr/ui/list.js +++ b/ui/webui/resources/js/cr/ui/list.js
@@ -94,7 +94,9 @@ * Function used to create grid items. * @return {function(new:cr.ui.ListItem, *)} */ - get itemConstructor() { return this.itemConstructor_; }, + get itemConstructor() { + return this.itemConstructor_; + }, set itemConstructor(func) { if (func != this.itemConstructor_) { this.itemConstructor_ = func; @@ -146,7 +148,9 @@ this.onSetDataModelComplete(); }, - get dataModel() { return this.dataModel_; }, + get dataModel() { + return this.dataModel_; + }, /** * Override to be notified when |this.dataModel| is set. @@ -164,7 +168,9 @@ * The selection model to use. * @type {cr.ui.ListSelectionModel} */ - get selectionModel() { return this.selectionModel_; }, + get selectionModel() { + return this.selectionModel_; + }, set selectionModel(sm) { var oldSm = this.selectionModel_; if (oldSm == sm) @@ -194,7 +200,9 @@ * Whether or not the list auto-expands. * @type {boolean} */ - get autoExpands() { return this.autoExpands_; }, + get autoExpands() { + return this.autoExpands_; + }, set autoExpands(autoExpands) { if (this.autoExpands_ == autoExpands) return; @@ -206,7 +214,9 @@ * Whether or not the rows on list have various heights. * @type {boolean} */ - get fixedHeight() { return this.fixedHeight_; }, + get fixedHeight() { + return this.fixedHeight_; + }, set fixedHeight(fixedHeight) { if (this.fixedHeight_ == fixedHeight) return; @@ -243,7 +253,9 @@ var indexes = this.selectionModel.selectedIndexes; var dataModel = this.dataModel; if (dataModel) { - return indexes.map(function(i) { return dataModel.item(i); }); + return indexes.map(function(i) { + return dataModel.item(i); + }); } return []; }, @@ -275,7 +287,9 @@ * sure that the code will not return without calling endBatchUpdates or the * list will not be correctly updated. */ - startBatchUpdates: function() { this.batchCount_++; }, + startBatchUpdates: function() { + this.batchCount_++; + }, /** * See startBatchUpdates. @@ -684,13 +698,17 @@ * @return {number} The row of the item. May vary in the case * of multiple columns. */ - getItemRow: function(index) { return index; }, + getItemRow: function(index) { + return index; + }, /** * @param {number} row The row. * @return {number} The index of the first item in the row. */ - getFirstItemInRow: function(row) { return row; }, + getFirstItemInRow: function(row) { + return row; + }, /** * Ensures that a given index is inside the viewport. @@ -713,7 +731,9 @@ var self = this; // Function to adjust the tops of viewport and row. - function scrollToAdjustTop() { self.scrollTop = top; } + function scrollToAdjustTop() { + self.scrollTop = top; + } // Function to adjust the bottoms of viewport and row. function scrollToAdjustBottom() { self.scrollTop = top + itemHeight - availableHeight;
diff --git a/ui/webui/resources/js/cr/ui/list_item.js b/ui/webui/resources/js/cr/ui/list_item.js index d86191a9..45ff813 100644 --- a/ui/webui/resources/js/cr/ui/list_item.js +++ b/ui/webui/resources/js/cr/ui/list_item.js
@@ -25,8 +25,12 @@ * Plain text label. * @type {string} */ - get label() { return this.textContent; }, - set label(label) { this.textContent = label; }, + get label() { + return this.textContent; + }, + set label(label) { + this.textContent = label; + }, /** * This item's index in the containing list. @@ -54,8 +58,9 @@ * selection model. This is only used for display purpose. */ cr.defineProperty( - ListItem, 'selected', cr.PropertyKind.BOOL_ATTR, - function() { this.selectionChanged(); }); + ListItem, 'selected', cr.PropertyKind.BOOL_ATTR, function() { + this.selectionChanged(); + }); /** * Whether the item is the lead in a selection. Setting this does not update
diff --git a/ui/webui/resources/js/cr/ui/list_selection_controller.js b/ui/webui/resources/js/cr/ui/list_selection_controller.js index ef925ea4..65525ad 100644 --- a/ui/webui/resources/js/cr/ui/list_selection_controller.js +++ b/ui/webui/resources/js/cr/ui/list_selection_controller.js
@@ -26,7 +26,9 @@ * The selection model we are interacting with. * @type {cr.ui.ListSelectionModel} */ - get selectionModel() { return this.selectionModel_; }, + get selectionModel() { + return this.selectionModel_; + }, /** * Returns the index below (y axis) the given element. @@ -44,7 +46,9 @@ * @param {number} index The index to get the index above. * @return {number} The index below or -1 if not found. */ - getIndexAbove: function(index) { return index - 1; }, + getIndexAbove: function(index) { + return index - 1; + }, /** * Returns the index before (x axis) the given element. This returns -1 @@ -54,7 +58,9 @@ * @param {number} index The index to get the index before. * @return {number} The index before or -1 if not found. */ - getIndexBefore: function(index) { return -1; }, + getIndexBefore: function(index) { + return -1; + }, /** * Returns the index after (x axis) the given element. This returns -1 @@ -64,7 +70,9 @@ * @param {number} index The index to get the index after. * @return {number} The index after or -1 if not found. */ - getIndexAfter: function(index) { return -1; }, + getIndexAfter: function(index) { + return -1; + }, /** * Returns the next list index. This is the next logical and should not @@ -84,17 +92,23 @@ * @param {number} index The index to get the previous index for. * @return {number} The previous index or -1 if not found. */ - getPreviousIndex: function(index) { return index - 1; }, + getPreviousIndex: function(index) { + return index - 1; + }, /** * @return {number} The first index. */ - getFirstIndex: function() { return 0; }, + getFirstIndex: function() { + return 0; + }, /** * @return {number} The last index. */ - getLastIndex: function() { return this.selectionModel.length - 1; }, + getLastIndex: function() { + return this.selectionModel.length - 1; + }, /** * Called by the view when the user does a mousedown or mouseup on the
diff --git a/ui/webui/resources/js/cr/ui/list_selection_model.js b/ui/webui/resources/js/cr/ui/list_selection_model.js index 1609e75..a51f2ac9 100644 --- a/ui/webui/resources/js/cr/ui/list_selection_model.js +++ b/ui/webui/resources/js/cr/ui/list_selection_model.js
@@ -30,7 +30,9 @@ * The number of items in the model. * @type {number} */ - get length() { return this.length_; }, + get length() { + return this.length_; + }, /** * The selected indexes. @@ -262,7 +264,9 @@ * the user is moving using the arrow keys. * @type {number} */ - get leadIndex() { return this.leadIndex_; }, + get leadIndex() { + return this.leadIndex_; + }, set leadIndex(leadIndex) { var oldValue = this.leadIndex_; var newValue = this.adjustIndex_(leadIndex); @@ -279,7 +283,9 @@ * The anchorIndex is used with multiple selection. * @type {number} */ - get anchorIndex() { return this.anchorIndex_; }, + get anchorIndex() { + return this.anchorIndex_; + }, set anchorIndex(anchorIndex) { var oldValue = this.anchorIndex_; var newValue = this.adjustIndex_(anchorIndex); @@ -311,7 +317,9 @@ * Whether the selection model supports multiple selected items. * @type {boolean} */ - get multiple() { return true; }, + get multiple() { + return true; + }, /** * Adjusts the selection after reordering of items in the table. @@ -323,10 +331,13 @@ var oldAnchorIndex = this.anchorIndex; var oldSelectedItemsCount = this.selectedIndexes.length; - this.selectedIndexes = - this.selectedIndexes - .map(function(oldIndex) { return permutation[oldIndex]; }) - .filter(function(index) { return index != -1; }); + this.selectedIndexes = this.selectedIndexes + .map(function(oldIndex) { + return permutation[oldIndex]; + }) + .filter(function(index) { + return index != -1; + }); // Will be adjusted in endChange. if (oldLeadIndex != -1) @@ -348,7 +359,9 @@ * Adjusts selection model length. * @param {number} length New selection model length. */ - adjustLength: function(length) { this.length_ = length; } + adjustLength: function(length) { + this.length_ = length; + } }; return {ListSelectionModel: ListSelectionModel};
diff --git a/ui/webui/resources/js/cr/ui/list_single_selection_model.js b/ui/webui/resources/js/cr/ui/list_single_selection_model.js index a5676496b..15865d0 100644 --- a/ui/webui/resources/js/cr/ui/list_single_selection_model.js +++ b/ui/webui/resources/js/cr/ui/list_single_selection_model.js
@@ -29,7 +29,9 @@ * The number of items in the model. * @type {number} */ - get length() { return this.length_; }, + get length() { + return this.length_; + }, /** * @type {!Array} The selected indexes. @@ -47,7 +49,9 @@ * Setter also changes lead and anchor indexes if value is nonegative. * @type {number} */ - get selectedIndex() { return this.selectedIndex_; }, + get selectedIndex() { + return this.selectedIndex_; + }, set selectedIndex(selectedIndex) { var oldSelectedIndex = this.selectedIndex; var i = Math.max(-1, Math.min(this.length_ - 1, selectedIndex)); @@ -91,7 +95,9 @@ /** * Unselects all selected items. */ - unselectAll: function() { this.selectedIndex = -1; }, + unselectAll: function() { + this.selectedIndex = -1; + }, /** * Sets the selected state for an index. @@ -115,7 +121,9 @@ * @param {number} index The index to check. * @return {boolean} Whether an index is selected. */ - getIndexSelected: function(index) { return index == this.selectedIndex_; }, + getIndexSelected: function(index) { + return index == this.selectedIndex_; + }, /** * This is used to begin batching changes. Call {@code endChange} when you @@ -154,7 +162,10 @@ var e = new Event(eventName); var indexes = [this.selectedIndexBefore_, this.selectedIndex_]; e.changes = - indexes.filter(function(index) { return index != -1; }) + indexes + .filter(function(index) { + return index != -1; + }) .map(function(index) { return {index: index, selected: index == this.selectedIndex_}; }, this); @@ -169,7 +180,9 @@ * the user is moving using the arrow keys. * @type {number} */ - get leadIndex() { return this.leadIndex_; }, + get leadIndex() { + return this.leadIndex_; + }, set leadIndex(leadIndex) { var li = this.adjustIndex_(leadIndex); if (li != this.leadIndex_) { @@ -191,14 +204,20 @@ * The anchorIndex is used with multiple selection. * @type {number} */ - get anchorIndex() { return this.leadIndex; }, - set anchorIndex(anchorIndex) { this.leadIndex = anchorIndex; }, + get anchorIndex() { + return this.leadIndex; + }, + set anchorIndex(anchorIndex) { + this.leadIndex = anchorIndex; + }, /** * Whether the selection model supports multiple selected items. * @type {boolean} */ - get multiple() { return false; }, + get multiple() { + return false; + }, /** * Adjusts the selection after reordering of items in the table. @@ -218,7 +237,9 @@ * Adjusts selection model length. * @param {number} length New selection model length. */ - adjustLength: function(length) { this.length_ = length; } + adjustLength: function(length) { + this.length_ = length; + } }; return {ListSingleSelectionModel: ListSingleSelectionModel};
diff --git a/ui/webui/resources/js/cr/ui/menu.js b/ui/webui/resources/js/cr/ui/menu.js index cac465d..82013972 100644 --- a/ui/webui/resources/js/cr/ui/menu.js +++ b/ui/webui/resources/js/cr/ui/menu.js
@@ -77,7 +77,9 @@ /** * Clears menu. */ - clear: function() { this.textContent = ''; }, + clear: function() { + this.textContent = ''; + }, /** * Walks up the ancestors of |node| until a menu item belonging to this menu @@ -108,7 +110,9 @@ * @param {Event} e The mouseout event. * @private */ - handleMouseOut_: function(e) { this.selectedItem = null; }, + handleMouseOut_: function(e) { + this.selectedItem = null; + }, /** * If there's a mouseup that happens quickly in about the same position, @@ -137,7 +141,9 @@ * @private * @suppress {checkTypes} */ - trustEvent_: function(e) { return e.isTrusted || e.isTrustedForTesting; }, + trustEvent_: function(e) { + return e.isTrusted || e.isTrustedForTesting; + }, get menuItems() { return this.querySelectorAll(this.menuItemSelector || '*'); @@ -147,7 +153,9 @@ * The selected menu item or null if none. * @type {cr.ui.MenuItem} */ - get selectedItem() { return this.menuItems[this.selectedIndex]; }, + get selectedItem() { + return this.menuItems[this.selectedIndex]; + }, set selectedItem(item) { var index = Array.prototype.indexOf.call(this.menuItems, item); this.selectedIndex = index; @@ -172,7 +180,9 @@ /** * Menu length */ - get length() { return this.menuItems.length; }, + get length() { + return this.menuItems.length; + }, /** * Returns if the menu has any visible item.
diff --git a/ui/webui/resources/js/cr/ui/menu_button.js b/ui/webui/resources/js/cr/ui/menu_button.js index a42aa3e..d54de2d 100644 --- a/ui/webui/resources/js/cr/ui/menu_button.js +++ b/ui/webui/resources/js/cr/ui/menu_button.js
@@ -67,7 +67,9 @@ * The menu associated with the menu button. * @type {cr.ui.Menu} */ - get menu() { return this.menu_; }, + get menu() { + return this.menu_; + }, set menu(menu) { if (typeof menu == 'string' && menu[0] == '#') { menu = assert(this.ownerDocument.getElementById(menu.slice(1))); @@ -240,7 +242,9 @@ /** * Whether the menu is shown. */ - isMenuShown: function() { return this.hasAttribute('menu-shown'); }, + isMenuShown: function() { + return this.hasAttribute('menu-shown'); + }, /** * Positions the menu below the menu button. At this point we do not use any
diff --git a/ui/webui/resources/js/cr/ui/menu_item.js b/ui/webui/resources/js/cr/ui/menu_item.js index eaf5b62..17f2783 100644 --- a/ui/webui/resources/js/cr/ui/menu_item.js +++ b/ui/webui/resources/js/cr/ui/menu_item.js
@@ -58,7 +58,9 @@ * @type {cr.ui.Command} */ command_: null, - get command() { return this.command_; }, + get command() { + return this.command_; + }, set command(command) { if (this.command_) { this.command_.removeEventListener('labelChange', this); @@ -96,20 +98,30 @@ * The text label. * @type {string} */ - get label() { return this.textContent; }, - set label(label) { this.textContent = label; }, + get label() { + return this.textContent; + }, + set label(label) { + this.textContent = label; + }, /** * Menu icon. * @type {string} */ - get iconUrl() { return this.style.backgroundImage; }, - set iconUrl(url) { this.style.backgroundImage = 'url(' + url + ')'; }, + get iconUrl() { + return this.style.backgroundImage; + }, + set iconUrl(url) { + this.style.backgroundImage = 'url(' + url + ')'; + }, /** * @return {boolean} Whether the menu item is a separator. */ - isSeparator: function() { return this.tagName == 'HR'; }, + isSeparator: function() { + return this.tagName == 'HR'; + }, /** * Updates shortcut text according to associated command. If command has
diff --git a/ui/webui/resources/js/cr/ui/overlay.js b/ui/webui/resources/js/cr/ui/overlay.js index 2ea09c34..2e068c4 100644 --- a/ui/webui/resources/js/cr/ui/overlay.js +++ b/ui/webui/resources/js/cr/ui/overlay.js
@@ -26,7 +26,9 @@ * @return {HTMLElement} The default button. */ function getDefaultButton(overlay) { - function isHidden(node) { return node.hidden; } + function isHidden(node) { + return node.hidden; + } var defaultButtons = /** @type !NodeList<!HTMLElement> */ ( overlay.querySelectorAll('.page .button-strip > .default-button')); for (var i = 0; i < defaultButtons.length; i++) { @@ -111,8 +113,9 @@ else this.removeAttribute('hidden'); }); - overlay.__defineGetter__( - 'hidden', function() { return this.hasAttribute('hidden'); }); + overlay.__defineGetter__('hidden', function() { + return this.hasAttribute('hidden'); + }); // Shake when the user clicks away. overlay.addEventListener('click', function(e) {
diff --git a/ui/webui/resources/js/cr/ui/page_manager/page.js b/ui/webui/resources/js/cr/ui/page_manager/page.js index d4ad892..bf5117e8 100644 --- a/ui/webui/resources/js/cr/ui/page_manager/page.js +++ b/ui/webui/resources/js/cr/ui/page_manager/page.js
@@ -78,7 +78,9 @@ * Sets focus on the first focusable element. Override for a custom focus * strategy. */ - focus: function() { cr.ui.setInitialFocus(this.pageDiv); }, + focus: function() { + cr.ui.setInitialFocus(this.pageDiv); + }, /** * Reverse any buttons strips in this page (only applies to overlays). @@ -94,7 +96,9 @@ * Whether it should be possible to show the page. * @return {boolean} True if the page should be shown. */ - canShowPage: function() { return true; }, + canShowPage: function() { + return true; + }, /** * Updates the hash of the current page. If the page is topmost, the history @@ -183,13 +187,17 @@ * page even if sub-pages change. * @type {boolean} True if this page is sticky. */ - get sticky() { return false; }, + get sticky() { + return false; + }, /** * @type {boolean} True if this page should always be considered the * top-most page when visible. */ - get alwaysOnTop() { return this.alwaysOnTop_; }, + get alwaysOnTop() { + return this.alwaysOnTop_; + }, /** * @type {boolean} True if this page should always be considered the
diff --git a/ui/webui/resources/js/cr/ui/page_manager/page_manager.js b/ui/webui/resources/js/cr/ui/page_manager/page_manager.js index 325bacf..99599b1 100644 --- a/ui/webui/resources/js/cr/ui/page_manager/page_manager.js +++ b/ui/webui/resources/js/cr/ui/page_manager/page_manager.js
@@ -447,13 +447,17 @@ * Change the horizontal offset used to reposition elements while showing an * overlay from the default. */ - set horizontalOffset(value) { this.horizontalOffset_ = value; }, + set horizontalOffset(value) { + this.horizontalOffset_ = value; + }, /** * @param {!cr.ui.pageManager.PageManager.Observer} observer The observer to * register. */ - addObserver: function(observer) { this.observers_.push(observer); }, + addObserver: function(observer) { + this.observers_.push(observer); + }, /** * Shows a registered overlay page. Does not update history. @@ -509,7 +513,9 @@ * @return {boolean} True if an overlay is visible. * @private */ - isOverlayVisible_: function() { return this.getVisibleOverlay_() != null; }, + isOverlayVisible_: function() { + return this.getVisibleOverlay_() != null; + }, /** * Returns the currently visible overlay, or null if no page is visible. @@ -673,7 +679,9 @@ * but should only behave as if they are fixed for vertical scrolling. * @private */ - handleScroll_: function() { this.updateAllFrozenElementPositions_(); }, + handleScroll_: function() { + this.updateAllFrozenElementPositions_(); + }, /** * Updates all frozen pages to match the horizontal scroll position.
diff --git a/ui/webui/resources/js/cr/ui/repeating_button.js b/ui/webui/resources/js/cr/ui/repeating_button.js index 26124fd9..d125afde 100644 --- a/ui/webui/resources/js/cr/ui/repeating_button.js +++ b/ui/webui/resources/js/cr/ui/repeating_button.js
@@ -115,7 +115,9 @@ * @param {!Event} e The triggered event. * @private */ - buttonUp_: function(e) { this.clearTimeout_(); }, + buttonUp_: function(e) { + this.clearTimeout_(); + }, /** * Resets the interval callback. @@ -144,25 +146,33 @@ * Getter for the initial delay before repeating. * @type {number} The delay in milliseconds. */ - get repeatDelay() { return this.holdDelayTime_; }, + get repeatDelay() { + return this.holdDelayTime_; + }, /** * Setter for the initial delay before repeating. * @type {number} The delay in milliseconds. */ - set repeatDelay(delay) { this.holdDelayTime_ = delay; }, + set repeatDelay(delay) { + this.holdDelayTime_ = delay; + }, /** * Getter for the repeat interval. * @type {number} The repeat interval in milliseconds. */ - get repeatInterval() { return this.holdRepeatIntervalTime_; }, + get repeatInterval() { + return this.holdRepeatIntervalTime_; + }, /** * Setter for the repeat interval. * @type {number} The interval in milliseconds. */ - set repeatInterval(delay) { this.holdRepeatIntervalTime_ = delay; } + set repeatInterval(delay) { + this.holdRepeatIntervalTime_ = delay; + } }; return {RepeatingButton: RepeatingButton};
diff --git a/ui/webui/resources/js/cr/ui/splitter.js b/ui/webui/resources/js/cr/ui/splitter.js index b2c601a..6b659bc 100644 --- a/ui/webui/resources/js/cr/ui/splitter.js +++ b/ui/webui/resources/js/cr/ui/splitter.js
@@ -78,7 +78,9 @@ * @param {boolean} resizeNext True if resize the next element. * By default, splitter resizes previous (left) element. */ - set resizeNextElement(resizeNext) { this.resizeNextElement_ = resizeNext; }, + set resizeNextElement(resizeNext) { + this.resizeNextElement_ = resizeNext; + }, /** * Starts the dragging of the splitter. Adds listeners for mouse or touch @@ -187,7 +189,9 @@ * @param {!MouseEvent} e The mouse event. * @private */ - handleMouseMove_: function(e) { this.handleMove_(e.clientX); }, + handleMouseMove_: function(e) { + this.handleMove_(e.clientX); + }, /** * Handles the touch move event. @@ -218,7 +222,9 @@ * @param {!MouseEvent} e The mouse event. * @private */ - handleMouseUp_: function(e) { this.endDrag_(); }, + handleMouseUp_: function(e) { + this.endDrag_(); + }, /** * Handles start of the splitter dragging. Saves current width of the
diff --git a/ui/webui/resources/js/cr/ui/table.js b/ui/webui/resources/js/cr/ui/table.js index fed8ea7..9e28e4c7 100644 --- a/ui/webui/resources/js/cr/ui/table.js +++ b/ui/webui/resources/js/cr/ui/table.js
@@ -32,7 +32,9 @@ * * @type {cr.ui.ArrayDataModel} */ - get dataModel() { return this.list_.dataModel; }, + get dataModel() { + return this.list_.dataModel; + }, set dataModel(dataModel) { if (this.list_.dataModel != dataModel) { if (this.list_.dataModel) { @@ -61,14 +63,18 @@ * * @type {cr.ui.List} */ - get list() { return this.list_; }, + get list() { + return this.list_; + }, /** * The table column model. * * @type {cr.ui.table.TableColumnModel} */ - get columnModel() { return this.columnModel_; }, + get columnModel() { + return this.columnModel_; + }, set columnModel(columnModel) { if (this.columnModel_ != columnModel) { if (this.columnModel_) @@ -88,7 +94,9 @@ * @type * {cr.ui.ListSelectionModel|cr.ui.ListSingleSelectionModel} */ - get selectionModel() { return this.list_.selectionModel; }, + get selectionModel() { + return this.list_.selectionModel; + }, set selectionModel(selectionModel) { if (this.list_.selectionModel != selectionModel) { if (this.dataModel) @@ -102,17 +110,27 @@ * * @type {boolean} */ - get autoExpands() { return this.list_.autoExpands; }, - set autoExpands(autoExpands) { this.list_.autoExpands = autoExpands; }, + get autoExpands() { + return this.list_.autoExpands; + }, + set autoExpands(autoExpands) { + this.list_.autoExpands = autoExpands; + }, - get fixedHeight() { return this.list_.fixedHeight; }, - set fixedHeight(fixedHeight) { this.list_.fixedHeight = fixedHeight; }, + get fixedHeight() { + return this.list_.fixedHeight; + }, + set fixedHeight(fixedHeight) { + this.list_.fixedHeight = fixedHeight; + }, /** * Returns render function for row. * @return {function(*, cr.ui.Table): HTMLElement} Render function. */ - getRenderFunction: function() { return this.list_.renderFunction_; }, + getRenderFunction: function() { + return this.list_.renderFunction_; + }, /** * Sets render function for row. @@ -132,7 +150,9 @@ * * @type {cr.ui.table.TableColumnModel} */ - get header() { return this.header_; }, + get header() { + return this.header_; + }, /** * Initializes the element. @@ -199,7 +219,9 @@ * Ensures that a given index is inside the viewport. * @param {number} i The index of the item to scroll into view. */ - scrollIndexIntoView: function(i) { this.list_.scrollIndexIntoView(i); }, + scrollIndexIntoView: function(i) { + this.list_.scrollIndexIntoView(i); + }, /** * Find the list item element at the given index. @@ -215,7 +237,9 @@ * After sorting we need to redraw header * @param {Event} e The 'sorted' event. */ - handleSorted_: function(e) { this.header_.redraw(); }, + handleSorted_: function(e) { + this.header_.redraw(); + }, /** * This handles data model 'change' and 'splice' events.
diff --git a/ui/webui/resources/js/cr/ui/table/table_column.js b/ui/webui/resources/js/cr/ui/table/table_column.js index 5977383..c5febce 100644 --- a/ui/webui/resources/js/cr/ui/table/table_column.js +++ b/ui/webui/resources/js/cr/ui/table/table_column.js
@@ -75,14 +75,18 @@ * The width of the column. Hidden columns have zero width. * @type {number} */ - get width() { return this.visible_ ? this.width_ : 0; }, + get width() { + return this.visible_ ? this.width_ : 0; + }, /** * The width of the column, disregarding visibility. For hidden columns, * this would be the width of the column if it were to be made visible. * @type {number} */ - get absoluteWidth() { return this.width_; }, + get absoluteWidth() { + return this.width_; + }, }; /**
diff --git a/ui/webui/resources/js/cr/ui/table/table_column_model.js b/ui/webui/resources/js/cr/ui/table/table_column_model.js index 1f6322bd..d2067c88 100644 --- a/ui/webui/resources/js/cr/ui/table/table_column_model.js +++ b/ui/webui/resources/js/cr/ui/table/table_column_model.js
@@ -32,14 +32,18 @@ * The number of the columns. * @type {number} */ - get size() { return this.columns_.length; }, + get size() { + return this.columns_.length; + }, /** * Returns id of column at the given index. * @param {number} index The index of the column. * @return {string} Column id. */ - getId: function(index) { return this.columns_[index].id; }, + getId: function(index) { + return this.columns_[index].id; + }, /** * Returns name of column at the given index. Name is used as column header @@ -47,7 +51,9 @@ * @param {number} index The index of the column. * @return {string} Column name. */ - getName: function(index) { return this.columns_[index].name; }, + getName: function(index) { + return this.columns_[index].name; + }, /** * Sets name of column at the given index. @@ -69,14 +75,18 @@ * @param {number} index The index of the column. * @return {string} Column width in pixels. */ - getWidth: function(index) { return this.columns_[index].width; }, + getWidth: function(index) { + return this.columns_[index].width; + }, /** * Check if the column at the given index should align to the end. * @param {number} index The index of the column. * @return {boolean} True if the column is aligned to end. */ - isEndAlign: function(index) { return this.columns_[index].endAlign; }, + isEndAlign: function(index) { + return this.columns_[index].endAlign; + }, /** * Sets width of column at the given index. @@ -203,7 +213,9 @@ * @param {number} index The column index. * @return {boolean} Whether the column is visible. */ - isVisible: function(index) { return this.columns_[index].visible; } + isVisible: function(index) { + return this.columns_[index].visible; + } }; return {TableColumnModel: TableColumnModel};
diff --git a/ui/webui/resources/js/cr/ui/table/table_header.js b/ui/webui/resources/js/cr/ui/table/table_header.js index 053448b..d82394b8 100644 --- a/ui/webui/resources/js/cr/ui/table/table_header.js +++ b/ui/webui/resources/js/cr/ui/table/table_header.js
@@ -64,7 +64,9 @@ batchCount_: 0, - startBatchUpdates: function() { this.batchCount_++; }, + startBatchUpdates: function() { + this.batchCount_++; + }, endBatchUpdates: function() { this.batchCount_--; @@ -180,7 +182,9 @@ * @param {number} index The index of the column to sort by. */ createSortFunction_: function(index) { - return function() { this.table_.sort(index); }.bind(this); + return function() { + this.table_.sort(index); + }.bind(this); }, /** @@ -221,7 +225,9 @@ * @param {number} index Column index. * @param {Event} e The double click event. */ - handleDblClick_: function(index, e) { this.table_.fitColumn(index); }, + handleDblClick_: function(index, e) { + this.table_.fitColumn(index); + }, /** * Determines whether a full redraw is required.
diff --git a/ui/webui/resources/js/cr/ui/tabs.js b/ui/webui/resources/js/cr/ui/tabs.js index e3a26495..deccce91 100644 --- a/ui/webui/resources/js/cr/ui/tabs.js +++ b/ui/webui/resources/js/cr/ui/tabs.js
@@ -10,8 +10,9 @@ * @return {TabBox} The tab box if found. */ function getTabBox(el) { - return findAncestor( - el, function(node) { return node.tagName == 'TABBOX'; }); + return findAncestor(el, function(node) { + return node.tagName == 'TABBOX'; + }); } /**
diff --git a/ui/webui/resources/js/cr/ui/touch_handler.js b/ui/webui/resources/js/cr/ui/touch_handler.js index b0e2f102..dc7c818 100644 --- a/ui/webui/resources/js/cr/ui/touch_handler.js +++ b/ui/webui/resources/js/cr/ui/touch_handler.js
@@ -414,7 +414,9 @@ * Begin tracking the touchable element, it is eligible for dragging. * @private */ - beginTracking_: function() { this.tracking_ = true; }, + beginTracking_: function() { + this.tracking_ = true; + }, /** * Stop tracking the touchable element, it is no longer dragging.
diff --git a/ui/webui/resources/js/cr/ui/tree.js b/ui/webui/resources/js/cr/ui/tree.js index 04b68ae..53d6da5 100644 --- a/ui/webui/resources/js/cr/ui/tree.js +++ b/ui/webui/resources/js/cr/ui/tree.js
@@ -64,13 +64,17 @@ /** * Returns the tree item that are children of this tree. */ - get items() { return this.children; }, + get items() { + return this.children; + }, /** * Adds a tree item to the tree. * @param {!cr.ui.TreeItem} treeItem The item to add. */ - add: function(treeItem) { this.addAt(treeItem, 0xffffffff); }, + add: function(treeItem) { + this.addAt(treeItem, 0xffffffff); + }, /** * Adds a tree item at the given index. @@ -98,7 +102,9 @@ * The depth of the node. This is 0 for the tree itself. * @type {number} */ - get depth() { return 0; }, + get depth() { + return 0; + }, /** * Handles click events on the tree and forwards the event to the relevant @@ -186,7 +192,9 @@ * The selected tree item or null if none. * @type {cr.ui.TreeItem} */ - get selectedItem() { return this.selectedItem_ || null; }, + get selectedItem() { + return this.selectedItem_ || null; + }, set selectedItem(item) { var oldSelectedItem = this.selectedItem_; if (oldSelectedItem != item) { @@ -282,13 +290,18 @@ /** * The tree items children. */ - get items() { return this.lastElementChild.children; }, + get items() { + return this.lastElementChild.children; + }, /** * The depth of the tree item. * @type {number} */ - depth_: 0, get depth() { return this.depth_; }, + depth_: 0, + get depth() { + return this.depth_; + }, /** * Sets the depth. @@ -311,7 +324,9 @@ * Adds a tree item as a child. * @param {!cr.ui.TreeItem} child The child to add. */ - add: function(child) { this.addAt(child, 0xffffffff); }, + add: function(child) { + this.addAt(child, 0xffffffff); + }, /** * Adds a tree item as a child at a given index. @@ -370,7 +385,9 @@ * Whether the tree item is expanded or not. * @type {boolean} */ - get expanded() { return this.hasAttribute('expanded'); }, + get expanded() { + return this.hasAttribute('expanded'); + }, set expanded(b) { if (this.expanded == b) return; @@ -417,20 +434,28 @@ * The element representing the row that gets highlighted. * @type {!HTMLElement} */ - get rowElement() { return this.firstElementChild; }, + get rowElement() { + return this.firstElementChild; + }, /** * The element containing the label text and the icon. * @type {!HTMLElement} */ - get labelElement() { return this.firstElementChild.lastElementChild; }, + get labelElement() { + return this.firstElementChild.lastElementChild; + }, /** * The label text. * @type {string} */ - get label() { return this.labelElement.textContent; }, - set label(s) { this.labelElement.textContent = s; }, + get label() { + return this.labelElement.textContent; + }, + set label(s) { + this.labelElement.textContent = s; + }, /** * The URL for the icon. @@ -447,7 +472,9 @@ * Whether the tree item is selected or not. * @type {boolean} */ - get selected() { return this.hasAttribute('selected'); }, + get selected() { + return this.hasAttribute('selected'); + }, set selected(b) { if (this.selected == b) return; @@ -472,7 +499,9 @@ * Whether the tree item has children. * @type {boolean} */ - get mayHaveChildren_() { return this.hasAttribute('may-have-children'); }, + get mayHaveChildren_() { + return this.hasAttribute('may-have-children'); + }, set mayHaveChildren_(b) { var rowItem = this.firstElementChild; if (b) { @@ -488,7 +517,9 @@ * Whether the tree item has children. * @type {boolean} */ - get hasChildren() { return !!this.items[0]; }, + get hasChildren() { + return !!this.items[0]; + }, /** * Whether the tree item has children. @@ -547,7 +578,9 @@ } } - function stopPropagation(e) { e.stopPropagation(); } + function stopPropagation(e) { + e.stopPropagation(); + } if (editing) { this.selected = true; @@ -564,8 +597,9 @@ labelEl.appendChild(input); input.addEventListener('keydown', handleKeydown); - input.addEventListener( - 'blur', (function() { this.editing = false; }).bind(this)); + input.addEventListener('blur', (function() { + this.editing = false; + }).bind(this)); // Make sure that double clicks do not expand and collapse the tree // item. @@ -603,7 +637,9 @@ } }, - get editing() { return this.hasAttribute('editing'); } + get editing() { + return this.hasAttribute('editing'); + } }; /**
diff --git a/ui/webui/resources/js/i18n_behavior.js b/ui/webui/resources/js/i18n_behavior.js index e8c55f5b..05c9cf6 100644 --- a/ui/webui/resources/js/i18n_behavior.js +++ b/ui/webui/resources/js/i18n_behavior.js
@@ -64,7 +64,9 @@ * @param {string} id * @return {boolean} */ - i18nExists: function(id) { return loadTimeData.valueExists(id); }, + i18nExists: function(id) { + return loadTimeData.valueExists(id); + }, }; /**
diff --git a/ui/webui/resources/js/load_time_data.js b/ui/webui/resources/js/load_time_data.js index 1ed68a6..38b4721e 100644 --- a/ui/webui/resources/js/load_time_data.js +++ b/ui/webui/resources/js/load_time_data.js
@@ -39,13 +39,17 @@ * Returns a JsEvalContext for |data_|. * @returns {JsEvalContext} */ - createJsEvalContext: function() { return new JsEvalContext(this.data_); }, + createJsEvalContext: function() { + return new JsEvalContext(this.data_); + }, /** * @param {string} id An ID of a value that might exist. * @return {boolean} True if |id| is a key in the dictionary. */ - valueExists: function(id) { return id in this.data_; }, + valueExists: function(id) { + return id in this.data_; + }, /** * Fetches a value, expecting that it exists. @@ -84,8 +88,9 @@ return ''; var varArgs = arguments; - return value.replace( - /\$[$1-9]/g, function(m) { return m == '$$' ? '$' : varArgs[m[1]]; }); + return value.replace(/\$[$1-9]/g, function(m) { + return m == '$$' ? '$' : varArgs[m[1]]; + }); }, /**
diff --git a/ui/webui/resources/js/parse_html_subset.js b/ui/webui/resources/js/parse_html_subset.js index bd53e8e..e1e5739 100644 --- a/ui/webui/resources/js/parse_html_subset.js +++ b/ui/webui/resources/js/parse_html_subset.js
@@ -69,8 +69,9 @@ } return function(s, opt_extraTags, opt_extraAttrs) { - var extraTags = - (opt_extraTags || []).map(function(str) { return str.toUpperCase(); }); + var extraTags = (opt_extraTags || []).map(function(str) { + return str.toUpperCase(); + }); var tags = allowedTags.concat(extraTags); var attrs = merge(allowedAttributes, opt_extraAttrs || {});
diff --git a/ui/webui/resources/js/promise_resolver.js b/ui/webui/resources/js/promise_resolver.js index 58236360..64501d6 100644 --- a/ui/webui/resources/js/promise_resolver.js +++ b/ui/webui/resources/js/promise_resolver.js
@@ -36,14 +36,26 @@ PromiseResolver.prototype = { /** @return {!Promise<T>} */ - get promise() { return this.promise_; }, - set promise(p) { assertNotReached(); }, + get promise() { + return this.promise_; + }, + set promise(p) { + assertNotReached(); + }, /** @return {function(T=): void} */ - get resolve() { return this.resolve_; }, - set resolve(r) { assertNotReached(); }, + get resolve() { + return this.resolve_; + }, + set resolve(r) { + assertNotReached(); + }, /** @return {function(*=): void} */ - get reject() { return this.reject_; }, - set reject(s) { assertNotReached(); }, + get reject() { + return this.reject_; + }, + set reject(s) { + assertNotReached(); + }, };
diff --git a/ui/webui/resources/js/util.js b/ui/webui/resources/js/util.js index 77d7835..cdc8ed7 100644 --- a/ui/webui/resources/js/util.js +++ b/ui/webui/resources/js/util.js
@@ -40,7 +40,9 @@ element.style.height = '0px'; element.innerText = msg; document.body.appendChild(element); - window.setTimeout(function() { document.body.removeChild(element); }, 0); + window.setTimeout(function() { + document.body.removeChild(element); + }, 0); } /** @@ -523,7 +525,9 @@ */ function importModules(moduleNames) { return new Promise(function(resolve) { - define(moduleNames, function() { resolve(Array.from(arguments)); }); + define(moduleNames, function() { + resolve(Array.from(arguments)); + }); }); }
diff --git a/ui/webui/resources/js/web_ui_listener_behavior.js b/ui/webui/resources/js/web_ui_listener_behavior.js index d7fc56b5..35611ba 100644 --- a/ui/webui/resources/js/web_ui_listener_behavior.js +++ b/ui/webui/resources/js/web_ui_listener_behavior.js
@@ -17,7 +17,9 @@ */ webUIListeners_: { type: Array, - value: function() { return []; }, + value: function() { + return []; + }, }, },
diff --git a/url/features.gni b/url/features.gni index 3b55cc7..3e0b75b 100644 --- a/url/features.gni +++ b/url/features.gni
@@ -5,7 +5,12 @@ # Features used by targets inside and outside of |url|. # For details see declare_args() in build/config/BUILDCONFIG.gn. declare_args() { - # Enables the use of ICU alternatives in lieu of ICU. The flag is used - # for Cronet to reduce the size of the Cronet binary. + # Enables the use of ICU alternatives in lieu of ICU for the target toolchain. + # The flag is used for Cronet to reduce the size of the Cronet binary. use_platform_icu_alternatives = false } + +# Never use platform icu for host toolchain. +# E.g. Don't apply this for host binaries when target_os = "android". +use_platform_icu_alternatives = + use_platform_icu_alternatives && current_toolchain == default_toolchain