diff --git a/DEPS b/DEPS index 65d0203..8a0839613 100644 --- a/DEPS +++ b/DEPS
@@ -60,7 +60,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling SwiftShader # and whatever else without interference from each other. - 'swiftshader_revision': '3d689f726f081dd67abfab2c365768e9576cf61a', + 'swiftshader_revision': 'ab5339f798e15f8eeb7fb4f983d523e7770058a2', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling PDFium # and whatever else without interference from each other.
diff --git a/base/logging.h b/base/logging.h index c0ebaf9..fdb210d8 100644 --- a/base/logging.h +++ b/base/logging.h
@@ -628,16 +628,20 @@ // The (int, int) specialization works around the issue that the compiler // will not instantiate the template version of the function on values of // unnamed enum type - see comment below. -#define DEFINE_CHECK_OP_IMPL(name, op) \ - template <class t1, class t2> \ - inline std::string* Check##name##Impl(const t1& v1, const t2& v2, \ - const char* names) { \ - if (v1 op v2) return NULL; \ - else return ::logging::MakeCheckOpString(v1, v2, names); \ - } \ +#define DEFINE_CHECK_OP_IMPL(name, op) \ + template <class t1, class t2> \ + inline std::string* Check##name##Impl(const t1& v1, const t2& v2, \ + const char* names) { \ + if (ANALYZER_ASSUME_TRUE(v1 op v2)) \ + return NULL; \ + else \ + return ::logging::MakeCheckOpString(v1, v2, names); \ + } \ inline std::string* Check##name##Impl(int v1, int v2, const char* names) { \ - if (v1 op v2) return NULL; \ - else return ::logging::MakeCheckOpString(v1, v2, names); \ + if (ANALYZER_ASSUME_TRUE(v1 op v2)) \ + return NULL; \ + else \ + return ::logging::MakeCheckOpString(v1, v2, names); \ } DEFINE_CHECK_OP_IMPL(EQ, ==) DEFINE_CHECK_OP_IMPL(NE, !=)
diff --git a/build/toolchain/toolchain.gni b/build/toolchain/toolchain.gni index 48e3671..5722c12 100644 --- a/build/toolchain/toolchain.gni +++ b/build/toolchain/toolchain.gni
@@ -50,7 +50,12 @@ declare_args() { if (is_clang) { # Clang compiler version. Clang files are placed at version-dependent paths. - clang_version = "4.0.0" + if (llvm_force_head_revision) { + clang_version = "5.0.0" + } else { + # TODO(thakis): Remove this branch the next time clang rolls. + clang_version = "4.0.0" + } } }
diff --git a/cc/ipc/BUILD.gn b/cc/ipc/BUILD.gn index 42eaf44..9ca8aa5 100644 --- a/cc/ipc/BUILD.gn +++ b/cc/ipc/BUILD.gn
@@ -44,6 +44,7 @@ "compositor_frame_metadata.mojom", "copy_output_request.mojom", "copy_output_result.mojom", + "display_compositor.mojom", "filter_operation.mojom", "filter_operations.mojom", "frame_sink_id.mojom", @@ -72,20 +73,6 @@ ] } -# Interfaces between two privileged services. -mojom("internal_interfaces") { - sources = [ - "display_compositor.mojom", - ] - - public_deps = [ - ":interfaces", - "//gpu/ipc/common:interfaces", - "//ui/gfx/geometry/mojo", - "//ui/gfx/mojo", - ] -} - mojom("test_interfaces") { testonly = true sources = [ @@ -96,51 +83,3 @@ ":interfaces", ] } - -cc_source_set("struct_traits") { - sources = [ - "begin_frame_args_struct_traits.h", - "compositor_frame_metadata_struct_traits.cc", - "compositor_frame_metadata_struct_traits.h", - "compositor_frame_struct_traits.cc", - "compositor_frame_struct_traits.h", - "copy_output_request_struct_traits.cc", - "copy_output_request_struct_traits.h", - "copy_output_result_struct_traits.cc", - "copy_output_result_struct_traits.h", - "filter_operation_struct_traits.h", - "filter_operations_struct_traits.h", - "frame_sink_id_struct_traits.h", - "local_surface_id_struct_traits.h", - "quads_struct_traits.cc", - "quads_struct_traits.h", - "render_pass_struct_traits.cc", - "render_pass_struct_traits.h", - "selection_struct_traits.h", - "shared_quad_state_struct_traits.h", - "surface_id_struct_traits.h", - "surface_info_struct_traits.h", - "surface_reference_struct_traits.h", - "surface_sequence_struct_traits.h", - "texture_mailbox_struct_traits.h", - "transferable_resource_struct_traits.cc", - "transferable_resource_struct_traits.h", - ] - public_deps = [ - ":interfaces_shared_cpp_sources", - "//base", - "//cc", - "//cc/surfaces:surface_id", - "//gpu/ipc/common:struct_traits", - "//mojo/common:struct_traits", - "//skia/public/interfaces", - "//skia/public/interfaces:struct_traits", - "//ui/events:events_base", - "//ui/events/mojo:struct_traits", - "//ui/gfx", - "//ui/gfx:selection_bound", - "//ui/gfx/geometry/mojo:struct_traits", - "//ui/gfx/mojo:mojo", - "//ui/gfx/mojo:struct_traits", - ] -}
diff --git a/cc/ipc/compositor_frame.typemap b/cc/ipc/compositor_frame.typemap index 5e23e63..8908d15 100644 --- a/cc/ipc/compositor_frame.typemap +++ b/cc/ipc/compositor_frame.typemap
@@ -6,7 +6,7 @@ public_headers = [ "//cc/output/compositor_frame.h" ] traits_headers = [ "//cc/ipc/compositor_frame_struct_traits.h" ] sources = [ - "//cc/ipc:struct_traits", + "compositor_frame_struct_traits.cc", ] deps = [ "//cc",
diff --git a/cc/ipc/compositor_frame_for_blink.typemap b/cc/ipc/compositor_frame_for_blink.typemap index 046b359..49f3df4 100644 --- a/cc/ipc/compositor_frame_for_blink.typemap +++ b/cc/ipc/compositor_frame_for_blink.typemap
@@ -24,11 +24,9 @@ "//ui/gfx/mojo/transform_struct_traits.h", "//ui/events/mojo/latency_info_struct_traits.h", ] -sources = [ - "//cc/ipc:struct_traits", -] public_deps = [ "//cc", + "//cc/ipc:interfaces", "//gpu/ipc/common:interfaces", "//mojo/common:common_custom_types", "//skia/public/interfaces",
diff --git a/cc/ipc/compositor_frame_metadata.typemap b/cc/ipc/compositor_frame_metadata.typemap index 882913b9..4b6255b 100644 --- a/cc/ipc/compositor_frame_metadata.typemap +++ b/cc/ipc/compositor_frame_metadata.typemap
@@ -6,7 +6,7 @@ public_headers = [ "//cc/output/compositor_frame_metadata.h" ] traits_headers = [ "//cc/ipc/compositor_frame_metadata_struct_traits.h" ] sources = [ - "//cc/ipc:struct_traits", + "compositor_frame_metadata_struct_traits.cc", ] type_mappings = [ "cc.mojom.CompositorFrameMetadata=cc::CompositorFrameMetadata" ]
diff --git a/cc/ipc/copy_output_request.typemap b/cc/ipc/copy_output_request.typemap index 7be7326..90c7d7c 100644 --- a/cc/ipc/copy_output_request.typemap +++ b/cc/ipc/copy_output_request.typemap
@@ -6,6 +6,6 @@ public_headers = [ "//cc/output/copy_output_request.h" ] traits_headers = [ "//cc/ipc/copy_output_request_struct_traits.h" ] sources = [ - "//cc/ipc:struct_traits", + "copy_output_request_struct_traits.cc", ] type_mappings = [ "cc.mojom.CopyOutputRequest=std::unique_ptr<cc::CopyOutputRequest>[move_only]" ]
diff --git a/cc/ipc/copy_output_result.typemap b/cc/ipc/copy_output_result.typemap index 25c129f..1d75c42 100644 --- a/cc/ipc/copy_output_result.typemap +++ b/cc/ipc/copy_output_result.typemap
@@ -10,6 +10,6 @@ "//skia/public/interfaces:struct_traits", ] sources = [ - "//cc/ipc:struct_traits", + "copy_output_result_struct_traits.cc", ] type_mappings = [ "cc.mojom.CopyOutputResult=std::unique_ptr<cc::CopyOutputResult>[move_only]" ]
diff --git a/cc/ipc/filter_operation.typemap b/cc/ipc/filter_operation.typemap index 780d9714..1acfef0 100644 --- a/cc/ipc/filter_operation.typemap +++ b/cc/ipc/filter_operation.typemap
@@ -5,7 +5,4 @@ mojom = "//cc/ipc/filter_operation.mojom" public_headers = [ "//cc/output/filter_operation.h" ] traits_headers = [ "//cc/ipc/filter_operation_struct_traits.h" ] -deps = [ - "//cc/ipc:struct_traits", -] type_mappings = [ "cc.mojom.FilterOperation=cc::FilterOperation" ]
diff --git a/cc/ipc/filter_operations.typemap b/cc/ipc/filter_operations.typemap index 46f8215b..5c0cc0e 100644 --- a/cc/ipc/filter_operations.typemap +++ b/cc/ipc/filter_operations.typemap
@@ -5,7 +5,4 @@ mojom = "//cc/ipc/filter_operations.mojom" public_headers = [ "//cc/output/filter_operations.h" ] traits_headers = [ "//cc/ipc/filter_operations_struct_traits.h" ] -deps = [ - "//cc/ipc:struct_traits", -] type_mappings = [ "cc.mojom.FilterOperations=cc::FilterOperations" ]
diff --git a/cc/ipc/frame_sink_id.typemap b/cc/ipc/frame_sink_id.typemap index d9c26e2..d63c299 100644 --- a/cc/ipc/frame_sink_id.typemap +++ b/cc/ipc/frame_sink_id.typemap
@@ -5,7 +5,4 @@ mojom = "//cc/ipc/frame_sink_id.mojom" public_headers = [ "//cc/surfaces/frame_sink_id.h" ] traits_headers = [ "//cc/ipc/frame_sink_id_struct_traits.h" ] -deps = [ - "//cc/ipc:struct_traits", -] type_mappings = [ "cc.mojom.FrameSinkId=cc::FrameSinkId" ]
diff --git a/cc/ipc/local_surface_id.typemap b/cc/ipc/local_surface_id.typemap index 37dea33..832477a 100644 --- a/cc/ipc/local_surface_id.typemap +++ b/cc/ipc/local_surface_id.typemap
@@ -5,7 +5,4 @@ mojom = "//cc/ipc/local_surface_id.mojom" public_headers = [ "//cc/surfaces/local_surface_id.h" ] traits_headers = [ "//cc/ipc/local_surface_id_struct_traits.h" ] -deps = [ - "//cc/ipc:struct_traits", -] type_mappings = [ "cc.mojom.LocalSurfaceId=cc::LocalSurfaceId" ]
diff --git a/cc/ipc/render_pass.typemap b/cc/ipc/render_pass.typemap index 01a1fa7..3f8b23d9 100644 --- a/cc/ipc/render_pass.typemap +++ b/cc/ipc/render_pass.typemap
@@ -12,6 +12,7 @@ "//cc/ipc/render_pass_struct_traits.h", ] sources = [ - "//cc/ipc:struct_traits", + "quads_struct_traits.cc", + "render_pass_struct_traits.cc", ] type_mappings = [ "cc.mojom.RenderPass=std::unique_ptr<cc::RenderPass>[move_only,nullable_is_same_type]" ]
diff --git a/cc/ipc/selection.typemap b/cc/ipc/selection.typemap index a591ee8..377cd9b 100644 --- a/cc/ipc/selection.typemap +++ b/cc/ipc/selection.typemap
@@ -8,7 +8,4 @@ "//ui/gfx/selection_bound.h", ] traits_headers = [ "//cc/ipc/selection_struct_traits.h" ] -deps = [ - "//cc/ipc:struct_traits", -] type_mappings = [ "cc.mojom.Selection=cc::Selection<gfx::SelectionBound>" ]
diff --git a/cc/ipc/shared_quad_state.typemap b/cc/ipc/shared_quad_state.typemap index fd58de1d..5b08d8b 100644 --- a/cc/ipc/shared_quad_state.typemap +++ b/cc/ipc/shared_quad_state.typemap
@@ -5,7 +5,4 @@ mojom = "//cc/ipc/shared_quad_state.mojom" public_headers = [ "//cc/quads/shared_quad_state.h" ] traits_headers = [ "//cc/ipc/shared_quad_state_struct_traits.h" ] -deps = [ - "//cc/ipc:struct_traits", -] type_mappings = [ "cc.mojom.SharedQuadState=cc::SharedQuadState" ]
diff --git a/cc/ipc/surface_id.typemap b/cc/ipc/surface_id.typemap index 6a437ef04..f272a820 100644 --- a/cc/ipc/surface_id.typemap +++ b/cc/ipc/surface_id.typemap
@@ -5,7 +5,4 @@ mojom = "//cc/ipc/surface_id.mojom" public_headers = [ "//cc/surfaces/surface_id.h" ] traits_headers = [ "//cc/ipc/surface_id_struct_traits.h" ] -deps = [ - "//cc/ipc:struct_traits", -] type_mappings = [ "cc.mojom.SurfaceId=cc::SurfaceId" ]
diff --git a/cc/ipc/surface_info.typemap b/cc/ipc/surface_info.typemap index 3faab7de..348a28e 100644 --- a/cc/ipc/surface_info.typemap +++ b/cc/ipc/surface_info.typemap
@@ -5,7 +5,4 @@ mojom = "//cc/ipc/surface_info.mojom" public_headers = [ "//cc/surfaces/surface_info.h" ] traits_headers = [ "//cc/ipc/surface_info_struct_traits.h" ] -deps = [ - "//cc/ipc:struct_traits", -] type_mappings = [ "cc.mojom.SurfaceInfo=cc::SurfaceInfo" ]
diff --git a/cc/ipc/surface_reference.typemap b/cc/ipc/surface_reference.typemap index cb35490..63bff2d 100644 --- a/cc/ipc/surface_reference.typemap +++ b/cc/ipc/surface_reference.typemap
@@ -5,7 +5,4 @@ mojom = "//cc/ipc/surface_reference.mojom" public_headers = [ "//cc/surfaces/surface_reference.h" ] traits_headers = [ "//cc/ipc/surface_reference_struct_traits.h" ] -deps = [ - "//cc/ipc:struct_traits", -] type_mappings = [ "cc.mojom.SurfaceReference=cc::SurfaceReference" ]
diff --git a/cc/ipc/texture_mailbox.typemap b/cc/ipc/texture_mailbox.typemap index 9855c31..71d9947 100644 --- a/cc/ipc/texture_mailbox.typemap +++ b/cc/ipc/texture_mailbox.typemap
@@ -5,7 +5,4 @@ mojom = "//cc/ipc/texture_mailbox.mojom" public_headers = [ "//cc/resources/texture_mailbox.h" ] traits_headers = [ "//cc/ipc/texture_mailbox_struct_traits.h" ] -sources = [ - "//cc/ipc:struct_traits", -] type_mappings = [ "cc.mojom.TextureMailbox=cc::TextureMailbox" ]
diff --git a/cc/ipc/transferable_resource.typemap b/cc/ipc/transferable_resource.typemap index 4a0b051..8bb550f0 100644 --- a/cc/ipc/transferable_resource.typemap +++ b/cc/ipc/transferable_resource.typemap
@@ -6,6 +6,6 @@ public_headers = [ "//cc/resources/transferable_resource.h" ] traits_headers = [ "//cc/ipc/transferable_resource_struct_traits.h" ] sources = [ - "//cc/ipc:struct_traits", + "transferable_resource_struct_traits.cc", ] type_mappings = [ "cc.mojom.TransferableResource=cc::TransferableResource" ]
diff --git a/cc/scheduler/begin_frame_source.cc b/cc/scheduler/begin_frame_source.cc index d05e2df..e8cda0e 100644 --- a/cc/scheduler/begin_frame_source.cc +++ b/cc/scheduler/begin_frame_source.cc
@@ -39,7 +39,9 @@ DCHECK(args.IsValid()); DCHECK(args.frame_time >= last_begin_frame_args_.frame_time); DCHECK(args.sequence_number > last_begin_frame_args_.sequence_number || - args.source_id != last_begin_frame_args_.source_id); + args.source_id != last_begin_frame_args_.source_id) + << "current " << args.AsValue()->ToString() << ", last " + << last_begin_frame_args_.AsValue()->ToString(); bool used = OnBeginFrameDerivedImpl(args); if (used) { last_begin_frame_args_ = args; @@ -201,6 +203,11 @@ (current_begin_frame_args_.frame_time > last_args.frame_time + current_begin_frame_args_.interval / kDoubleTickDivisor)) { + DCHECK(current_begin_frame_args_.sequence_number > + last_args.sequence_number || + current_begin_frame_args_.source_id != last_args.source_id) + << "current " << current_begin_frame_args_.AsValue()->ToString() + << ", last " << last_args.AsValue()->ToString(); obs->OnBeginFrame(current_begin_frame_args_); } } @@ -259,7 +266,9 @@ (missed_begin_frame_args_.frame_time > last_args.frame_time)) { DCHECK((missed_begin_frame_args_.source_id != last_args.source_id) || (missed_begin_frame_args_.sequence_number > - last_args.sequence_number)); + last_args.sequence_number)) + << "current " << missed_begin_frame_args_.AsValue()->ToString() + << ", last " << last_args.AsValue()->ToString(); obs->OnBeginFrame(missed_begin_frame_args_); } }
diff --git a/cc/test/begin_frame_source_test.cc b/cc/test/begin_frame_source_test.cc index 997aa9955..db4e853 100644 --- a/cc/test/begin_frame_source_test.cc +++ b/cc/test/begin_frame_source_test.cc
@@ -35,7 +35,7 @@ FROM_HERE_WITH_EXPLICIT_FUNCTION( "MockBeginFrameObserver::kDefaultBeginFrameArgs"), #endif - 0, + UINT32_MAX, BeginFrameArgs::kStartingFrameNumber, -1, -1,
diff --git a/chrome/app/vector_icons/BUILD.gn b/chrome/app/vector_icons/BUILD.gn index 12f028a..5c70490e 100644 --- a/chrome/app/vector_icons/BUILD.gn +++ b/chrome/app/vector_icons/BUILD.gn
@@ -2,6 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import("//build/util/branding.gni") import("//ui/vector_icons/vector_icons.gni") aggregate_vector_icons("chrome_vector_icons") { @@ -20,6 +21,10 @@ "crashed_tab.icon", "credit_card.1x.icon", "credit_card.icon", + "file_download.icon", + "file_download_incognito.1x.icon", + "file_download_incognito.icon", + "file_download_shelf.icon", "folder.1x.icon", "folder.icon", "folder_managed.1x.icon", @@ -56,6 +61,7 @@ "translate.icon", "zoom_minus.icon", "zoom_plus.icon", + "${branding_path_component}/product.icon", ] }
diff --git a/chrome/app/vector_icons/chromium/product.icon b/chrome/app/vector_icons/chromium/product.icon new file mode 100644 index 0000000..b7cc06d --- /dev/null +++ b/chrome/app/vector_icons/chromium/product.icon
@@ -0,0 +1,31 @@ +// Copyright 2015 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. + +CANVAS_DIMENSIONS, 24, +MOVE_TO, 12, 7.5f, +R_H_LINE_TO, 8.9f, +CUBIC_TO, 19.3f, 4.2f, 15.9f, 2, 12, 2, +CUBIC_TO, 8.9f, 2, 6.1f, 3.4f, 4.3f, 5.6f, +R_LINE_TO, 3.3f, 5.7f, +R_CUBIC_TO, 0.3f, -2.1f, 2.2f, -3.8f, 4.4f, -3.8f, +CLOSE, +R_MOVE_TO, 0, 9, +R_CUBIC_TO, -1.7f, 0, -3.1f, -0.9f, -3.9f, -2.3f, +LINE_TO, 3.6f, 6.5f, +CUBIC_TO, 2.6f, 8.1f, 2, 10, 2, 12, +R_CUBIC_TO, 0, 5, 3.6f, 9.1f, 8.4f, 9.9f, +R_LINE_TO, 3.3f, -5.7f, +R_CUBIC_TO, -0.6f, 0.2f, -1.1f, 0.3f, -1.7f, 0.3f, +CLOSE, +R_MOVE_TO, 4.5f, -4.5f, +R_CUBIC_TO, 0, 0.8f, -0.2f, 1.6f, -0.6f, 2.2f, +LINE_TO, 11.4f, 22, +R_H_LINE_TO, 0.6f, +R_CUBIC_TO, 5.5f, 0, 10, -4.5f, 10, -10, +R_CUBIC_TO, 0, -1.2f, -0.2f, -2.4f, -0.6f, -3.5f, +R_H_LINE_TO, -6.6f, +R_CUBIC_TO, 1, 0.8f, 1.7f, 2.1f, 1.7f, 3.5f, +CLOSE, +CIRCLE, 12, 12, 3.5, +END
diff --git a/chrome/app/vector_icons/file_download.icon b/chrome/app/vector_icons/file_download.icon new file mode 100644 index 0000000..e7067c0 --- /dev/null +++ b/chrome/app/vector_icons/file_download.icon
@@ -0,0 +1,20 @@ +// Copyright 2015 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. + +MOVE_TO, 38, 18, +R_H_LINE_TO, -8, +V_LINE_TO, 6, +H_LINE_TO, 18, +R_V_LINE_TO, 12, +R_H_LINE_TO, -8, +R_LINE_TO, 14, 14, +R_LINE_TO, 14, -14, +CLOSE, +MOVE_TO, 10, 36, +R_V_LINE_TO, 4, +R_H_LINE_TO, 28, +R_V_LINE_TO, -4, +H_LINE_TO, 10, +CLOSE, +END
diff --git a/ui/gfx/vector_icons/file_download_incognito.1x.icon b/chrome/app/vector_icons/file_download_incognito.1x.icon similarity index 100% rename from ui/gfx/vector_icons/file_download_incognito.1x.icon rename to chrome/app/vector_icons/file_download_incognito.1x.icon
diff --git a/ui/gfx/vector_icons/file_download_incognito.icon b/chrome/app/vector_icons/file_download_incognito.icon similarity index 100% rename from ui/gfx/vector_icons/file_download_incognito.icon rename to chrome/app/vector_icons/file_download_incognito.icon
diff --git a/ui/gfx/vector_icons/file_download_shelf.icon b/chrome/app/vector_icons/file_download_shelf.icon similarity index 100% rename from ui/gfx/vector_icons/file_download_shelf.icon rename to chrome/app/vector_icons/file_download_shelf.icon
diff --git a/chrome/app/vector_icons/google_chrome/product.icon b/chrome/app/vector_icons/google_chrome/product.icon new file mode 100644 index 0000000..ec96ab98 --- /dev/null +++ b/chrome/app/vector_icons/google_chrome/product.icon
@@ -0,0 +1,43 @@ +// Copyright 2015 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. + +CANVAS_DIMENSIONS, 24, +// Red +PATH_COLOR_ARGB, 0xFF, 0xDB, 0x44, 0x37, +MOVE_TO, 12, 7.5f, +R_H_LINE_TO, 8.9f, +CUBIC_TO, 19.3f, 4.2f, 15.9f, 2, 12, 2, +CUBIC_TO, 8.9f, 2, 6.1f, 3.4f, 4.3f, 5.6f, +R_LINE_TO, 3.3f, 5.7f, +R_CUBIC_TO, 0.3f, -2.1f, 2.2f, -3.8f, 4.4f, -3.8f, +CLOSE, +NEW_PATH, +// Green +PATH_COLOR_ARGB, 0xFF, 0x0F, 0x9D, 0x58, +// R_MOVE_TO, 0, 9, +MOVE_TO, 12, 16.5f, +R_CUBIC_TO, -1.7f, 0, -3.1f, -0.9f, -3.9f, -2.3f, +LINE_TO, 3.6f, 6.5f, +CUBIC_TO, 2.6f, 8.1f, 2, 10, 2, 12, +R_CUBIC_TO, 0, 5, 3.6f, 9.1f, 8.4f, 9.9f, +R_LINE_TO, 3.3f, -5.7f, +R_CUBIC_TO, -0.6f, 0.2f, -1.1f, 0.3f, -1.7f, 0.3f, +CLOSE, +NEW_PATH, +// Yellow +PATH_COLOR_ARGB, 0xFF, 0xFF, 0xCD, 0x40, +MOVE_TO, 16.5f, 12, +R_CUBIC_TO, 0, 0.8f, -0.2f, 1.6f, -0.6f, 2.2f, +LINE_TO, 11.4f, 22, +R_H_LINE_TO, 0.6f, +R_CUBIC_TO, 5.5f, 0, 10, -4.5f, 10, -10, +R_CUBIC_TO, 0, -1.2f, -0.2f, -2.4f, -0.6f, -3.5f, +R_H_LINE_TO, -6.6f, +R_CUBIC_TO, 1, 0.8f, 1.7f, 2.1f, 1.7f, 3.5f, +CLOSE, +NEW_PATH, +// Blue +PATH_COLOR_ARGB, 0xFF, 0x42, 0x85, 0xF4, +CIRCLE, 12, 12, 3.5, +END
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn index f6d3a70..39a9b233 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn
@@ -1598,7 +1598,11 @@ "//v8", ] } else { - deps += [ "//net:net" ] + deps += [ + "//chrome/app/vector_icons", + "//net:net", + "//ui/vector_icons", + ] } if (is_chromeos && use_cras) {
diff --git a/chrome/browser/chrome_quota_permission_context.cc b/chrome/browser/chrome_quota_permission_context.cc index 986dfba..bc8a2c29 100644 --- a/chrome/browser/chrome_quota_permission_context.cc +++ b/chrome/browser/chrome_quota_permission_context.cc
@@ -23,7 +23,6 @@ #include "content/public/browser/web_contents.h" #include "storage/common/quota/quota_types.h" #include "ui/base/l10n/l10n_util.h" -#include "ui/gfx/vector_icons_public.h" #include "url/gurl.h" #if defined(OS_ANDROID) @@ -33,6 +32,7 @@ #include "components/infobars/core/infobar.h" #else #include "chrome/browser/permissions/permission_request_manager.h" +#include "ui/vector_icons/vector_icons.h" #endif namespace { @@ -87,7 +87,7 @@ #if defined(OS_ANDROID) return IDR_ANDROID_INFOBAR_WARNING; #else - return gfx::VectorIconId::WARNING; + return ui::kWarningIcon; #endif }
diff --git a/chrome/browser/chromeos/BUILD.gn b/chrome/browser/chromeos/BUILD.gn index be9be32c..9e12e95 100644 --- a/chrome/browser/chromeos/BUILD.gn +++ b/chrome/browser/chromeos/BUILD.gn
@@ -42,6 +42,7 @@ "//ash/autoclick/mus/public/interfaces", "//ash/public/interfaces", "//build/linux:fontconfig", + "//chrome/browser/chromeos/printing", "//chrome/browser/devtools", "//chrome/browser/extensions", "//chrome/browser/safe_browsing:chunk_proto", @@ -1175,29 +1176,6 @@ "printer_detector/printer_detector.h", "printer_detector/printer_detector_factory.cc", "printer_detector/printer_detector_factory.h", - "printing/cups_print_job.cc", - "printing/cups_print_job.h", - "printing/cups_print_job_manager.cc", - "printing/cups_print_job_manager.h", - "printing/cups_print_job_manager_factory.cc", - "printing/cups_print_job_manager_factory.h", - "printing/cups_print_job_notification.cc", - "printing/cups_print_job_notification.h", - "printing/cups_print_job_notification_manager.cc", - "printing/cups_print_job_notification_manager.h", - "printing/fake_printer_discoverer.cc", - "printing/fake_printer_discoverer.h", - "printing/ppd_provider_factory.cc", - "printing/ppd_provider_factory.h", - "printing/printer_discoverer.h", - "printing/printers_manager.cc", - "printing/printers_manager.h", - "printing/printers_manager_factory.cc", - "printing/printers_manager_factory.h", - "printing/printers_sync_bridge.cc", - "printing/printers_sync_bridge.h", - "printing/specifics_translation.cc", - "printing/specifics_translation.h", "profiles/avatar_menu_actions_chromeos.cc", "profiles/avatar_menu_actions_chromeos.h", "profiles/avatar_menu_chromeos.cc", @@ -1417,19 +1395,6 @@ "system_logs/touch_log_source_x11.cc", ] } - - if (use_cups) { - sources += [ - "printing/cups_print_job_manager_impl.cc", - "printing/cups_print_job_manager_impl.h", - ] - } else { - sources += [ - "printing/fake_cups_print_job_manager.cc", - "printing/fake_cups_print_job_manager.h", - ] - } - if (use_cras) { defines = [ "USE_CRAS" ] } @@ -1653,8 +1618,6 @@ "power/renderer_freezer_unittest.cc", "preferences_unittest.cc", "printer_detector/printer_detector_unittest.cc", - "printing/printers_manager_unittest.cc", - "printing/specifics_translation_unittest.cc", "profiles/profile_list_chromeos_unittest.cc", "proxy_config_service_impl_unittest.cc", "resource_reporter/resource_reporter_unittest.cc", @@ -1738,6 +1701,7 @@ ":device_policy_proto", ":test_support", "//ash/resources", + "//chrome/browser/chromeos/printing:unit_tests", "//components/drive", "//components/drive:test_support_chromeos", "//components/invalidation/public",
diff --git a/chrome/browser/chromeos/printing/BUILD.gn b/chrome/browser/chromeos/printing/BUILD.gn new file mode 100644 index 0000000..0ed4f70 --- /dev/null +++ b/chrome/browser/chromeos/printing/BUILD.gn
@@ -0,0 +1,70 @@ +# Copyright 2017 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//build/config/features.gni") +import("//printing/features/features.gni") + +assert(is_chromeos) + +source_set("printing") { + sources = [ + "cups_print_job.cc", + "cups_print_job.h", + "cups_print_job_manager.cc", + "cups_print_job_manager.h", + "cups_print_job_manager_factory.cc", + "cups_print_job_manager_factory.h", + "cups_print_job_notification.cc", + "cups_print_job_notification.h", + "cups_print_job_notification_manager.cc", + "cups_print_job_notification_manager.h", + "fake_printer_discoverer.cc", + "fake_printer_discoverer.h", + "ppd_provider_factory.cc", + "ppd_provider_factory.h", + "printer_discoverer.h", + "printers_manager.cc", + "printers_manager.h", + "printers_manager_factory.cc", + "printers_manager_factory.h", + "printers_sync_bridge.cc", + "printers_sync_bridge.h", + "specifics_translation.cc", + "specifics_translation.h", + ] + + if (use_cups) { + sources += [ + "cups_print_job_manager_impl.cc", + "cups_print_job_manager_impl.h", + ] + } else { + sources += [ + "fake_cups_print_job_manager.cc", + "fake_cups_print_job_manager.h", + ] + } + + deps = [ + "//chromeos", + "//components/sync/protocol", + "//printing", + ] +} + +source_set("unit_tests") { + testonly = true + + sources = [ + "printers_manager_unittest.cc", + "specifics_translation_unittest.cc", + ] + + deps = [ + ":printing", + "//components/sync/protocol", + "//testing/gmock", + "//testing/gtest", + ] +}
diff --git a/chrome/browser/custom_handlers/register_protocol_handler_permission_request.cc b/chrome/browser/custom_handlers/register_protocol_handler_permission_request.cc index c1b230b..e7437b4 100644 --- a/chrome/browser/custom_handlers/register_protocol_handler_permission_request.cc +++ b/chrome/browser/custom_handlers/register_protocol_handler_permission_request.cc
@@ -10,7 +10,7 @@ #include "chrome/grit/generated_resources.h" #include "content/public/browser/user_metrics.h" #include "ui/base/l10n/l10n_util.h" -#include "ui/gfx/vector_icons_public.h" +#include "ui/vector_icons/vector_icons.h" namespace { @@ -40,7 +40,7 @@ PermissionRequest::IconId RegisterProtocolHandlerPermissionRequest::GetIconId() const { - return gfx::VectorIconId::PROTOCOL_HANDLER; + return ui::kProtocolHandlerIcon; } base::string16
diff --git a/chrome/browser/download/download_permission_request.cc b/chrome/browser/download/download_permission_request.cc index 90522f0..e1f30b780 100644 --- a/chrome/browser/download/download_permission_request.cc +++ b/chrome/browser/download/download_permission_request.cc
@@ -4,10 +4,10 @@ #include "chrome/browser/download/download_permission_request.h" +#include "chrome/app/vector_icons/vector_icons.h" #include "chrome/grit/generated_resources.h" #include "content/public/browser/web_contents.h" #include "ui/base/l10n/l10n_util.h" -#include "ui/gfx/vector_icons_public.h" DownloadPermissionRequest::DownloadPermissionRequest( base::WeakPtr<DownloadRequestLimiter::TabDownloadState> host) @@ -20,7 +20,7 @@ DownloadPermissionRequest::~DownloadPermissionRequest() {} PermissionRequest::IconId DownloadPermissionRequest::GetIconId() const { - return gfx::VectorIconId::FILE_DOWNLOAD; + return kFileDownloadIcon; } base::string16 DownloadPermissionRequest::GetMessageTextFragment() const {
diff --git a/chrome/browser/download/notification/download_item_notification.cc b/chrome/browser/download/notification/download_item_notification.cc index 67c699e..531d226 100644 --- a/chrome/browser/download/notification/download_item_notification.cc +++ b/chrome/browser/download/notification/download_item_notification.cc
@@ -11,6 +11,7 @@ #include "base/strings/utf_string_conversions.h" #include "base/task_scheduler/post_task.h" #include "build/build_config.h" +#include "chrome/app/vector_icons/vector_icons.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/download/download_crx_util.h" #include "chrome/browser/download/download_item_model.h" @@ -42,9 +43,9 @@ #include "ui/gfx/color_palette.h" #include "ui/gfx/image/image.h" #include "ui/gfx/paint_vector_icon.h" -#include "ui/gfx/vector_icons_public.h" #include "ui/message_center/message_center.h" #include "ui/message_center/message_center_style.h" +#include "ui/vector_icons/vector_icons.h" #if defined(OS_CHROMEOS) #include "chrome/browser/chromeos/note_taking_helper.h" @@ -182,7 +183,6 @@ : item_(item), message_center_(manager->message_center()), weak_factory_(this) { - // Creates the notification instance. |title|, |body| and |icon| will be // overridden by UpdateNotificationData() below. notification_.reset(new Notification( @@ -498,9 +498,9 @@ ? IDR_DOWNLOAD_NOTIFICATION_WARNING_BAD : IDR_DOWNLOAD_NOTIFICATION_WARNING_UNWANTED); #else - SetNotificationVectorIcon( - gfx::VectorIconId::WARNING, - model.MightBeMalicious() ? gfx::kGoogleRed700 : gfx::kGoogleYellow700); + SetNotificationVectorIcon(ui::kWarningIcon, model.MightBeMalicious() + ? gfx::kGoogleRed700 + : gfx::kGoogleYellow700); #endif return; } @@ -514,12 +514,11 @@ #if defined(OS_MACOSX) SetNotificationIcon(IDR_DOWNLOAD_NOTIFICATION_INCOGNITO); #else - SetNotificationVectorIcon(gfx::VectorIconId::FILE_DOWNLOAD_INCOGNITO, + SetNotificationVectorIcon(kFileDownloadIncognitoIcon, gfx::kChromeIconGrey); #endif } else { - SetNotificationVectorIcon(gfx::VectorIconId::FILE_DOWNLOAD, - gfx::kGoogleBlue500); + SetNotificationVectorIcon(kFileDownloadIcon, gfx::kGoogleBlue500); } break; @@ -527,8 +526,7 @@ #if defined(OS_MACOSX) SetNotificationIcon(IDR_DOWNLOAD_NOTIFICATION_ERROR); #else - SetNotificationVectorIcon(gfx::VectorIconId::ERROR_CIRCLE, - gfx::kGoogleRed700); + SetNotificationVectorIcon(ui::kErrorCircleIcon, gfx::kGoogleRed700); #endif break; @@ -555,20 +553,14 @@ } void DownloadItemNotification::SetNotificationIcon(int resource_id) { - if (image_resource_id_ == resource_id) - return; ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); - image_resource_id_ = resource_id; - notification_->set_icon(bundle.GetImageNamed(image_resource_id_)); + notification_->set_icon(bundle.GetImageNamed(resource_id)); } -void DownloadItemNotification::SetNotificationVectorIcon(gfx::VectorIconId id, - SkColor color) { - if (vector_icon_params_ == std::make_pair(id, color)) - return; - vector_icon_params_ = std::make_pair(id, color); - image_resource_id_ = 0; - notification_->set_icon(gfx::Image(gfx::CreateVectorIcon(id, 40, color))); +void DownloadItemNotification::SetNotificationVectorIcon( + const gfx::VectorIcon& icon, + SkColor color) { + notification_->set_icon(gfx::Image(gfx::CreateVectorIcon(icon, 40, color))); } void DownloadItemNotification::DisablePopup() {
diff --git a/chrome/browser/download/notification/download_item_notification.h b/chrome/browser/download/notification/download_item_notification.h index 251a1c9..53a7d5a 100644 --- a/chrome/browser/download/notification/download_item_notification.h +++ b/chrome/browser/download/notification/download_item_notification.h
@@ -26,7 +26,7 @@ } namespace gfx { -enum class VectorIconId; +struct VectorIcon; } class DownloadNotificationManagerForProfile; @@ -70,7 +70,7 @@ // Set icon of the notification. void SetNotificationIcon(int resource_id); - void SetNotificationVectorIcon(gfx::VectorIconId id, SkColor color); + void SetNotificationVectorIcon(const gfx::VectorIcon& icon, SkColor color); // Set preview image of the notification. Must be called on IO thread. void OnImageLoaded(const std::string& image_data); @@ -114,8 +114,6 @@ // prevents updates after close. bool closed_ = false; - int image_resource_id_ = 0; - std::pair<gfx::VectorIconId, SkColor> vector_icon_params_; content::DownloadItem::DownloadState previous_download_state_ = content::DownloadItem::MAX_DOWNLOAD_STATE; // As uninitialized state bool previous_dangerous_state_ = false;
diff --git a/chrome/browser/extensions/external_install_manager.cc b/chrome/browser/extensions/external_install_manager.cc index 330b59e..69ed87af 100644 --- a/chrome/browser/extensions/external_install_manager.cc +++ b/chrome/browser/extensions/external_install_manager.cc
@@ -88,12 +88,7 @@ bool ExternalInstallManager::IsPromptingEnabled() { - // Enable this feature on canary on mac. -#if defined(OS_MACOSX) && defined(GOOGLE_CHROME_BUILD) - return GetCurrentChannel() <= version_info::Channel::CANARY; -#else return FeatureSwitch::prompt_for_external_extensions()->IsEnabled(); -#endif } void ExternalInstallManager::AddExternalInstallError(const Extension* extension,
diff --git a/chrome/browser/extensions/external_registry_loader_win.cc b/chrome/browser/extensions/external_registry_loader_win.cc index 3241d49..b54835af 100644 --- a/chrome/browser/extensions/external_registry_loader_win.cc +++ b/chrome/browser/extensions/external_registry_loader_win.cc
@@ -201,24 +201,26 @@ LoadFinished(); // Start watching registry. - if (hklm_key_.Create(HKEY_LOCAL_MACHINE, kRegistryExtensions, - KEY_NOTIFY | KEY_WOW64_32KEY) == ERROR_SUCCESS) { + LONG result = ERROR_SUCCESS; + if ((result = hklm_key_.Create(HKEY_LOCAL_MACHINE, kRegistryExtensions, + KEY_NOTIFY | KEY_WOW64_32KEY)) == + ERROR_SUCCESS) { base::win::RegKey::ChangeCallback callback = base::Bind(&ExternalRegistryLoader::OnRegistryKeyChanged, base::Unretained(this), base::Unretained(&hklm_key_)); hklm_key_.StartWatching(callback); } else { - LOG(WARNING) << "Error observing HKLM."; + LOG(WARNING) << "Error observing HKLM: " << result; } - if (hkcu_key_.Create(HKEY_CURRENT_USER, kRegistryExtensions, KEY_NOTIFY) == - ERROR_SUCCESS) { + if ((result = hkcu_key_.Create(HKEY_CURRENT_USER, kRegistryExtensions, + KEY_NOTIFY)) == ERROR_SUCCESS) { base::win::RegKey::ChangeCallback callback = base::Bind(&ExternalRegistryLoader::OnRegistryKeyChanged, base::Unretained(this), base::Unretained(&hkcu_key_)); hkcu_key_.StartWatching(callback); } else { - LOG(WARNING) << "Error observing HKCU."; + LOG(WARNING) << "Error observing HKCU: " << result; } }
diff --git a/chrome/browser/media/webrtc/media_stream_devices_controller.cc b/chrome/browser/media/webrtc/media_stream_devices_controller.cc index 7801ea4..9a22945 100644 --- a/chrome/browser/media/webrtc/media_stream_devices_controller.cc +++ b/chrome/browser/media/webrtc/media_stream_devices_controller.cc
@@ -39,7 +39,6 @@ #include "content/public/common/origin_util.h" #include "extensions/common/constants.h" #include "ui/base/l10n/l10n_util.h" -#include "ui/gfx/vector_icons_public.h" #if defined(OS_ANDROID) #include <vector> @@ -49,7 +48,9 @@ #include "chrome/grit/theme_resources.h" #include "content/public/browser/android/content_view_core.h" #include "ui/android/window_android.h" -#endif // defined(OS_ANDROID) +#else // !defined(OS_ANDROID) +#include "ui/vector_icons/vector_icons.h" +#endif using content::BrowserThread; @@ -280,8 +281,7 @@ return IsAskingForVideo() ? IDR_INFOBAR_MEDIA_STREAM_CAMERA : IDR_INFOBAR_MEDIA_STREAM_MIC; #else - return IsAskingForVideo() ? gfx::VectorIconId::VIDEOCAM - : gfx::VectorIconId::MICROPHONE; + return IsAskingForVideo() ? ui::kVideocamIcon : ui::kMicrophoneIcon; #endif }
diff --git a/chrome/browser/permissions/mock_permission_request.cc b/chrome/browser/permissions/mock_permission_request.cc index a224f48e..c489a3a 100644 --- a/chrome/browser/permissions/mock_permission_request.cc +++ b/chrome/browser/permissions/mock_permission_request.cc
@@ -7,7 +7,7 @@ #include "base/strings/string16.h" #include "base/strings/utf_string_conversions.h" #include "chrome/grit/theme_resources.h" -#include "ui/gfx/vector_icons_public.h" +#include "ui/vector_icons/vector_icons.h" MockPermissionRequest::MockPermissionRequest() : MockPermissionRequest("test", @@ -62,7 +62,7 @@ PermissionRequest::IconId MockPermissionRequest::GetIconId() const { // Use a valid icon ID to support UI tests. - return gfx::VectorIconId::WARNING; + return ui::kWarningIcon; } base::string16 MockPermissionRequest::GetMessageTextFragment() const {
diff --git a/chrome/browser/permissions/permission_request.h b/chrome/browser/permissions/permission_request.h index 134f103..7ef6ebbd 100644 --- a/chrome/browser/permissions/permission_request.h +++ b/chrome/browser/permissions/permission_request.h
@@ -12,7 +12,7 @@ #include "url/gurl.h" namespace gfx { -enum class VectorIconId; +struct VectorIcon; } // Used for UMA to record the types of permission prompts shown. @@ -65,8 +65,8 @@ // On Android, icons are represented with an IDR_ identifier. typedef int IconId; #else - // On desktop, we use a vector icon id. - typedef gfx::VectorIconId IconId; + // On desktop, we use a vector icon. + typedef const gfx::VectorIcon& IconId; #endif PermissionRequest();
diff --git a/chrome/browser/permissions/permission_request_impl.cc b/chrome/browser/permissions/permission_request_impl.cc index f5a277a..ab91ab6 100644 --- a/chrome/browser/permissions/permission_request_impl.cc +++ b/chrome/browser/permissions/permission_request_impl.cc
@@ -11,10 +11,12 @@ #include "components/url_formatter/elide_url.h" #include "net/base/escape.h" #include "ui/base/l10n/l10n_util.h" -#include "ui/gfx/vector_icons_public.h" #if defined(OS_ANDROID) #include "chrome/browser/android/android_theme_resources.h" +#else +#include "chrome/app/vector_icons/vector_icons.h" +#include "ui/vector_icons/vector_icons.h" #endif PermissionRequestImpl::PermissionRequestImpl( @@ -62,22 +64,22 @@ #else switch (permission_type_) { case content::PermissionType::GEOLOCATION: - return gfx::VectorIconId::LOCATION_ON; + return ui::kLocationOnIcon; case content::PermissionType::NOTIFICATIONS: case content::PermissionType::PUSH_MESSAGING: - return gfx::VectorIconId::NOTIFICATIONS; + return ui::kNotificationsIcon; #if defined(OS_CHROMEOS) // TODO(xhwang): fix this icon, see crrev.com/863263007 case content::PermissionType::PROTECTED_MEDIA_IDENTIFIER: - return gfx::VectorIconId::PRODUCT; + return kProductIcon; #endif case content::PermissionType::MIDI_SYSEX: - return gfx::VectorIconId::MIDI; + return ui::kMidiIcon; case content::PermissionType::FLASH: - return gfx::VectorIconId::EXTENSION; + return ui::kExtensionIcon; default: NOTREACHED(); - return gfx::VectorIconId::VECTOR_ICON_NONE; + return ui::kExtensionIcon; } #endif }
diff --git a/chrome/browser/resources/settings/basic_page/basic_page.html b/chrome/browser/resources/settings/basic_page/basic_page.html index b8b64f7bf..7c14422 100644 --- a/chrome/browser/resources/settings/basic_page/basic_page.html +++ b/chrome/browser/resources/settings/basic_page/basic_page.html
@@ -176,7 +176,7 @@ </div> </template> - <div hidden$="[[!showAdvancedSettings_(pageVisibility.advancedSettings)]]"> + <template is="dom-if" if="[[showAdvancedSettings_(pageVisibility.advancedSettings)]]"> <template is="dom-if" if="[[showAdvancedToggle_( inSearchMode, hasExpandedSection_)]]"> <div id="toggleSpacer"></div> @@ -271,7 +271,7 @@ </template> </div> </template> - </div> + </template> </template> <script src="basic_page.js"></script> </dom-module>
diff --git a/chrome/browser/resources/settings/basic_page/basic_page.js b/chrome/browser/resources/settings/basic_page/basic_page.js index 3b766b6..5dbf99c2 100644 --- a/chrome/browser/resources/settings/basic_page/basic_page.js +++ b/chrome/browser/resources/settings/basic_page/basic_page.js
@@ -114,7 +114,7 @@ if (this.pageVisibility.advancedSettings !== false) { assert(whenSearchDone === settings.getSearchManager().search( - query, assert(this.$.advancedPageTemplate.get()))); + query, assert(this.$$('#advancedPageTemplate').get()))); } return whenSearchDone; @@ -159,8 +159,11 @@ * @private */ advancedToggleExpandedChanged_: function() { - if (this.advancedToggleExpanded) - this.$.advancedPageTemplate.get(); + if (this.advancedToggleExpanded) { + this.async(function() { + this.$$('#advancedPageTemplate').get(); + }.bind(this)); + } }, /**
diff --git a/chrome/browser/resources/settings/settings_shared_css.html b/chrome/browser/resources/settings/settings_shared_css.html index 61a8dbec..dd9ac8d 100644 --- a/chrome/browser/resources/settings/settings_shared_css.html +++ b/chrome/browser/resources/settings/settings_shared_css.html
@@ -305,7 +305,7 @@ * +-------------------------------------------------------+ * | Another setting-box without a secondary-action | * +-------------------------------------------------------+ */ - .settings-box .secondary-action { + :-webkit-any(.settings-box, .list-item) .secondary-action { -webkit-border-start: var(--settings-separator-line); -webkit-margin-start: 20px; -webkit-padding-start: 20px;
diff --git a/chrome/browser/resources/settings/site_settings/site_data.html b/chrome/browser/resources/settings/site_settings/site_data.html index 111aa75..6e04cb5 100644 --- a/chrome/browser/resources/settings/site_settings/site_data.html +++ b/chrome/browser/resources/settings/site_settings/site_data.html
@@ -2,6 +2,7 @@ <link rel="import" href="chrome://resources/cr_elements/cr_dialog/cr_dialog.html"> <link rel="import" href="chrome://resources/cr_elements/icons.html"> <link rel="import" href="chrome://resources/polymer/v1_0/iron-flex-layout/iron-flex-layout-classes.html"> +<link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html"> <link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html"> <link rel="import" href="../settings_page/settings_subpage_search.html"> <link rel="import" href="../settings_shared_css.html"> @@ -11,10 +12,18 @@ <dom-module id="site-data"> <template> <style include="settings-shared"> - paper-button#removeButton { + #removeShowingSites { -webkit-margin-start: auto; } + #removeSecondary { + -webkit-padding-start: 0; + } + + .remove-site { + -webkit-margin-end: 0; + } + .subtitle-row { margin-top: 9px; /* With 15px in sub-items == 24px total margin. */ } @@ -28,10 +37,10 @@ </settings-subpage-search> </div> <div class="settings-box continuation"> - <paper-button class="secondary-button" id="removeButton" - on-tap="onConfirmDeleteMultipleSites_" + <paper-button class="secondary-button" id="removeShowingSites" + on-tap="onRemoveShowingSitesTap_" hidden$="[[!isRemoveButtonVisible_(sites, renderedItemCount)]]"> - [[computeRemoveLabel_(filterString_)]] + [[computeRemoveLabel_(filterString_)]] </paper-button> </div> <div class="list-frame vertical-list"> @@ -44,6 +53,13 @@ [[item.site]] <div class="secondary" id="siteSecondary">[[item.localData]]</div> </div> + <div class="secondary-action" id="removeSecondary"> + <!-- TODO(dbeam): need an aria-label for this button. --> + <button is="paper-icon-button-light" class="remove-site" + on-tap="onRemoveSiteTap_"> + <iron-icon icon="cr:delete"></iron-icon> + </button> + </div> <button class="subpage-arrow" is="paper-icon-button-light" aria-label="[[item.site]]" aria-describedby="siteSecondary"></button>
diff --git a/chrome/browser/resources/settings/site_settings/site_data.js b/chrome/browser/resources/settings/site_settings/site_data.js index ab87956..f5fd007a 100644 --- a/chrome/browser/resources/settings/site_settings/site_data.js +++ b/chrome/browser/resources/settings/site_settings/site_data.js
@@ -7,6 +7,16 @@ * 'site-data' handles showing the local storage summary list for all sites. */ +/** + * TODO(dbeam): upstream to polymer externs? + * @constructor + * @extends {Event} + */ +function DomRepeatEvent() {} + +/** @type {?} */ +DomRepeatEvent.prototype.model; + Polymer({ is: 'site-data', @@ -24,9 +34,6 @@ /** @private */ confirmationDeleteMsg_: String, - - /** @private */ - idToDelete_: String, }, /** @override */ @@ -52,7 +59,10 @@ this.$.list.render(); }, - /** @private */ + /** + * @return {boolean} Whether to show the multiple site remove button. + * @private + */ isRemoveButtonVisible_: function(sites, renderedItemCount) { return renderedItemCount != 0; }, @@ -78,39 +88,20 @@ * @param {!Event} e * @private */ - onConfirmDeleteMultipleSites_: function(e) { + onRemoveShowingSitesTap_: function(e) { e.preventDefault(); - this.idToDelete_ = ''; // Delete all. this.confirmationDeleteMsg_ = loadTimeData.getString( 'siteSettingsCookieRemoveMultipleConfirmation'); this.$.confirmDeleteDialog.showModal(); }, /** - * Called when deletion for a single/multiple sites has been confirmed. + * Called when deletion for all showing sites has been confirmed. * @private */ onConfirmDelete_: function() { - if (this.idToDelete_ != '') - this.onDeleteSite_(); - else - this.onDeleteMultipleSites_(); this.$.confirmDeleteDialog.close(); - }, - /** - * Deletes all site data for a given site. - * @private - */ - onDeleteSite_: function() { - this.browserProxy.removeCookie(this.idToDelete_); - }, - - /** - * Deletes site data for multiple sites. - * @private - */ - onDeleteMultipleSites_: function() { if (this.filterString_.length == 0) { this.removeAllCookies(); } else { @@ -125,6 +116,16 @@ }, /** + * Deletes all site data for a given site. + * @param {!DomRepeatEvent} e + * @private + */ + onRemoveSiteTap_: function(e) { + e.stopPropagation(); + this.browserProxy.removeCookie(e.model.item.id); + }, + + /** * @param {!{model: !{item: CookieDataSummaryItem}}} event * @private */
diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn index c32974bd..7ae0ce1 100644 --- a/chrome/browser/ui/BUILD.gn +++ b/chrome/browser/ui/BUILD.gn
@@ -2156,6 +2156,7 @@ if (is_chromeos) { sources += [ "webui/print_preview/printer_backend_proxy_chromeos.cc" ] + deps += [ "//chrome/browser/chromeos/printing" ] } else { sources += [ "webui/print_preview/printer_backend_proxy.cc" ] }
diff --git a/chrome/browser/ui/toolbar/media_router_action.cc b/chrome/browser/ui/toolbar/media_router_action.cc index ed5d6969..f2057fbd 100644 --- a/chrome/browser/ui/toolbar/media_router_action.cc +++ b/chrome/browser/ui/toolbar/media_router_action.cc
@@ -23,6 +23,8 @@ #include "ui/gfx/color_palette.h" #include "ui/gfx/image/image_skia.h" #include "ui/gfx/paint_vector_icon.h" +#include "ui/gfx/vector_icon_types.h" +#include "ui/vector_icons/vector_icons.h" using media_router::MediaRouterDialogControllerImpl; @@ -39,7 +41,7 @@ ToolbarActionsBar* toolbar_actions_bar) : media_router::IssuesObserver(GetMediaRouter(browser)), media_router::MediaRoutesObserver(GetMediaRouter(browser)), - current_icon_(gfx::VectorIconId::MEDIA_ROUTER_IDLE), + current_icon_(&ui::kMediaRouterIdleIcon), has_local_display_route_(false), has_dialog_(false), delegate_(nullptr), @@ -61,20 +63,18 @@ } // static -SkColor MediaRouterAction::GetIconColor(gfx::VectorIconId icon_id) { - switch (icon_id) { - case gfx::VectorIconId::MEDIA_ROUTER_IDLE: - return gfx::kChromeIconGrey; - case gfx::VectorIconId::MEDIA_ROUTER_ACTIVE: - return gfx::kGoogleBlue500; - case gfx::VectorIconId::MEDIA_ROUTER_WARNING: - return gfx::kGoogleYellow700; - case gfx::VectorIconId::MEDIA_ROUTER_ERROR: - return gfx::kGoogleRed700; - default: - NOTREACHED(); - return gfx::kPlaceholderColor; - } +SkColor MediaRouterAction::GetIconColor(const gfx::VectorIcon& icon_id) { + if (&icon_id == &ui::kMediaRouterIdleIcon) + return gfx::kChromeIconGrey; + else if (&icon_id == &ui::kMediaRouterActiveIcon) + return gfx::kGoogleBlue500; + else if (&icon_id == &ui::kMediaRouterWarningIcon) + return gfx::kGoogleYellow700; + else if (&icon_id == &ui::kMediaRouterErrorIcon) + return gfx::kGoogleRed700; + + NOTREACHED(); + return gfx::kPlaceholderColor; } std::string MediaRouterAction::GetId() const { @@ -94,7 +94,7 @@ gfx::Image MediaRouterAction::GetIcon(content::WebContents* web_contents, const gfx::Size& size) { return gfx::Image( - gfx::CreateVectorIcon(current_icon_, GetIconColor(current_icon_))); + gfx::CreateVectorIcon(*current_icon_, GetIconColor(*current_icon_))); } base::string16 MediaRouterAction::GetActionName() const { @@ -261,11 +261,11 @@ } void MediaRouterAction::MaybeUpdateIcon() { - gfx::VectorIconId new_icon = GetCurrentIcon(); + const gfx::VectorIcon& new_icon = GetCurrentIcon(); // Update the current state if it has changed. - if (new_icon != current_icon_) { - current_icon_ = new_icon; + if (&new_icon != current_icon_) { + current_icon_ = &new_icon; // Tell the associated view to update its icon to reflect the change made // above. If MaybeUpdateIcon() was called as a result of instantiating @@ -275,17 +275,17 @@ } } -gfx::VectorIconId MediaRouterAction::GetCurrentIcon() const { +const gfx::VectorIcon& MediaRouterAction::GetCurrentIcon() const { // Highest priority is to indicate whether there's an issue. if (current_issue_) { media_router::IssueInfo::Severity severity = current_issue_->severity; if (severity == media_router::IssueInfo::Severity::FATAL) - return gfx::VectorIconId::MEDIA_ROUTER_ERROR; + return ui::kMediaRouterErrorIcon; if (severity == media_router::IssueInfo::Severity::WARNING) - return gfx::VectorIconId::MEDIA_ROUTER_WARNING; + return ui::kMediaRouterWarningIcon; // Fall through for Severity::NOTIFICATION. } - return has_local_display_route_ ? gfx::VectorIconId::MEDIA_ROUTER_ACTIVE - : gfx::VectorIconId::MEDIA_ROUTER_IDLE; + return has_local_display_route_ ? ui::kMediaRouterActiveIcon + : ui::kMediaRouterIdleIcon; }
diff --git a/chrome/browser/ui/toolbar/media_router_action.h b/chrome/browser/ui/toolbar/media_router_action.h index ec88162..a8015841 100644 --- a/chrome/browser/ui/toolbar/media_router_action.h +++ b/chrome/browser/ui/toolbar/media_router_action.h
@@ -17,12 +17,15 @@ #include "chrome/browser/ui/toolbar/toolbar_action_view_controller.h" #include "chrome/browser/ui/toolbar/toolbar_actions_bar.h" #include "chrome/browser/ui/toolbar/toolbar_actions_bar_observer.h" -#include "ui/gfx/vector_icons_public.h" class Browser; class MediaRouterActionPlatformDelegate; class TabStripModel; +namespace gfx { +struct VectorIcon; +} + namespace media_router { class MediaRouterDialogControllerImpl; } // namespace media_router @@ -38,7 +41,7 @@ MediaRouterAction(Browser* browser, ToolbarActionsBar* toolbar_actions_bar); ~MediaRouterAction() override; - static SkColor GetIconColor(gfx::VectorIconId icon_id); + static SkColor GetIconColor(const gfx::VectorIcon& icon_id); // ToolbarActionViewController implementation. std::string GetId() const override; @@ -107,11 +110,11 @@ // updates |current_icon_|. void MaybeUpdateIcon(); - gfx::VectorIconId GetCurrentIcon() const; + const gfx::VectorIcon& GetCurrentIcon() const; // The current icon to show. This is updated based on the current issues and // routes since |this| is an IssueObserver and MediaRoutesObserver. - gfx::VectorIconId current_icon_; + const gfx::VectorIcon* current_icon_; // The current issue shown in the Media Router WebUI, set in OnIssue() and // cleared in OnIssuesCleared().
diff --git a/chrome/browser/ui/toolbar/media_router_action_unittest.cc b/chrome/browser/ui/toolbar/media_router_action_unittest.cc index 6040eade..94a068f8 100644 --- a/chrome/browser/ui/toolbar/media_router_action_unittest.cc +++ b/chrome/browser/ui/toolbar/media_router_action_unittest.cc
@@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "chrome/browser/ui/toolbar/media_router_action.h" #include "base/macros.h" #include "chrome/browser/extensions/browser_action_test_util.h" #include "chrome/browser/extensions/extension_action_test_util.h" #include "chrome/browser/ui/browser_commands.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" -#include "chrome/browser/ui/toolbar/media_router_action.h" #include "chrome/browser/ui/toolbar/toolbar_action_view_delegate.h" #include "chrome/browser/ui/webui/media_router/media_router_dialog_controller_impl.h" #include "chrome/browser/ui/webui/media_router/media_router_web_ui_test.h" @@ -19,6 +19,7 @@ #include "ui/gfx/color_palette.h" #include "ui/gfx/image/image_unittest_util.h" #include "ui/gfx/paint_vector_icon.h" +#include "ui/vector_icons/vector_icons.h" using content::WebContents; using media_router::MediaRouterDialogControllerImpl; @@ -95,10 +96,10 @@ media_router::IssueInfo::Severity::FATAL)), fake_source1_("fakeSource1"), fake_source2_("fakeSource2"), - active_icon_(GetIcon(gfx::VectorIconId::MEDIA_ROUTER_ACTIVE)), - error_icon_(GetIcon(gfx::VectorIconId::MEDIA_ROUTER_ERROR)), - idle_icon_(GetIcon(gfx::VectorIconId::MEDIA_ROUTER_IDLE)), - warning_icon_(GetIcon(gfx::VectorIconId::MEDIA_ROUTER_WARNING)) {} + active_icon_(GetIcon(ui::kMediaRouterActiveIcon)), + error_icon_(GetIcon(ui::kMediaRouterErrorIcon)), + idle_icon_(GetIcon(ui::kMediaRouterIdleIcon)), + warning_icon_(GetIcon(ui::kMediaRouterWarningIcon)) {} ~MediaRouterActionUnitTest() override {} @@ -135,9 +136,9 @@ MediaRouterWebUITest::TearDown(); } - gfx::Image GetIcon(gfx::VectorIconId icon_id) { - return gfx::Image(gfx::CreateVectorIcon( - icon_id, MediaRouterAction::GetIconColor(icon_id))); + gfx::Image GetIcon(const gfx::VectorIcon& icon) { + return gfx::Image( + gfx::CreateVectorIcon(icon, MediaRouterAction::GetIconColor(icon))); } TestMediaRouterAction* action() { return action_.get(); }
diff --git a/chrome/browser/ui/views/download/download_started_animation_views.cc b/chrome/browser/ui/views/download/download_started_animation_views.cc index 06bf68e..311e6e15 100644 --- a/chrome/browser/ui/views/download/download_started_animation_views.cc +++ b/chrome/browser/ui/views/download/download_started_animation_views.cc
@@ -5,6 +5,7 @@ #include "chrome/browser/download/download_started_animation.h" #include "base/macros.h" +#include "chrome/app/vector_icons/vector_icons.h" #include "content/public/browser/web_contents.h" #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/animation/linear_animation.h" @@ -61,8 +62,8 @@ content::WebContents* web_contents) : gfx::LinearAnimation(kMoveTimeMs, kFrameRateHz, NULL), popup_(NULL) { - gfx::ImageSkia download_image = gfx::CreateVectorIcon( - gfx::VectorIconId::FILE_DOWNLOAD_SHELF, 72, gfx::kGoogleBlue500); + gfx::ImageSkia download_image = + gfx::CreateVectorIcon(kFileDownloadShelfIcon, 72, gfx::kGoogleBlue500); // If we're too small to show the download image, then don't bother - // the shelf will be enough.
diff --git a/chrome/browser/ui/views/website_settings/permission_prompt_impl.cc b/chrome/browser/ui/views/website_settings/permission_prompt_impl.cc index eeb7254..9b8252c 100644 --- a/chrome/browser/ui/views/website_settings/permission_prompt_impl.cc +++ b/chrome/browser/ui/views/website_settings/permission_prompt_impl.cc
@@ -233,11 +233,9 @@ layout_delegate->GetMetric( LayoutDelegate::Metric::RELATED_LABEL_HORIZONTAL_SPACING))); views::ImageView* icon = new views::ImageView(); - gfx::VectorIconId vector_id = requests[index]->GetIconId(); - if (vector_id != gfx::VectorIconId::VECTOR_ICON_NONE) { - icon->SetImage( - gfx::CreateVectorIcon(vector_id, kIconSize, gfx::kChromeIconGrey)); - } + const gfx::VectorIcon& vector_id = requests[index]->GetIconId(); + icon->SetImage( + gfx::CreateVectorIcon(vector_id, kIconSize, gfx::kChromeIconGrey)); icon->SetTooltipText(base::string16()); // Redundant with the text fragment label_container->AddChildView(icon); views::Label* label =
diff --git a/chrome/test/data/webui/settings/cr_settings_browsertest.js b/chrome/test/data/webui/settings/cr_settings_browsertest.js index 5ae0041e..1453a78c3 100644 --- a/chrome/test/data/webui/settings/cr_settings_browsertest.js +++ b/chrome/test/data/webui/settings/cr_settings_browsertest.js
@@ -709,6 +709,7 @@ /** @override */ extraLibraries: CrSettingsBrowserTest.prototype.extraLibraries.concat([ + // TODO(dbeam): split these up. 'category_default_setting_tests.js', 'category_setting_exceptions_tests.js', 'site_details_tests.js', @@ -736,6 +737,28 @@ mocha.run(); }); +/** + * @constructor + * @extends {CrSettingsBrowserTest} + */ +function CrSettingsSiteDataTest() {} + +CrSettingsSiteDataTest.prototype = { + __proto__: CrSettingsBrowserTest.prototype, + + browsePreload: 'chrome://md-settings/site_settings/site_data.html', + + extraLibraries: CrSettingsBrowserTest.prototype.extraLibraries.concat([ + 'test_browser_proxy.js', + 'test_site_settings_prefs_browser_proxy.js', + 'site_data_test.js', + ]), +}; + +TEST_F('CrSettingsSiteDataTest', 'All', function() { + mocha.run(); +}); + GEN('#if defined(OS_CHROMEOS)'); /** * Test fixture for device-page.
diff --git a/chrome/test/data/webui/settings/settings_main_test.js b/chrome/test/data/webui/settings/settings_main_test.js index 0e02be9..7d5b281 100644 --- a/chrome/test/data/webui/settings/settings_main_test.js +++ b/chrome/test/data/webui/settings/settings_main_test.js
@@ -176,7 +176,8 @@ assertEquals( expectedBasic, page.$$('#basicPage').style.display); assertEquals( - expectedAdvanced, page.$.advancedPageTemplate.get().style.display); + expectedAdvanced, + page.$$('#advancedPageTemplate').get().style.display); } // TODO(michaelpg): It would be better not to drill into
diff --git a/chrome/test/data/webui/settings/site_data_test.js b/chrome/test/data/webui/settings/site_data_test.js new file mode 100644 index 0000000..bc6d9599 --- /dev/null +++ b/chrome/test/data/webui/settings/site_data_test.js
@@ -0,0 +1,29 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +suite('<site-data>', function() { + /** @type {SiteDataElement} */ + var siteData; + + /** @type {TestSiteSettingsPrefsBrowserProxy} */ + var testBrowserProxy; + + setup(function() { + testBrowserProxy = new TestSiteSettingsPrefsBrowserProxy; + settings.SiteSettingsPrefsBrowserProxyImpl.instance_ = testBrowserProxy; + siteData = document.createElement('site-data'); + }); + + test('tapping remove button (trash can) calls remove on origin', function() { + var GOOGLE_ID = '1'; + siteData.sites = [{site: 'Google', id: GOOGLE_ID, localData: 'Cookiez!'}]; + Polymer.dom.flush(); + + MockInteractions.tap(siteData.$$('.remove-site')); + + return testBrowserProxy.whenCalled('removeCookie').then(function(path) { + assertEquals(GOOGLE_ID, path); + }); + }); +});
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 b350452..49fae51 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
@@ -53,6 +53,8 @@ 'getExceptionList', 'observeProtocolHandlers', 'observeProtocolHandlersEnabledState', + 'reloadCookies', + 'removeCookie', 'removeProtocolHandler', 'removeUsbDevice', 'removeZoomLevel', @@ -245,6 +247,16 @@ }, /** @override */ + reloadCookies: function() { + return Promise.resolve({id: null, children: []}); + }, + + /** @override */ + removeCookie: function(path) { + this.methodCalled('removeCookie', path); + }, + + /** @override */ removeZoomLevel: function(host) { this.methodCalled('removeZoomLevel', [host]); },
diff --git a/components/display_compositor/BUILD.gn b/components/display_compositor/BUILD.gn index a77b83e..9f33fc39 100644 --- a/components/display_compositor/BUILD.gn +++ b/components/display_compositor/BUILD.gn
@@ -33,7 +33,7 @@ deps = [ "//base", "//cc", - "//cc/ipc:internal_interfaces", + "//cc/ipc:interfaces", "//cc/surfaces", "//gpu/command_buffer/client", "//gpu/command_buffer/client:gles2_interface",
diff --git a/components/exo/display.cc b/components/exo/display.cc index e3554d0..4216d8a 100644 --- a/components/exo/display.cc +++ b/components/exo/display.cc
@@ -141,8 +141,9 @@ } return base::MakeUnique<ShellSurface>( - surface, nullptr, gfx::Rect(), true /* activatable */, - false /* can_minimize */, ash::kShellWindowId_DefaultContainer); + surface, nullptr, ShellSurface::BoundsMode::SHELL, gfx::Point(), + true /* activatable */, false /* can_minimize */, + ash::kShellWindowId_DefaultContainer); } std::unique_ptr<ShellSurface> Display::CreatePopupShellSurface( @@ -162,18 +163,18 @@ return nullptr; } - // Determine the initial bounds for popup. |position| is relative to the - // parent's main surface origin and initial bounds are in screen coordinates. + // |position| is relative to the parent's main surface origin, and |origin| is + // in screen coordinates. gfx::Point origin = position; wm::ConvertPointToScreen( ShellSurface::GetMainSurface(parent->GetWidget()->GetNativeWindow()) ->window(), &origin); - gfx::Rect initial_bounds(origin, gfx::Size(1, 1)); return base::MakeUnique<ShellSurface>( - surface, parent, initial_bounds, false /* activatable */, - false /* can_minimize */, ash::kShellWindowId_DefaultContainer); + surface, parent, ShellSurface::BoundsMode::FIXED, origin, + false /* activatable */, false /* can_minimize */, + ash::kShellWindowId_DefaultContainer); } std::unique_ptr<ShellSurface> Display::CreateRemoteShellSurface( @@ -190,9 +191,9 @@ // Remote shell surfaces in system modal container cannot be minimized. bool can_minimize = container != ash::kShellWindowId_SystemModalContainer; - return base::MakeUnique<ShellSurface>(surface, nullptr, gfx::Rect(1, 1), - true /* activatable */, can_minimize, - container); + return base::MakeUnique<ShellSurface>( + surface, nullptr, ShellSurface::BoundsMode::CLIENT, gfx::Point(), + true /* activatable */, can_minimize, container); } std::unique_ptr<SubSurface> Display::CreateSubSurface(Surface* surface,
diff --git a/components/exo/pointer_unittest.cc b/components/exo/pointer_unittest.cc index eb5c071..f495138 100644 --- a/components/exo/pointer_unittest.cc +++ b/components/exo/pointer_unittest.cc
@@ -175,8 +175,8 @@ std::unique_ptr<Surface> child_surface(new Surface); std::unique_ptr<ShellSurface> child_shell_surface(new ShellSurface( - child_surface.get(), shell_surface.get(), gfx::Rect(9, 9, 1, 1), true, - false, ash::kShellWindowId_DefaultContainer)); + child_surface.get(), shell_surface.get(), ShellSurface::BoundsMode::FIXED, + gfx::Point(9, 9), true, false, ash::kShellWindowId_DefaultContainer)); gfx::Size child_buffer_size(15, 15); std::unique_ptr<Buffer> child_buffer( new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(child_buffer_size))); @@ -307,9 +307,9 @@ // Create surface for modal window. std::unique_ptr<Surface> surface2(new Surface); - std::unique_ptr<ShellSurface> shell_surface2( - new ShellSurface(surface2.get(), nullptr, gfx::Rect(0, 0, 5, 5), true, - false, ash::kShellWindowId_SystemModalContainer)); + std::unique_ptr<ShellSurface> shell_surface2(new ShellSurface( + surface2.get(), nullptr, ShellSurface::BoundsMode::FIXED, gfx::Point(), + true, false, ash::kShellWindowId_SystemModalContainer)); std::unique_ptr<Buffer> buffer2( new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(gfx::Size(5, 5)))); surface2->Attach(buffer2.get());
diff --git a/components/exo/shell_surface.cc b/components/exo/shell_surface.cc index c3f6dee..7183474b 100644 --- a/components/exo/shell_surface.cc +++ b/components/exo/shell_surface.cc
@@ -290,14 +290,16 @@ ShellSurface::ShellSurface(Surface* surface, ShellSurface* parent, - const gfx::Rect& initial_bounds, + BoundsMode bounds_mode, + const gfx::Point& origin, bool activatable, bool can_minimize, int container) : widget_(nullptr), surface_(surface), parent_(parent ? parent->GetWidget()->GetNativeWindow() : nullptr), - initial_bounds_(initial_bounds), + bounds_mode_(bounds_mode), + origin_(origin), activatable_(activatable), can_minimize_(can_minimize), container_(container) { @@ -313,7 +315,8 @@ ShellSurface::ShellSurface(Surface* surface) : ShellSurface(surface, nullptr, - gfx::Rect(), + BoundsMode::SHELL, + gfx::Point(), true, true, ash::kShellWindowId_DefaultContainer) {} @@ -519,15 +522,37 @@ void ShellSurface::Move() { TRACE_EVENT0("exo", "ShellSurface::Move"); - if (widget_ && !widget_->movement_disabled()) - AttemptToStartDrag(HTCAPTION); + if (!widget_) + return; + + switch (bounds_mode_) { + case BoundsMode::SHELL: + AttemptToStartDrag(HTCAPTION); + return; + case BoundsMode::CLIENT: + case BoundsMode::FIXED: + return; + } + + NOTREACHED(); } void ShellSurface::Resize(int component) { TRACE_EVENT1("exo", "ShellSurface::Resize", "component", component); - if (widget_ && !widget_->movement_disabled()) - AttemptToStartDrag(component); + if (!widget_) + return; + + switch (bounds_mode_) { + case BoundsMode::SHELL: + AttemptToStartDrag(component); + return; + case BoundsMode::CLIENT: + case BoundsMode::FIXED: + return; + } + + NOTREACHED(); } void ShellSurface::Close() { @@ -604,7 +629,7 @@ void ShellSurface::SetOrigin(const gfx::Point& origin) { TRACE_EVENT1("exo", "ShellSurface::SetOrigin", "origin", origin.ToString()); - initial_bounds_ = gfx::Rect(origin, gfx::Size(1, 1)); + origin_ = origin; } void ShellSurface::SetActivatable(bool activatable) { @@ -659,7 +684,7 @@ // Apply the accumulated pending origin offset to reflect acknowledged // configure requests. - origin_ += pending_origin_offset_; + origin_offset_ += pending_origin_offset_; pending_origin_offset_ = gfx::Vector2d(); // Update resize direction to reflect acknowledged configure requests. @@ -698,13 +723,7 @@ } } - gfx::Rect client_view_bounds = - widget_->non_client_view()->frame_view()->GetBoundsForClientView(); - - // Update surface bounds. - surface_->window()->SetBounds( - gfx::Rect(GetSurfaceOrigin() + client_view_bounds.OffsetFromOrigin(), - surface_->window()->layer()->size())); + UpdateSurfaceBounds(); // Update surface scale. if (pending_scale_ != scale_) { @@ -761,7 +780,7 @@ // views::WidgetDelegate overrides: bool ShellSurface::CanResize() const { - return initial_bounds_.IsEmpty(); + return bounds_mode_ == BoundsMode::SHELL; } bool ShellSurface::CanMaximize() const { @@ -892,19 +911,13 @@ return; // If size changed then give the client a chance to produce new contents - // before origin on screen is changed by adding offset to the next configure - // request and offset |origin_| by the same distance. - gfx::Vector2d origin_offset = new_bounds.origin() - old_bounds.origin(); - pending_origin_config_offset_ += origin_offset; - origin_ -= origin_offset; + // before origin on screen is changed. Retain the old origin by reverting + // the origin delta until the next configure is acknowledged. + gfx::Vector2d delta = new_bounds.origin() - old_bounds.origin(); + origin_offset_ -= delta; + pending_origin_offset_accumulator_ += delta; - gfx::Rect client_view_bounds = - widget_->non_client_view()->frame_view()->GetBoundsForClientView(); - - // Update surface bounds. - surface_->window()->SetBounds( - gfx::Rect(GetSurfaceOrigin() + client_view_bounds.OffsetFromOrigin(), - surface_->window()->layer()->size())); + UpdateSurfaceBounds(); // The shadow size may be updated to match the widget. Change it back // to the shadow content size. @@ -1046,7 +1059,7 @@ // Make shell surface a transient child if |parent_| has been set. params.parent = parent_ ? parent_ : WMHelper::GetInstance()->GetContainer(container_); - params.bounds = initial_bounds_; + params.bounds = gfx::Rect(origin_, gfx::Size()); bool activatable = activatable_; // ShellSurfaces in system modal container are only activatable if input // region is non-empty. See OnCommitSurface() for more details. @@ -1073,11 +1086,10 @@ ash::wm::WindowState* window_state = ash::wm::GetWindowState(window); window_state->AddObserver(this); - // Absolete positioned shell surfaces may request the bounds that does not - // fill the entire work area / display in maximized / fullscreen state. - // Allow such clients to update the bounds in these states. - if (!initial_bounds_.IsEmpty()) - window_state->set_allow_set_bounds_in_maximized(true); + // Allow the client to request bounds that do not fill the entire work area + // when maximized, or the entire display when fullscreen. + window_state->set_allow_set_bounds_in_maximized( + bounds_mode_ == BoundsMode::CLIENT); // Notify client of initial state if different than normal. if (window_state->GetStateType() != ash::wm::WINDOW_STATE_TYPE_NORMAL && @@ -1086,9 +1098,10 @@ window_state->GetStateType()); } - // Disable movement if initial bounds were specified. - widget_->set_movement_disabled(!initial_bounds_.IsEmpty()); - window_state->set_ignore_keyboard_bounds_change(!initial_bounds_.IsEmpty()); + // Disable movement if bounds are controlled by the client or fixed. + bool movement_disabled = bounds_mode_ != BoundsMode::SHELL; + widget_->set_movement_disabled(movement_disabled); + window_state->set_ignore_keyboard_bounds_change(movement_disabled); // AutoHide shelf in fullscreen state. window_state->set_hide_shelf_when_fullscreen(false); @@ -1121,8 +1134,8 @@ return; } - gfx::Vector2d origin_offset = pending_origin_config_offset_; - pending_origin_config_offset_ = gfx::Vector2d(); + gfx::Vector2d origin_offset = pending_origin_offset_accumulator_; + pending_origin_offset_accumulator_ = gfx::Vector2d(); int resize_component = HTCAPTION; if (widget_) { @@ -1226,7 +1239,7 @@ // Apply pending origin offsets and resize direction before starting a new // resize operation. These can still be pending if the client has acknowledged // the configure request but not yet called Commit(). - origin_ += pending_origin_offset_; + origin_offset_ += pending_origin_offset_; pending_origin_offset_ = gfx::Vector2d(); resize_component_ = pending_resize_component_; @@ -1277,12 +1290,14 @@ } gfx::Point ShellSurface::GetSurfaceOrigin() const { - // If initial bounds were specified then surface origin is always relative - // to those bounds. - if (!initial_bounds_.IsEmpty()) { - gfx::Point origin = widget_->GetNativeWindow()->bounds().origin(); - wm::ConvertPointToScreen(widget_->GetNativeWindow()->parent(), &origin); - return initial_bounds_.origin() - origin.OffsetFromOrigin(); + // For client-positioned shell surfaces, the surface origin corresponds to the + // widget position relative to the origin specified by the client. Since the + // surface is positioned relative to the widget, negate this vector to align + // the surface with the widget. + if (bounds_mode_ != BoundsMode::SHELL) { + gfx::Point position = widget_->GetNativeWindow()->bounds().origin(); + wm::ConvertPointToScreen(widget_->GetNativeWindow()->parent(), &position); + return origin_ - position.OffsetFromOrigin(); } gfx::Rect visible_bounds = GetVisibleBounds(); @@ -1290,7 +1305,7 @@ widget_->non_client_view()->frame_view()->GetBoundsForClientView(); switch (resize_component_) { case HTCAPTION: - return origin_ - visible_bounds.OffsetFromOrigin(); + return gfx::Point() + origin_offset_ - visible_bounds.OffsetFromOrigin(); case HTBOTTOM: case HTRIGHT: case HTBOTTOMRIGHT: @@ -1299,7 +1314,6 @@ case HTTOPRIGHT: return gfx::Point(0, client_bounds.height() - visible_bounds.height()) - visible_bounds.OffsetFromOrigin(); - break; case HTLEFT: case HTBOTTOMLEFT: return gfx::Point(client_bounds.width() - visible_bounds.width(), 0) - @@ -1319,7 +1333,7 @@ // Return early if the shell is currently managing the bounds of the widget. // 1) When a window is either maximized/fullscreen/pinned, and the bounds - // isn't controlled by a client. + // are not controlled by a client. ash::wm::WindowState* window_state = ash::wm::GetWindowState(widget_->GetNativeWindow()); if (window_state->IsMaximizedOrFullscreenOrPinned() && @@ -1340,23 +1354,27 @@ widget_->non_client_view()->GetWindowBoundsForClientBounds( visible_bounds); - // Avoid changing widget origin unless initial bounds were specified and - // widget origin is always relative to it. - if (initial_bounds_.IsEmpty()) { - new_widget_bounds.set_origin(widget_->GetWindowBoundsInScreen().origin()); - } else { - new_widget_bounds.set_origin(initial_bounds_.origin() + - visible_bounds.OffsetFromOrigin()); - } - - // Update widget origin using the surface origin if the current location of - // surface is being anchored to one side of the widget as a result of a - // resize operation. - if (resize_component_ != HTCAPTION) { - gfx::Point new_widget_origin = - GetSurfaceOrigin() + visible_bounds.OffsetFromOrigin(); - wm::ConvertPointToScreen(widget_->GetNativeWindow(), &new_widget_origin); - new_widget_bounds.set_origin(new_widget_origin); + switch (bounds_mode_) { + case BoundsMode::CLIENT: + case BoundsMode::FIXED: + // Position is relative to the origin. + new_widget_bounds += origin_.OffsetFromOrigin(); + break; + case BoundsMode::SHELL: + // Update widget origin using the surface origin if the current location + // of surface is being anchored to one side of the widget as a result of a + // resize operation. + if (resize_component_ != HTCAPTION) { + gfx::Point widget_origin = + GetSurfaceOrigin() + visible_bounds.OffsetFromOrigin(); + wm::ConvertPointToScreen(widget_->GetNativeWindow(), &widget_origin); + new_widget_bounds.set_origin(widget_origin); + } else { + // Preserve widget position. + new_widget_bounds.set_origin( + widget_->GetWindowBoundsInScreen().origin()); + } + break; } // Set |ignore_window_bounds_changes_| as this change to window bounds @@ -1366,11 +1384,12 @@ if (widget_->GetWindowBoundsInScreen() != new_widget_bounds) widget_->SetBounds(new_widget_bounds); ignore_window_bounds_changes_ = false; +} +void ShellSurface::UpdateSurfaceBounds() { gfx::Rect client_view_bounds = widget_->non_client_view()->frame_view()->GetBoundsForClientView(); - // A change to the widget size requires surface bounds to be re-adjusted. surface_->window()->SetBounds( gfx::Rect(GetSurfaceOrigin() + client_view_bounds.OffsetFromOrigin(), surface_->window()->layer()->size()));
diff --git a/components/exo/shell_surface.h b/components/exo/shell_surface.h index 64eeb54..20b6d5b 100644 --- a/components/exo/shell_surface.h +++ b/components/exo/shell_surface.h
@@ -47,9 +47,20 @@ public WMHelper::ActivationObserver, public WMHelper::AccessibilityObserver { public: + enum class BoundsMode { SHELL, CLIENT, FIXED }; + + // The |origin| is in screen coordinates. When bounds are controlled by the + // shell or fixed, it determines the initial position of the shell surface. + // In that case, the position specified as part of the geometry is relative + // to the shell surface. + // + // When bounds are controlled by the client, it represents the origin of a + // coordinate system to which the position of the shell surface, specified + // as part of the geometry, is relative. ShellSurface(Surface* surface, ShellSurface* parent, - const gfx::Rect& initial_bounds, + BoundsMode bounds_mode, + const gfx::Point& origin, bool activatable, bool can_minimize, int container); @@ -287,6 +298,9 @@ // Updates the bounds of widget to match the current surface bounds. void UpdateWidgetBounds(); + // Updates the bounds of surface to match the current widget bounds. + void UpdateSurfaceBounds(); + // Creates, deletes and update the shadow bounds based on // |pending_shadow_content_bounds_|. void UpdateShadow(); @@ -294,7 +308,8 @@ views::Widget* widget_ = nullptr; Surface* surface_; aura::Window* parent_; - gfx::Rect initial_bounds_; + const BoundsMode bounds_mode_; + gfx::Point origin_; bool activatable_ = true; const bool can_minimize_; // Container Window Id (see ash/public/cpp/shell_window_ids.h) @@ -314,9 +329,9 @@ ConfigureCallback configure_callback_; ScopedConfigure* scoped_configure_ = nullptr; bool ignore_window_bounds_changes_ = false; - gfx::Point origin_; + gfx::Vector2d origin_offset_; gfx::Vector2d pending_origin_offset_; - gfx::Vector2d pending_origin_config_offset_; + gfx::Vector2d pending_origin_offset_accumulator_; int resize_component_ = HTCAPTION; // HT constant (see ui/base/hit_test.h) int pending_resize_component_ = HTCAPTION; aura::Window* shadow_overlay_ = nullptr;
diff --git a/components/exo/shell_surface_unittest.cc b/components/exo/shell_surface_unittest.cc index bd89272..653630c 100644 --- a/components/exo/shell_surface_unittest.cc +++ b/components/exo/shell_surface_unittest.cc
@@ -418,9 +418,9 @@ TEST_F(ShellSurfaceTest, ModalWindow) { std::unique_ptr<Surface> surface(new Surface); - std::unique_ptr<ShellSurface> shell_surface( - new ShellSurface(surface.get(), nullptr, gfx::Rect(), true, false, - ash::kShellWindowId_SystemModalContainer)); + std::unique_ptr<ShellSurface> shell_surface(new ShellSurface( + surface.get(), nullptr, ShellSurface::BoundsMode::SHELL, gfx::Point(), + true, false, ash::kShellWindowId_SystemModalContainer)); gfx::Size desktop_size(640, 480); std::unique_ptr<Buffer> desktop_buffer( new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(desktop_size))); @@ -509,9 +509,9 @@ std::unique_ptr<Buffer> buffer( new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); std::unique_ptr<Surface> surface(new Surface); - std::unique_ptr<ShellSurface> shell_surface( - new ShellSurface(surface.get(), nullptr, gfx::Rect(), true, false, - ash::kShellWindowId_DefaultContainer)); + std::unique_ptr<ShellSurface> shell_surface(new ShellSurface( + surface.get(), nullptr, ShellSurface::BoundsMode::SHELL, gfx::Point(), + true, false, ash::kShellWindowId_DefaultContainer)); surface->Attach(buffer.get()); surface->Commit(); @@ -583,9 +583,9 @@ std::unique_ptr<Buffer> buffer( new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); std::unique_ptr<Surface> surface(new Surface); - std::unique_ptr<ShellSurface> shell_surface( - new ShellSurface(surface.get(), nullptr, gfx::Rect(), true, false, - ash::kShellWindowId_DefaultContainer)); + std::unique_ptr<ShellSurface> shell_surface(new ShellSurface( + surface.get(), nullptr, ShellSurface::BoundsMode::SHELL, gfx::Point(), + true, false, ash::kShellWindowId_DefaultContainer)); surface->Attach(buffer.get()); surface->Commit(); @@ -666,10 +666,9 @@ std::unique_ptr<Buffer> buffer( new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); std::unique_ptr<Surface> surface(new Surface); - // Set the bounds to disable auto managed mode. - std::unique_ptr<ShellSurface> shell_surface( - new ShellSurface(surface.get(), nullptr, gfx::Rect(640, 480), true, false, - ash::kShellWindowId_DefaultContainer)); + std::unique_ptr<ShellSurface> shell_surface(new ShellSurface( + surface.get(), nullptr, ShellSurface::BoundsMode::CLIENT, gfx::Point(), + true, false, ash::kShellWindowId_DefaultContainer)); // Postion the widget at 10,10 so that we get non zero offset. const gfx::Size content_size(100, 100); @@ -728,10 +727,9 @@ std::unique_ptr<Buffer> buffer( new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); std::unique_ptr<Surface> surface(new Surface); - // Set the bounds to disable auto managed mode. - std::unique_ptr<ShellSurface> shell_surface( - new ShellSurface(surface.get(), nullptr, gfx::Rect(640, 400), true, false, - ash::kShellWindowId_DefaultContainer)); + std::unique_ptr<ShellSurface> shell_surface(new ShellSurface( + surface.get(), nullptr, ShellSurface::BoundsMode::CLIENT, gfx::Point(), + true, false, ash::kShellWindowId_DefaultContainer)); // Postion the widget at 10,10 so that we get non zero offset. const gfx::Size content_size(100, 100); @@ -758,9 +756,9 @@ TEST_F(ShellSurfaceTest, ShadowStartMaximized) { std::unique_ptr<Surface> surface(new Surface); - std::unique_ptr<ShellSurface> shell_surface( - new ShellSurface(surface.get(), nullptr, gfx::Rect(640, 480), true, false, - ash::kShellWindowId_DefaultContainer)); + std::unique_ptr<ShellSurface> shell_surface(new ShellSurface( + surface.get(), nullptr, ShellSurface::BoundsMode::CLIENT, gfx::Point(), + true, false, ash::kShellWindowId_DefaultContainer)); shell_surface->Maximize(); views::Widget* widget = shell_surface->GetWidget(); aura::Window* window = widget->GetNativeWindow(); @@ -828,9 +826,9 @@ std::unique_ptr<Buffer> buffer( new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); std::unique_ptr<Surface> surface(new Surface); - std::unique_ptr<ShellSurface> shell_surface( - new ShellSurface(surface.get(), nullptr, gfx::Rect(100, 100), true, false, - ash::kShellWindowId_DefaultContainer)); + std::unique_ptr<ShellSurface> shell_surface(new ShellSurface( + surface.get(), nullptr, ShellSurface::BoundsMode::CLIENT, gfx::Point(), + true, false, ash::kShellWindowId_DefaultContainer)); surface->Attach(buffer.get()); @@ -868,8 +866,9 @@ const gfx::Size buffer_size(display_size); Buffer buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size)); Surface surface; - ShellSurface shell_surface(&surface, nullptr, gfx::Rect(100, 100), true, - false, ash::kShellWindowId_DefaultContainer); + ShellSurface shell_surface(&surface, nullptr, + ShellSurface::BoundsMode::CLIENT, gfx::Point(), + true, false, ash::kShellWindowId_DefaultContainer); surface.Attach(&buffer); gfx::Rect shadow_bounds(10, 10, 100, 100); @@ -918,8 +917,9 @@ // Create a new surface Buffer buffer2(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size)); Surface surface2; - ShellSurface shell_surface2(&surface2, nullptr, gfx::Rect(640, 480), true, - false, ash::kShellWindowId_DefaultContainer); + ShellSurface shell_surface2( + &surface2, nullptr, ShellSurface::BoundsMode::CLIENT, gfx::Point(), true, + false, ash::kShellWindowId_DefaultContainer); surface2.Attach(&buffer2); shell_surface2.SetRectangularSurfaceShadow(shadow_bounds); surface2.Commit();
diff --git a/components/exo/test/exo_test_helper.cc b/components/exo/test/exo_test_helper.cc index d729b75..e10c6da2 100644 --- a/components/exo/test/exo_test_helper.cc +++ b/components/exo/test/exo_test_helper.cc
@@ -28,8 +28,8 @@ int container = is_modal ? ash::kShellWindowId_SystemModalContainer : ash::kShellWindowId_DefaultContainer; shell_surface_.reset(new ShellSurface(surface_.get(), nullptr, - gfx::Rect(gpu_buffer->GetSize()), true, - false, container)); + ShellSurface::BoundsMode::SHELL, + gfx::Point(), true, false, container)); buffer_.reset(new Buffer(std::move(gpu_buffer))); surface_->Attach(buffer_.get());
diff --git a/components/exo/wayland/server.cc b/components/exo/wayland/server.cc index 1cb7b4409..ef63a2a 100644 --- a/components/exo/wayland/server.cc +++ b/components/exo/wayland/server.cc
@@ -29,7 +29,6 @@ #include <string> #include <utility> -#include "ash/common/shell_observer.h" #include "ash/public/cpp/shell_window_ids.h" #include "ash/shell.h" #include "base/bind.h" @@ -1089,8 +1088,6 @@ } // Overridden from display::DisplayObserver: - void OnDisplayAdded(const display::Display& new_display) override {} - void OnDisplayRemoved(const display::Display& new_display) override {} void OnDisplayMetricsChanged(const display::Display& display, uint32_t changed_metrics) override { if (display::Screen::GetScreen()->GetPrimaryDisplay().id() != display.id()) @@ -2046,7 +2043,7 @@ ? ZCR_REMOTE_SHELL_V1_LAYOUT_MODE_TABLET : ZCR_REMOTE_SHELL_V1_LAYOUT_MODE_WINDOWED; - SendPrimaryDisplayMetrics(); + SendDisplayMetrics(); SendActivated(helper->GetActiveWindow(), nullptr); } ~WaylandRemoteShell() override { @@ -2068,40 +2065,29 @@ } // Overridden from display::DisplayObserver: - void OnDisplayAdded(const display::Display& new_display) override {} - void OnDisplayRemoved(const display::Display& new_display) override {} void OnDisplayMetricsChanged(const display::Display& display, uint32_t changed_metrics) override { if (display::Screen::GetScreen()->GetPrimaryDisplay().id() != display.id()) return; - // No need to update when a primary dislpay has changed without bounds + // No need to update when a primary display has changed without bounds // change. See WaylandPrimaryDisplayObserver::OnDisplayMetricsChanged // for more details. if (changed_metrics & (DISPLAY_METRIC_BOUNDS | DISPLAY_METRIC_DEVICE_SCALE_FACTOR | DISPLAY_METRIC_ROTATION | DISPLAY_METRIC_WORK_AREA)) { - SendDisplayMetrics(display); + ScheduleSendDisplayMetrics(0); } } // Overridden from WMHelper::MaximizeModeObserver: void OnMaximizeModeStarted() override { layout_mode_ = ZCR_REMOTE_SHELL_V1_LAYOUT_MODE_TABLET; - - send_configure_after_layout_change_ = true; - base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( - FROM_HERE, base::Bind(&WaylandRemoteShell::MaybeSendConfigure, - weak_ptr_factory_.GetWeakPtr()), - base::TimeDelta::FromMilliseconds(kConfigureDelayAfterLayoutSwitchMs)); + ScheduleSendDisplayMetrics(kConfigureDelayAfterLayoutSwitchMs); } void OnMaximizeModeEnded() override { layout_mode_ = ZCR_REMOTE_SHELL_V1_LAYOUT_MODE_WINDOWED; - send_configure_after_layout_change_ = true; - base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( - FROM_HERE, base::Bind(&WaylandRemoteShell::MaybeSendConfigure, - weak_ptr_factory_.GetWeakPtr()), - base::TimeDelta::FromMilliseconds(kConfigureDelayAfterLayoutSwitchMs)); + ScheduleSendDisplayMetrics(kConfigureDelayAfterLayoutSwitchMs); } // Overridden from WMHelper::ActivationObserver: @@ -2111,27 +2097,30 @@ } private: - void SendPrimaryDisplayMetrics() { - const display::Display primary = - display::Screen::GetScreen()->GetPrimaryDisplay(); - - SendDisplayMetrics(primary); + void ScheduleSendDisplayMetrics(int delay_ms) { + needs_send_display_metrics_ = true; + base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( + FROM_HERE, base::Bind(&WaylandRemoteShell::SendDisplayMetrics, + weak_ptr_factory_.GetWeakPtr()), + base::TimeDelta::FromMilliseconds(delay_ms)); } - void MaybeSendConfigure() { - if (send_configure_after_layout_change_) - SendPrimaryDisplayMetrics(); - } + void SendDisplayMetrics() { + if (!needs_send_display_metrics_) + return; + needs_send_display_metrics_ = false; - void SendDisplayMetrics(const display::Display& display) { - send_configure_after_layout_change_ = false; + const display::Screen* screen = display::Screen::GetScreen(); + const display::Display primary_display = screen->GetPrimaryDisplay(); - const gfx::Insets& work_area_insets = display.GetWorkAreaInsets(); + const gfx::Insets& work_area_insets = primary_display.GetWorkAreaInsets(); zcr_remote_shell_v1_send_configuration_changed( - remote_shell_resource_, display.size().width(), display.size().height(), - OutputTransform(display.rotation()), - wl_fixed_from_double(display.device_scale_factor()), + remote_shell_resource_, + primary_display.size().width(), + primary_display.size().height(), + OutputTransform(primary_display.rotation()), + wl_fixed_from_double(primary_display.device_scale_factor()), work_area_insets.left(), work_area_insets.top(), work_area_insets.right(), work_area_insets.bottom(), layout_mode_); wl_client_flush(wl_resource_get_client(remote_shell_resource_)); @@ -2176,7 +2165,7 @@ // The remote shell resource associated with observer. wl_resource* const remote_shell_resource_; - bool send_configure_after_layout_change_ = false; + bool needs_send_display_metrics_ = true; int layout_mode_ = ZCR_REMOTE_SHELL_V1_LAYOUT_MODE_WINDOWED;
diff --git a/content/browser/DEPS b/content/browser/DEPS index af18f2d..b3a770a 100644 --- a/content/browser/DEPS +++ b/content/browser/DEPS
@@ -78,7 +78,6 @@ "+third_party/WebKit/public/platform/WebReferrerPolicy.h", "+third_party/WebKit/public/platform/WebScreenInfo.h", "+third_party/WebKit/public/platform/WebSecurityStyle.h", - "+third_party/WebKit/public/platform/WebString.h", "+third_party/WebKit/public/platform/WebTouchEvent.h", "+third_party/WebKit/public/platform/WebTextInputType.h", "+third_party/WebKit/public/platform/mime_registry.mojom.h",
diff --git a/content/browser/renderer_host/offscreen_canvas_surface_factory_impl.cc b/content/browser/renderer_host/offscreen_canvas_surface_factory_impl.cc index 357c249..b631e9a 100644 --- a/content/browser/renderer_host/offscreen_canvas_surface_factory_impl.cc +++ b/content/browser/renderer_host/offscreen_canvas_surface_factory_impl.cc
@@ -21,7 +21,7 @@ void OffscreenCanvasSurfaceFactoryImpl::CreateOffscreenCanvasSurface( const cc::FrameSinkId& parent_frame_sink_id, const cc::FrameSinkId& frame_sink_id, - blink::mojom::OffscreenCanvasSurfaceClientPtr client, + cc::mojom::DisplayCompositorClientPtr client, blink::mojom::OffscreenCanvasSurfaceRequest request) { OffscreenCanvasSurfaceImpl::Create(parent_frame_sink_id, frame_sink_id, std::move(client), std::move(request));
diff --git a/content/browser/renderer_host/offscreen_canvas_surface_factory_impl.h b/content/browser/renderer_host/offscreen_canvas_surface_factory_impl.h index 3370b52..2b5b4ad 100644 --- a/content/browser/renderer_host/offscreen_canvas_surface_factory_impl.h +++ b/content/browser/renderer_host/offscreen_canvas_surface_factory_impl.h
@@ -5,6 +5,7 @@ #ifndef CONTENT_BROWSER_RENDERER_HOST_OFFSCREEN_CANVAS_SURFACE_FACTORY_IMPL_H_ #define CONTENT_BROWSER_RENDERER_HOST_OFFSCREEN_CANVAS_SURFACE_FACTORY_IMPL_H_ +#include "cc/ipc/display_compositor.mojom.h" #include "third_party/WebKit/public/platform/modules/offscreencanvas/offscreen_canvas_surface.mojom.h" namespace content { @@ -22,7 +23,7 @@ void CreateOffscreenCanvasSurface( const cc::FrameSinkId& parent_frame_sink_id, const cc::FrameSinkId& frame_sink_id, - blink::mojom::OffscreenCanvasSurfaceClientPtr client, + cc::mojom::DisplayCompositorClientPtr client, blink::mojom::OffscreenCanvasSurfaceRequest request) override; private:
diff --git a/content/browser/renderer_host/offscreen_canvas_surface_impl.cc b/content/browser/renderer_host/offscreen_canvas_surface_impl.cc index 27397ba..16f64aa 100644 --- a/content/browser/renderer_host/offscreen_canvas_surface_impl.cc +++ b/content/browser/renderer_host/offscreen_canvas_surface_impl.cc
@@ -19,7 +19,7 @@ OffscreenCanvasSurfaceImpl::OffscreenCanvasSurfaceImpl( const cc::FrameSinkId& parent_frame_sink_id, const cc::FrameSinkId& frame_sink_id, - blink::mojom::OffscreenCanvasSurfaceClientPtr client) + cc::mojom::DisplayCompositorClientPtr client) : client_(std::move(client)), frame_sink_id_(frame_sink_id), parent_frame_sink_id_(parent_frame_sink_id) { @@ -38,7 +38,7 @@ void OffscreenCanvasSurfaceImpl::Create( const cc::FrameSinkId& parent_frame_sink_id, const cc::FrameSinkId& frame_sink_id, - blink::mojom::OffscreenCanvasSurfaceClientPtr client, + cc::mojom::DisplayCompositorClientPtr client, blink::mojom::OffscreenCanvasSurfaceRequest request) { std::unique_ptr<OffscreenCanvasSurfaceImpl> impl = base::MakeUnique<OffscreenCanvasSurfaceImpl>(
diff --git a/content/browser/renderer_host/offscreen_canvas_surface_impl.h b/content/browser/renderer_host/offscreen_canvas_surface_impl.h index 50733d2..0004126 100644 --- a/content/browser/renderer_host/offscreen_canvas_surface_impl.h +++ b/content/browser/renderer_host/offscreen_canvas_surface_impl.h
@@ -5,6 +5,7 @@ #ifndef CONTENT_BROWSER_RENDERER_HOST_OFFSCREEN_CANVAS_SURFACE_IMPL_H_ #define CONTENT_BROWSER_RENDERER_HOST_OFFSCREEN_CANVAS_SURFACE_IMPL_H_ +#include "cc/ipc/display_compositor.mojom.h" #include "cc/surfaces/surface_id.h" #include "cc/surfaces/surface_id_allocator.h" #include "mojo/public/cpp/bindings/interface_request.h" @@ -16,15 +17,14 @@ class CONTENT_EXPORT OffscreenCanvasSurfaceImpl : public blink::mojom::OffscreenCanvasSurface { public: - OffscreenCanvasSurfaceImpl( - const cc::FrameSinkId& parent_frame_sink_id, - const cc::FrameSinkId& frame_sink_id, - blink::mojom::OffscreenCanvasSurfaceClientPtr client); + OffscreenCanvasSurfaceImpl(const cc::FrameSinkId& parent_frame_sink_id, + const cc::FrameSinkId& frame_sink_id, + cc::mojom::DisplayCompositorClientPtr client); ~OffscreenCanvasSurfaceImpl() override; static void Create(const cc::FrameSinkId& parent_frame_sink_id, const cc::FrameSinkId& frame_sink_id, - blink::mojom::OffscreenCanvasSurfaceClientPtr client, + cc::mojom::DisplayCompositorClientPtr client, blink::mojom::OffscreenCanvasSurfaceRequest request); void OnSurfaceCreated(const cc::SurfaceInfo& surface_info); @@ -45,7 +45,7 @@ } private: - blink::mojom::OffscreenCanvasSurfaceClientPtr client_; + cc::mojom::DisplayCompositorClientPtr client_; mojo::StrongBindingPtr<blink::mojom::OffscreenCanvasSurface> binding_; // Surface-related state
diff --git a/content/browser/renderer_host/offscreen_canvas_surface_manager_unittest.cc b/content/browser/renderer_host/offscreen_canvas_surface_manager_unittest.cc index a00a043c..6bd8388 100644 --- a/content/browser/renderer_host/offscreen_canvas_surface_manager_unittest.cc +++ b/content/browser/renderer_host/offscreen_canvas_surface_manager_unittest.cc
@@ -70,7 +70,7 @@ // process. TEST_F(OffscreenCanvasSurfaceManagerTest, SingleHTMLCanvasElementTransferToOffscreen) { - blink::mojom::OffscreenCanvasSurfaceClientPtr client; + cc::mojom::DisplayCompositorClientPtr client; cc::FrameSinkId frame_sink_id(3, 3); cc::SurfaceIdAllocator surface_id_allocator; cc::LocalSurfaceId current_local_surface_id( @@ -93,14 +93,14 @@ TEST_F(OffscreenCanvasSurfaceManagerTest, MultiHTMLCanvasElementTransferToOffscreen) { - blink::mojom::OffscreenCanvasSurfaceClientPtr client_a; + cc::mojom::DisplayCompositorClientPtr client_a; cc::FrameSinkId dummy_parent_frame_sink_id(0, 0); cc::FrameSinkId frame_sink_id_a(3, 3); cc::SurfaceIdAllocator surface_id_allocator; auto surface_impl_a = base::WrapUnique(new OffscreenCanvasSurfaceImpl( dummy_parent_frame_sink_id, frame_sink_id_a, std::move(client_a))); - blink::mojom::OffscreenCanvasSurfaceClientPtr client_b; + cc::mojom::DisplayCompositorClientPtr client_b; cc::FrameSinkId frame_sink_id_b(4, 4); auto surface_impl_b = base::WrapUnique(new OffscreenCanvasSurfaceImpl(
diff --git a/content/common/DEPS b/content/common/DEPS index 3c8ba65..1ef8e94 100644 --- a/content/common/DEPS +++ b/content/common/DEPS
@@ -11,7 +11,6 @@ # header-only types, and some selected common code. "-third_party/WebKit", "+third_party/WebKit/public/platform/WebAddressSpace.h", - "+third_party/WebKit/public/platform/WebCString.h", "+third_party/WebKit/public/platform/WebDisplayMode.h", "+third_party/WebKit/public/platform/WebDragOperation.h", "+third_party/WebKit/public/platform/WebFeaturePolicy.h", @@ -65,7 +64,6 @@ "+third_party/WebKit/public/web/WebDeviceEmulationParams.h", "+third_party/WebKit/public/web/WebDragStatus.h", "+third_party/WebKit/public/web/WebFindOptions.h", - "+third_party/WebKit/public/web/WebFrameOwnerProperties.h", "+third_party/WebKit/public/web/WebFrameSerializerCacheControlPolicy.h", "+third_party/WebKit/public/web/WebMediaPlayerAction.h", "+third_party/WebKit/public/web/WebPluginAction.h", @@ -75,7 +73,6 @@ "+third_party/WebKit/public/web/WebSharedWorkerCreationErrors.h", "+third_party/WebKit/public/web/WebTextDirection.h", "+third_party/WebKit/public/web/WebTreeScopeType.h", - "+third_party/WebKit/public/web/WebWindowFeatures.h", "+third_party/WebKit/public/web/mac/WebScrollbarTheme.h", "+third_party/WebKit/public/web/win/WebFontRendering.h" ]
diff --git a/extensions/common/feature_switch.cc b/extensions/common/feature_switch.cc index 5574372..6567ba9 100644 --- a/extensions/common/feature_switch.cc +++ b/extensions/common/feature_switch.cc
@@ -31,7 +31,7 @@ #else nullptr, #endif -#if defined(OS_WIN) +#if defined(OS_WIN) || defined(OS_MACOSX) FeatureSwitch::DEFAULT_ENABLED), #else FeatureSwitch::DEFAULT_DISABLED),
diff --git a/media/remoting/BUILD.gn b/media/remoting/BUILD.gn index 5e305ef..bf628d7 100644 --- a/media/remoting/BUILD.gn +++ b/media/remoting/BUILD.gn
@@ -71,6 +71,7 @@ "//mojo/public/cpp/bindings", "//skia", "//ui/gfx", + "//ui/vector_icons", ] }
diff --git a/media/remoting/DEPS b/media/remoting/DEPS index ef8ad28..9f36c275 100644 --- a/media/remoting/DEPS +++ b/media/remoting/DEPS
@@ -1,3 +1,4 @@ include_rules = [ "+mojo/public", + "+ui/vector_icons", ]
diff --git a/media/remoting/interstitial.cc b/media/remoting/interstitial.cc index fbeb035..2548a2d0 100644 --- a/media/remoting/interstitial.cc +++ b/media/remoting/interstitial.cc
@@ -18,7 +18,7 @@ #include "ui/gfx/geometry/size.h" #include "ui/gfx/paint_vector_icon.h" #include "ui/gfx/skbitmap_operations.h" -#include "ui/gfx/vector_icons_public.h" +#include "ui/vector_icons/vector_icons.h" namespace media { namespace remoting { @@ -93,10 +93,9 @@ sk_text_offset_y, paint); // Draw the appropriate Cast icon. - gfx::VectorIconId current_icon = - (type == InterstitialType::IN_SESSION - ? gfx::VectorIconId::MEDIA_ROUTER_ACTIVE - : gfx::VectorIconId::MEDIA_ROUTER_WARNING); + const gfx::VectorIcon& current_icon = type == InterstitialType::IN_SESSION + ? ui::kMediaRouterActiveIcon + : ui::kMediaRouterWarningIcon; gfx::ImageSkia icon_image = gfx::CreateVectorIcon( current_icon, canvas_size.height() / 6, SK_ColorLTGRAY); const SkBitmap* icon_bitmap = icon_image.bitmap();
diff --git a/net/nqe/network_quality_estimator.cc b/net/nqe/network_quality_estimator.cc index daa50cd..c92ed5286 100644 --- a/net/nqe/network_quality_estimator.cc +++ b/net/nqe/network_quality_estimator.cc
@@ -402,25 +402,11 @@ if (!RequestSchemeIsHTTPOrHTTPS(request)) return; - throughput_analyzer_->NotifyStartTransaction(request); -} - -void NetworkQualityEstimator::NotifyHeadersReceived(const URLRequest& request) { - TRACE_EVENT0(kNetTracingCategory, - "NetworkQualityEstimator::NotifyHeadersReceived"); - DCHECK(thread_checker_.CalledOnValidThread()); - - if (!RequestSchemeIsHTTPOrHTTPS(request) || - !RequestProvidesRTTObservation(request)) { - return; - } - - const base::TimeTicks now = tick_clock_->NowTicks(); - // Update |estimated_quality_at_last_main_frame_| if this is a main frame // request. // TODO(tbansal): Refactor this to a separate method. if (request.load_flags() & LOAD_MAIN_FRAME_DEPRECATED) { + base::TimeTicks now = tick_clock_->NowTicks(); last_main_frame_request_ = now; ComputeEffectiveConnectionType(); @@ -444,6 +430,25 @@ measuring_delay); } } + throughput_analyzer_->NotifyStartTransaction(request); +} + +void NetworkQualityEstimator::NotifyHeadersReceived(const URLRequest& request) { + TRACE_EVENT0(kNetTracingCategory, + "NetworkQualityEstimator::NotifyHeadersReceived"); + DCHECK(thread_checker_.CalledOnValidThread()); + + if (!RequestSchemeIsHTTPOrHTTPS(request) || + !RequestProvidesRTTObservation(request)) { + return; + } + + // Update |estimated_quality_at_last_main_frame_| if this is a main frame + // request. + // TODO(tbansal): Refactor this to a separate method. + if (request.load_flags() & LOAD_MAIN_FRAME_DEPRECATED) { + ComputeEffectiveConnectionType(); + } LoadTimingInfo load_timing_info; request.GetLoadTimingInfo(&load_timing_info); @@ -468,9 +473,9 @@ peak_network_quality_.downstream_throughput_kbps()); } - RttObservation http_rtt_observation(observed_http_rtt, now, - signal_strength_dbm_, - NETWORK_QUALITY_OBSERVATION_SOURCE_HTTP); + RttObservation http_rtt_observation( + observed_http_rtt, tick_clock_->NowTicks(), signal_strength_dbm_, + NETWORK_QUALITY_OBSERVATION_SOURCE_HTTP); rtt_observations_.AddObservation(http_rtt_observation); NotifyObserversOfRTT(http_rtt_observation); }
diff --git a/net/nqe/network_quality_estimator.h b/net/nqe/network_quality_estimator.h index 21db66f..b56521c 100644 --- a/net/nqe/network_quality_estimator.h +++ b/net/nqe/network_quality_estimator.h
@@ -681,11 +681,11 @@ nqe::internal::NetworkQuality typical_network_quality_ [EffectiveConnectionType::EFFECTIVE_CONNECTION_TYPE_LAST]; - // Latest time when the headers for a main frame request were received. + // Time when the transaction for the last main frame request was started. base::TimeTicks last_main_frame_request_; - // Estimated network quality when the response headers for the last mainframe - // request were received. + // Estimated network quality when the transaction for the last main frame + // request was started. nqe::internal::NetworkQuality estimated_quality_at_last_main_frame_; EffectiveConnectionType effective_connection_type_at_last_main_frame_;
diff --git a/net/nqe/network_quality_estimator_unittest.cc b/net/nqe/network_quality_estimator_unittest.cc index e035ced..55e3825 100644 --- a/net/nqe/network_quality_estimator_unittest.cc +++ b/net/nqe/network_quality_estimator_unittest.cc
@@ -59,7 +59,9 @@ if (bucket.min == bucket_min) actual_count_samples += bucket.count; } - EXPECT_LE(expected_min_count_samples, actual_count_samples); + EXPECT_LE(expected_min_count_samples, actual_count_samples) + << " histogram=" << histogram << " bucket_min=" << bucket_min + << " expected_min_count_samples=" << expected_min_count_samples; } } // namespace @@ -1693,6 +1695,9 @@ TestEffectiveConnectionTypeObserver observer; TestNetworkQualityEstimator estimator; estimator.AddEffectiveConnectionTypeObserver(&observer); + // |observer| may be notified as soon as it is added. Run the loop to so that + // the notification to |observer| is finished. + base::RunLoop().RunUntilIdle(); estimator.SetTickClockForTesting(std::move(tick_clock)); TestDelegate test_delegate; @@ -1935,6 +1940,9 @@ estimator.SimulateNetworkChange(NetworkChangeNotifier::CONNECTION_WIFI, "test"); estimator.AddEffectiveConnectionTypeObserver(&observer); + // |observer| may be notified as soon as it is added. Run the loop to so that + // the notification to |observer| is finished. + base::RunLoop().RunUntilIdle(); TestDelegate test_delegate; TestURLRequestContext context(true); @@ -2109,11 +2117,17 @@ std::map<std::string, std::string> variation_params; variation_params["persistent_cache_reading_enabled"] = "true"; - TestNetworkQualityEstimator estimator(variation_params); + TestNetworkQualityEstimator estimator( + nullptr, variation_params, true, true, + true /* add_default_platform_observations */, + base::MakeUnique<BoundTestNetLog>()); estimator.SimulateNetworkChange( NetworkChangeNotifier::ConnectionType::CONNECTION_2G, "test"); estimator.AddRTTObserver(&rtt_observer); + // |observer| may be notified as soon as it is added. Run the loop to so that + // the notification to |observer| is finished. + base::RunLoop().RunUntilIdle(); TestDelegate test_delegate; TestURLRequestContext context(true); @@ -2129,8 +2143,8 @@ EXPECT_EQ(0U, rtt_observer.observations().size()); base::TimeDelta rtt; - EXPECT_FALSE(estimator.GetRecentHttpRTT(base::TimeTicks(), &rtt)); - EXPECT_FALSE(estimator.GetRecentTransportRTT(base::TimeTicks(), &rtt)); + EXPECT_TRUE(estimator.GetRecentHttpRTT(base::TimeTicks(), &rtt)); + EXPECT_TRUE(estimator.GetRecentTransportRTT(base::TimeTicks(), &rtt)); // Send two requests. Verify that the completion of each request generates at // least one TCP RTT observation. @@ -2175,16 +2189,12 @@ // Verify that metrics are logged correctly on main-frame requests. histogram_tester.ExpectTotalCount("NQE.MainFrame.TransportRTT.Percentile50", num_requests); - histogram_tester.ExpectBucketCount("NQE.EstimateAvailable.MainFrame.RTT", 0, - 1); - histogram_tester.ExpectBucketCount("NQE.EstimateAvailable.MainFrame.RTT", 1, - num_requests - 1); + histogram_tester.ExpectUniqueSample("NQE.EstimateAvailable.MainFrame.RTT", 1, + num_requests); histogram_tester.ExpectUniqueSample( "NQE.EstimateAvailable.MainFrame.TransportRTT", 1, num_requests); - histogram_tester.ExpectBucketCount("NQE.EstimateAvailable.MainFrame.Kbps", 0, - 1); - histogram_tester.ExpectBucketCount("NQE.EstimateAvailable.MainFrame.Kbps", 1, - num_requests - 1); + histogram_tester.ExpectUniqueSample("NQE.EstimateAvailable.MainFrame.Kbps", 1, + num_requests); histogram_tester.ExpectTotalCount( "NQE.MainFrame.TransportRTT.Percentile50.2G", num_requests); @@ -2193,13 +2203,11 @@ histogram_tester.ExpectTotalCount("NQE.MainFrame.EffectiveConnectionType.2G", num_requests); histogram_tester.ExpectBucketCount("NQE.MainFrame.EffectiveConnectionType.2G", - EFFECTIVE_CONNECTION_TYPE_UNKNOWN, 1); + EFFECTIVE_CONNECTION_TYPE_UNKNOWN, 0); ExpectBucketCountAtLeast(&histogram_tester, "NQE.RTT.ObservationSource", NETWORK_QUALITY_OBSERVATION_SOURCE_TCP, 1); ExpectBucketCountAtLeast(&histogram_tester, "NQE.Kbps.ObservationSource", NETWORK_QUALITY_OBSERVATION_SOURCE_HTTP, 1); - histogram_tester.ExpectBucketCount("NQE.MainFrame.EffectiveConnectionType.2G", - EFFECTIVE_CONNECTION_TYPE_UNKNOWN, 1); EXPECT_LE(1u, histogram_tester .GetAllSamples("NQE.EffectiveConnectionType.OnECTComputation") @@ -2555,6 +2563,9 @@ context.set_network_quality_estimator(&estimator); context.Init(); + histogram_tester.ExpectTotalCount( + "NQE.Correlation.ResourceLoadTime.0Kb_128Kb", 0); + // Start a main-frame request that should cause network quality estimator to // record the network quality at the last main frame request. std::unique_ptr<URLRequest> request_1(context.CreateRequest( @@ -2563,15 +2574,6 @@ LOAD_MAIN_FRAME_DEPRECATED); request_1->Start(); base::RunLoop().Run(); - histogram_tester.ExpectTotalCount( - "NQE.Correlation.ResourceLoadTime.0Kb_128Kb", 0); - - // Start another main-frame request which should cause network quality - // estimator to record the correlation UMA. - std::unique_ptr<URLRequest> request_2(context.CreateRequest( - estimator.GetEchoURL(), DEFAULT_PRIORITY, &test_delegate)); - request_2->Start(); - base::RunLoop().Run(); if (test.rand_double >= test.correlation_logging_probability) { histogram_tester.ExpectTotalCount( @@ -2729,6 +2731,9 @@ TestEffectiveConnectionTypeObserver observer; estimator.AddEffectiveConnectionTypeObserver(&observer); + // |observer| may be notified as soon as it is added. Run the loop to so + // that the notification to |observer| is finished. + base::RunLoop().RunUntilIdle(); TestDelegate test_delegate; TestURLRequestContext context(true);
diff --git a/services/ui/gpu/interfaces/BUILD.gn b/services/ui/gpu/interfaces/BUILD.gn index c1c65037..ea2062d5 100644 --- a/services/ui/gpu/interfaces/BUILD.gn +++ b/services/ui/gpu/interfaces/BUILD.gn
@@ -13,7 +13,7 @@ ] public_deps = [ - "//cc/ipc:internal_interfaces", + "//cc/ipc:interfaces", "//gpu/ipc/common:interfaces", "//services/ui/public/interfaces", "//ui/gfx/geometry/mojo",
diff --git a/services/ui/surfaces/BUILD.gn b/services/ui/surfaces/BUILD.gn index ec2a851..ebaafcb 100644 --- a/services/ui/surfaces/BUILD.gn +++ b/services/ui/surfaces/BUILD.gn
@@ -15,7 +15,7 @@ deps = [ "//base", "//cc", - "//cc/ipc:internal_interfaces", + "//cc/ipc:interfaces", "//cc/surfaces", "//components/display_compositor", "//gpu/command_buffer/client",
diff --git a/services/ui/ws/BUILD.gn b/services/ui/ws/BUILD.gn index 123544a7..46a606ab 100644 --- a/services/ui/ws/BUILD.gn +++ b/services/ui/ws/BUILD.gn
@@ -116,7 +116,7 @@ public_deps = [ "//base", "//cc", - "//cc/ipc:internal_interfaces", + "//cc/ipc:interfaces", "//cc/surfaces", "//cc/surfaces:surface_id", "//mojo/common:common_base",
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/characteristicProperties.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/characteristicProperties.html index c5885a1..8961b76 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/characteristicProperties.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/characteristicProperties.html
@@ -4,9 +4,6 @@ <script src="../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -test(t => { assert_true(window.testRunner instanceof Object); t.done(); }, - 'window.testRunner is required for the following tests.'); - promise_test(() => { return setBluetoothFakeAdapter('HeartRateAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/idl/idl-BluetoothDevice.html b/third_party/WebKit/LayoutTests/bluetooth/idl/idl-BluetoothDevice.html index 45dcc9e..42a2dcc 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/idl/idl-BluetoothDevice.html +++ b/third_party/WebKit/LayoutTests/bluetooth/idl/idl-BluetoothDevice.html
@@ -10,9 +10,6 @@ 'the constructor should not be callable'); }, 'BluetoothDevice IDL test'); -test(t => { assert_true(window.testRunner instanceof Object); t.done(); }, - 'window.testRunner is required for the following tests.'); - promise_test(() => { return setBluetoothFakeAdapter('GlucoseHeartRateAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/adapter-off.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/adapter-off.html index 918a1819..667dded8 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/adapter-off.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/adapter-off.html
@@ -5,7 +5,7 @@ <script> 'use strict'; promise_test(() => { - testRunner.setBluetoothManualChooser(true); + setBluetoothManualChooser(true); let requestDevicePromise = setBluetoothFakeAdapter('NotPoweredAdapter') .then(() => requestDeviceWithKeyDown({ @@ -16,7 +16,7 @@ ['chooser-opened(file://)', 'adapter-disabled'], events); - testRunner.sendBluetoothManualChooserEvent('cancelled', ''); + sendBluetoothManualChooserEvent('cancelled', ''); return assert_promise_rejects_with_message( requestDevicePromise, new DOMException('User cancelled the requestDevice() chooser.',
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/consecutive-calls.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/consecutive-calls.html index 4ce17d7..39002b0 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/consecutive-calls.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/consecutive-calls.html
@@ -16,7 +16,7 @@ return idsByName; }; - testRunner.setBluetoothManualChooser(true); + setBluetoothManualChooser(true); // Open a chooser. let firstRequestDevicePromise = setBluetoothFakeAdapter('HeartRateAdapter') .then(() => assert_promise_rejects_with_message( @@ -35,7 +35,7 @@ return getBluetoothManualChooserEvents(4) .then(assert_expected_events) .then(idsByName => { - testRunner.sendBluetoothManualChooserEvent( + sendBluetoothManualChooserEvent( 'selected', idsByName.get('Heart Rate Device')); return Promise.all([ firstRequestDevicePromise,
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/device-removed.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/device-removed.html index c3648e96..f110f87 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/device-removed.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/device-removed.html
@@ -5,7 +5,7 @@ <script> 'use strict'; promise_test(() => { - testRunner.setBluetoothManualChooser(true); + setBluetoothManualChooser(true); let requestDevicePromise = setBluetoothFakeAdapter('DevicesRemovedAdapter') @@ -22,7 +22,7 @@ idsByName.assert_add_device_event(events[3]); assert_true(idsByName.has('New Glucose Device')); assert_equals(events[4], 'discovery-idle'); - testRunner.sendBluetoothManualChooserEvent( + sendBluetoothManualChooserEvent( 'selected', idsByName.get('New Glucose Device')); return requestDevicePromise; }), new DOMException('User selected a device that doesn\'t exist anymore.',
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/multiple-matching-devices.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/multiple-matching-devices.html index 58ed1ace3..5185d02a 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/multiple-matching-devices.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/multiple-matching-devices.html
@@ -5,7 +5,7 @@ <script> 'use strict'; promise_test(() => { - testRunner.setBluetoothManualChooser(true); + setBluetoothManualChooser(true); let requestDevicePromise = setBluetoothFakeAdapter('GlucoseHeartRateAdapter') .then(() => requestDeviceWithKeyDown({ @@ -24,7 +24,7 @@ assert_true(idsByName.has('Heart Rate Device')); assert_true(idsByName.has('Glucose Device')); assert_equals(events[4], 'discovery-idle'); - testRunner.sendBluetoothManualChooserEvent( + sendBluetoothManualChooserEvent( 'selected', idsByName.get('Glucose Device')); return requestDevicePromise; }).then(device => assert_equals(device.name, 'Glucose Device'));
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/new-scan-all-types.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/new-scan-all-types.html index 6d3a8c9..d8764f8 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/new-scan-all-types.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/new-scan-all-types.html
@@ -5,7 +5,7 @@ <script> 'use strict'; promise_test(() => { - testRunner.setBluetoothManualChooser(true); + setBluetoothManualChooser(true); let requestDevicePromise = setBluetoothFakeAdapter('DeviceEventAdapter') @@ -31,7 +31,7 @@ assert_true(idsByName.has('Discovery Generic Access Device', 'Generic Access Device')); assert_equals(events[6], 'discovery-idle'); - testRunner.sendBluetoothManualChooserEvent( + sendBluetoothManualChooserEvent( 'selected', idsByName.get('Connected Heart Rate Device')); return requestDevicePromise; });
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/new-scan-connected-devices.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/new-scan-connected-devices.html index 56f8930..abb67cb5 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/new-scan-connected-devices.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/new-scan-connected-devices.html
@@ -5,7 +5,7 @@ <script> 'use strict'; promise_test(() => { - testRunner.setBluetoothManualChooser(true); + setBluetoothManualChooser(true); let requestDevicePromise = setBluetoothFakeAdapter('DeviceEventAdapter') @@ -18,7 +18,7 @@ assert_true(idsByName.has('Connected Heart Rate Device'), events[1]); assert_equals(events[2], 'discovering'); assert_equals(events[3], 'discovery-idle'); - testRunner.sendBluetoothManualChooserEvent( + sendBluetoothManualChooserEvent( 'selected', idsByName.get('Connected Heart Rate Device')); return requestDevicePromise; });
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/new-scan-device-added.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/new-scan-device-added.html index e63429d5..4a454de 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/new-scan-device-added.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/new-scan-device-added.html
@@ -5,7 +5,7 @@ <script> 'use strict'; promise_test(() => { - testRunner.setBluetoothManualChooser(true); + setBluetoothManualChooser(true); let requestDevicePromise = setBluetoothFakeAdapter('DeviceEventAdapter') @@ -18,7 +18,7 @@ idsByName.assert_add_device_event(events[2]); assert_true(idsByName.has('New Glucose Device')); assert_equals(events[3], 'discovery-idle'); - testRunner.sendBluetoothManualChooserEvent( + sendBluetoothManualChooserEvent( 'selected', idsByName.get('New Glucose Device')); return requestDevicePromise; });
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/new-scan-device-changed.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/new-scan-device-changed.html index 99eef17..88dcb75 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/new-scan-device-changed.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/new-scan-device-changed.html
@@ -5,7 +5,7 @@ <script> 'use strict'; promise_test(() => { - testRunner.setBluetoothManualChooser(true); + setBluetoothManualChooser(true); let requestDevicePromise = setBluetoothFakeAdapter('DeviceEventAdapter') @@ -18,7 +18,7 @@ idsByName.assert_add_device_event(events[2]); assert_true(idsByName.has('Changing Battery Device')); assert_equals(events[3], 'discovery-idle'); - testRunner.sendBluetoothManualChooserEvent( + sendBluetoothManualChooserEvent( 'selected', idsByName.get('Changing Battery Device')); return requestDevicePromise; });
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/new-scan-services-discovered.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/new-scan-services-discovered.html index fbe2af4..00153cc9 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/new-scan-services-discovered.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/new-scan-services-discovered.html
@@ -5,7 +5,7 @@ <script> 'use strict'; promise_test(() => { - testRunner.setBluetoothManualChooser(true); + setBluetoothManualChooser(true); let requestDevicePromise = setBluetoothFakeAdapter('DeviceEventAdapter') @@ -18,7 +18,7 @@ idsByName.assert_add_device_event(events[2]); assert_true(idsByName.has('Discovery Generic Access Device')); assert_equals(events[3], 'discovery-idle'); - testRunner.sendBluetoothManualChooserEvent( + sendBluetoothManualChooserEvent( 'selected', idsByName.get('Discovery Generic Access Device')); return requestDevicePromise; });
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/restart-scan-finds-new-device.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/restart-scan-finds-new-device.html index 58d2582f..5a423c2 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/restart-scan-finds-new-device.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/restart-scan-finds-new-device.html
@@ -5,7 +5,7 @@ <script> 'use strict'; promise_test(() => { - testRunner.setBluetoothManualChooser(true); + setBluetoothManualChooser(true); // Open the chooser, looking for a Heart Rate device. let requestDevicePromise = @@ -23,7 +23,7 @@ ]); // On the second discovery, the adapter finds the Heart Rate device. - testRunner.sendBluetoothManualChooserEvent('rescan', ''); + sendBluetoothManualChooserEvent('rescan', ''); return getBluetoothManualChooserEvents(3); }).then(events => { assert_equals(events.length, 3, events); @@ -34,7 +34,7 @@ assert_equals(events[2], 'discovery-idle'); // Select it and let the test complete. - testRunner.sendBluetoothManualChooserEvent('selected', + sendBluetoothManualChooserEvent('selected', idsByName.get('Heart Rate Device')); return requestDevicePromise; }).then(device => assert_equals(device.name, 'Heart Rate Device'));
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/restart-scan-includes-previous-device.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/restart-scan-includes-previous-device.html index 9acdc87d..947cc96 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/restart-scan-includes-previous-device.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/restart-scan-includes-previous-device.html
@@ -5,7 +5,7 @@ <script> 'use strict'; promise_test(() => { - testRunner.setBluetoothManualChooser(true); + setBluetoothManualChooser(true); // Open the chooser, looking for a Heart Rate device. let requestDevicePromise = @@ -26,7 +26,7 @@ // After restarting a scan the connected device should be added to the // chooser. - testRunner.sendBluetoothManualChooserEvent('rescan', ''); + sendBluetoothManualChooserEvent('rescan', ''); return getBluetoothManualChooserEvents(3); }).then(events => { let idsByName = new AddDeviceEventSet(); @@ -37,7 +37,7 @@ assert_equals(events[2], 'discovery-idle'); // Select it and let the test complete. - testRunner.sendBluetoothManualChooserEvent( + sendBluetoothManualChooserEvent( 'selected', idsByName.get('Connected Heart Rate Device')); return requestDevicePromise; }).then(device => assert_equals(device.name, 'Connected Heart Rate Device'));
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/discovery-fails-to-start.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/discovery-fails-to-start.html index d809bef..3d3f657 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/discovery-fails-to-start.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/discovery-fails-to-start.html
@@ -5,7 +5,7 @@ <script> 'use strict'; promise_test(() => { - testRunner.setBluetoothManualChooser(true); + setBluetoothManualChooser(true); let requestDevicePromise = setBluetoothFakeAdapter('FailStartDiscoveryAdapter') .then(() => requestDeviceWithKeyDown({ @@ -17,7 +17,7 @@ 'discovering', 'discovery-failed-to-start'], events); - testRunner.sendBluetoothManualChooserEvent('cancelled', ''); + sendBluetoothManualChooserEvent('cancelled', ''); return assert_promise_rejects_with_message( requestDevicePromise, new DOMException('User cancelled the requestDevice() chooser.',
diff --git a/third_party/WebKit/LayoutTests/resources/bluetooth/bluetooth-helpers.js b/third_party/WebKit/LayoutTests/resources/bluetooth/bluetooth-helpers.js index 0f56560..1f0c13d 100644 --- a/third_party/WebKit/LayoutTests/resources/bluetooth/bluetooth-helpers.js +++ b/third_party/WebKit/LayoutTests/resources/bluetooth/bluetooth-helpers.js
@@ -148,9 +148,20 @@ return callWithKeyDown(() => navigator.bluetooth.requestDevice.apply(navigator.bluetooth, args)); } +function assert_testRunner() { + assert_true(window.testRunner instanceof Object, + "window.testRunner is required for this test, it will not work manually."); +} + +function setBluetoothManualChooser(enable) { + assert_testRunner(); + testRunner.setBluetoothManualChooser(enable); +} + // Calls testRunner.getBluetoothManualChooserEvents() until it's returned // |expected_count| events. Or just once if |expected_count| is undefined. function getBluetoothManualChooserEvents(expected_count) { + assert_testRunner(); return new Promise((resolve, reject) => { let events = []; let accumulate_events = new_events => { @@ -165,7 +176,13 @@ }); } +function sendBluetoothManualChooserEvent(event, argument) { + assert_testRunner(); + testRunner.sendBluetoothManualChooserEvent(event, argument); +} + function setBluetoothFakeAdapter(adapter_name) { + assert_testRunner(); return new Promise(resolve => { testRunner.setBluetoothFakeAdapter(adapter_name, resolve); });
diff --git a/third_party/WebKit/Source/core/animation/CSSTextIndentInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSTextIndentInterpolationType.cpp index 5886323..99a74d1 100644 --- a/third_party/WebKit/Source/core/animation/CSSTextIndentInterpolationType.cpp +++ b/third_party/WebKit/Source/core/animation/CSSTextIndentInterpolationType.cpp
@@ -198,11 +198,10 @@ LengthInterpolationFunctions::mergeSingles( InterpolationValue( std::move(start.interpolableValue), - std::move( - startNonInterpolableValue.lengthNonInterpolableValue())), + startNonInterpolableValue.lengthNonInterpolableValue()), InterpolationValue( std::move(end.interpolableValue), - std::move(endNonInterpolableValue.lengthNonInterpolableValue()))); + endNonInterpolableValue.lengthNonInterpolableValue())); result.nonInterpolableValue = CSSTextIndentNonInterpolableValue::create( std::move(result.nonInterpolableValue), startNonInterpolableValue.mode()); return result;
diff --git a/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp b/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp index 7c192ecc..f77eba72 100644 --- a/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp +++ b/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp
@@ -2402,249 +2402,743 @@ contextGL()->Uniform4ui(location->location(), v0, v1, v2, v3); } +void WebGL2RenderingContextBase::uniform1fv( + const WebGLUniformLocation* location, + const FlexibleFloat32ArrayView& v, + GLuint srcOffset, + GLuint srcLength) { + if (isContextLost() || + !validateUniformParameters<WTF::Float32Array>("uniform1fv", location, v, + 1, srcOffset, srcLength)) + return; + + contextGL()->Uniform1fv(location->location(), v.length(), + v.dataMaybeOnStack() + srcOffset); +} + +void WebGL2RenderingContextBase::uniform1fv( + const WebGLUniformLocation* location, + Vector<GLfloat>& v, + GLuint srcOffset, + GLuint srcLength) { + if (isContextLost() || + !validateUniformParameters("uniform1fv", location, v.data(), v.size(), 1, + srcOffset, srcLength)) + return; + + contextGL()->Uniform1fv(location->location(), v.size(), v.data() + srcOffset); +} + +void WebGL2RenderingContextBase::uniform2fv( + const WebGLUniformLocation* location, + const FlexibleFloat32ArrayView& v, + GLuint srcOffset, + GLuint srcLength) { + if (isContextLost() || + !validateUniformParameters<WTF::Float32Array>("uniform2fv", location, v, + 2, srcOffset, srcLength)) + return; + + contextGL()->Uniform2fv(location->location(), v.length() >> 1, + v.dataMaybeOnStack() + srcOffset); +} + +void WebGL2RenderingContextBase::uniform2fv( + const WebGLUniformLocation* location, + Vector<GLfloat>& v, + GLuint srcOffset, + GLuint srcLength) { + if (isContextLost() || + !validateUniformParameters("uniform2fv", location, v.data(), v.size(), 2, + srcOffset, srcLength)) + return; + + contextGL()->Uniform2fv(location->location(), v.size() >> 1, + v.data() + srcOffset); +} + +void WebGL2RenderingContextBase::uniform3fv( + const WebGLUniformLocation* location, + const FlexibleFloat32ArrayView& v, + GLuint srcOffset, + GLuint srcLength) { + if (isContextLost() || + !validateUniformParameters<WTF::Float32Array>("uniform3fv", location, v, + 3, srcOffset, srcLength)) + return; + + contextGL()->Uniform3fv(location->location(), v.length() / 3, + v.dataMaybeOnStack() + srcOffset); +} + +void WebGL2RenderingContextBase::uniform3fv( + const WebGLUniformLocation* location, + Vector<GLfloat>& v, + GLuint srcOffset, + GLuint srcLength) { + if (isContextLost() || + !validateUniformParameters("uniform3fv", location, v.data(), v.size(), 3, + srcOffset, srcLength)) + return; + + contextGL()->Uniform3fv(location->location(), v.size() / 3, + v.data() + srcOffset); +} + +void WebGL2RenderingContextBase::uniform4fv( + const WebGLUniformLocation* location, + const FlexibleFloat32ArrayView& v, + GLuint srcOffset, + GLuint srcLength) { + if (isContextLost() || + !validateUniformParameters<WTF::Float32Array>("uniform4fv", location, v, + 4, srcOffset, srcLength)) + return; + + contextGL()->Uniform4fv(location->location(), v.length() >> 2, + v.dataMaybeOnStack() + srcOffset); +} + +void WebGL2RenderingContextBase::uniform4fv( + const WebGLUniformLocation* location, + Vector<GLfloat>& v, + GLuint srcOffset, + GLuint srcLength) { + if (isContextLost() || + !validateUniformParameters("uniform4fv", location, v.data(), v.size(), 4, + srcOffset, srcLength)) + return; + + contextGL()->Uniform4fv(location->location(), v.size() >> 2, + v.data() + srcOffset); +} + +void WebGL2RenderingContextBase::uniform1iv( + const WebGLUniformLocation* location, + const FlexibleInt32ArrayView& v, + GLuint srcOffset, + GLuint srcLength) { + if (isContextLost() || + !validateUniformParameters<WTF::Int32Array>("uniform1iv", location, v, 1, + srcOffset, srcLength)) + return; + + contextGL()->Uniform1iv(location->location(), v.length(), + v.dataMaybeOnStack() + srcOffset); +} + +void WebGL2RenderingContextBase::uniform1iv( + const WebGLUniformLocation* location, + Vector<GLint>& v, + GLuint srcOffset, + GLuint srcLength) { + if (isContextLost() || + !validateUniformParameters("uniform1iv", location, v.data(), v.size(), 1, + srcOffset, srcLength)) + return; + + contextGL()->Uniform1iv(location->location(), v.size(), v.data() + srcOffset); +} + +void WebGL2RenderingContextBase::uniform2iv( + const WebGLUniformLocation* location, + const FlexibleInt32ArrayView& v, + GLuint srcOffset, + GLuint srcLength) { + if (isContextLost() || + !validateUniformParameters<WTF::Int32Array>("uniform2iv", location, v, 2, + srcOffset, srcLength)) + return; + + contextGL()->Uniform2iv(location->location(), v.length() >> 1, + v.dataMaybeOnStack() + srcOffset); +} + +void WebGL2RenderingContextBase::uniform2iv( + const WebGLUniformLocation* location, + Vector<GLint>& v, + GLuint srcOffset, + GLuint srcLength) { + if (isContextLost() || + !validateUniformParameters("uniform2iv", location, v.data(), v.size(), 2, + srcOffset, srcLength)) + return; + + contextGL()->Uniform2iv(location->location(), v.size() >> 1, + v.data() + srcOffset); +} + +void WebGL2RenderingContextBase::uniform3iv( + const WebGLUniformLocation* location, + const FlexibleInt32ArrayView& v, + GLuint srcOffset, + GLuint srcLength) { + if (isContextLost() || + !validateUniformParameters<WTF::Int32Array>("uniform3iv", location, v, 3, + srcOffset, srcLength)) + return; + + contextGL()->Uniform3iv(location->location(), v.length() / 3, + v.dataMaybeOnStack() + srcOffset); +} + +void WebGL2RenderingContextBase::uniform3iv( + const WebGLUniformLocation* location, + Vector<GLint>& v, + GLuint srcOffset, + GLuint srcLength) { + if (isContextLost() || + !validateUniformParameters("uniform3iv", location, v.data(), v.size(), 3, + srcOffset, srcLength)) + return; + + contextGL()->Uniform3iv(location->location(), v.size() / 3, + v.data() + srcOffset); +} + +void WebGL2RenderingContextBase::uniform4iv( + const WebGLUniformLocation* location, + const FlexibleInt32ArrayView& v, + GLuint srcOffset, + GLuint srcLength) { + if (isContextLost() || + !validateUniformParameters<WTF::Int32Array>("uniform4iv", location, v, 4, + srcOffset, srcLength)) + return; + + contextGL()->Uniform4iv(location->location(), v.length() >> 2, + v.dataMaybeOnStack() + srcOffset); +} + +void WebGL2RenderingContextBase::uniform4iv( + const WebGLUniformLocation* location, + Vector<GLint>& v, + GLuint srcOffset, + GLuint srcLength) { + if (isContextLost() || + !validateUniformParameters("uniform4iv", location, v.data(), v.size(), 4, + srcOffset, srcLength)) + return; + + contextGL()->Uniform4iv(location->location(), v.size() >> 2, + v.data() + srcOffset); +} + void WebGL2RenderingContextBase::uniform1uiv( const WebGLUniformLocation* location, - const FlexibleUint32ArrayView& v) { + const FlexibleUint32ArrayView& v, + GLuint srcOffset, + GLuint srcLength) { if (isContextLost() || !validateUniformParameters<WTF::Uint32Array>("uniform1uiv", location, v, - 1)) + 1, srcOffset, srcLength)) return; contextGL()->Uniform1uiv(location->location(), v.length(), - v.dataMaybeOnStack()); + v.dataMaybeOnStack() + srcOffset); } void WebGL2RenderingContextBase::uniform1uiv( const WebGLUniformLocation* location, - Vector<GLuint>& value) { + Vector<GLuint>& value, + GLuint srcOffset, + GLuint srcLength) { if (isContextLost() || !validateUniformParameters("uniform1uiv", location, value.data(), - value.size(), 1)) + value.size(), 1, srcOffset, srcLength)) return; - contextGL()->Uniform1uiv(location->location(), value.size(), value.data()); + contextGL()->Uniform1uiv(location->location(), value.size(), + value.data() + srcOffset); } void WebGL2RenderingContextBase::uniform2uiv( const WebGLUniformLocation* location, - const FlexibleUint32ArrayView& v) { + const FlexibleUint32ArrayView& v, + GLuint srcOffset, + GLuint srcLength) { if (isContextLost() || !validateUniformParameters<WTF::Uint32Array>("uniform2uiv", location, v, - 2)) + 2, srcOffset, srcLength)) return; contextGL()->Uniform2uiv(location->location(), v.length() >> 1, - v.dataMaybeOnStack()); + v.dataMaybeOnStack() + srcOffset); } void WebGL2RenderingContextBase::uniform2uiv( const WebGLUniformLocation* location, - Vector<GLuint>& value) { + Vector<GLuint>& value, + GLuint srcOffset, + GLuint srcLength) { if (isContextLost() || !validateUniformParameters("uniform2uiv", location, value.data(), - value.size(), 2)) + value.size(), 2, srcOffset, srcLength)) return; contextGL()->Uniform2uiv(location->location(), value.size() / 2, - value.data()); + value.data() + srcOffset); } void WebGL2RenderingContextBase::uniform3uiv( const WebGLUniformLocation* location, - const FlexibleUint32ArrayView& v) { + const FlexibleUint32ArrayView& v, + GLuint srcOffset, + GLuint srcLength) { if (isContextLost() || !validateUniformParameters<WTF::Uint32Array>("uniform3uiv", location, v, - 3)) + 3, srcOffset, srcLength)) return; contextGL()->Uniform3uiv(location->location(), v.length() / 3, - v.dataMaybeOnStack()); + v.dataMaybeOnStack() + srcOffset); } void WebGL2RenderingContextBase::uniform3uiv( const WebGLUniformLocation* location, - Vector<GLuint>& value) { + Vector<GLuint>& value, + GLuint srcOffset, + GLuint srcLength) { if (isContextLost() || !validateUniformParameters("uniform3uiv", location, value.data(), - value.size(), 3)) + value.size(), 3, srcOffset, srcLength)) return; contextGL()->Uniform3uiv(location->location(), value.size() / 3, - value.data()); + value.data() + srcOffset); } void WebGL2RenderingContextBase::uniform4uiv( const WebGLUniformLocation* location, - const FlexibleUint32ArrayView& v) { + const FlexibleUint32ArrayView& v, + GLuint srcOffset, + GLuint srcLength) { if (isContextLost() || !validateUniformParameters<WTF::Uint32Array>("uniform4uiv", location, v, - 4)) + 4, srcOffset, srcLength)) return; contextGL()->Uniform4uiv(location->location(), v.length() >> 2, - v.dataMaybeOnStack()); + v.dataMaybeOnStack() + srcOffset); } void WebGL2RenderingContextBase::uniform4uiv( const WebGLUniformLocation* location, - Vector<GLuint>& value) { + Vector<GLuint>& value, + GLuint srcOffset, + GLuint srcLength) { if (isContextLost() || !validateUniformParameters("uniform4uiv", location, value.data(), - value.size(), 4)) + value.size(), 4, srcOffset, srcLength)) return; contextGL()->Uniform4uiv(location->location(), value.size() / 4, - value.data()); + value.data() + srcOffset); +} + +void WebGL2RenderingContextBase::uniformMatrix2fv( + const WebGLUniformLocation* location, + GLboolean transpose, + DOMFloat32Array* v, + GLuint srcOffset, + GLuint srcLength) { + if (isContextLost() || + !validateUniformMatrixParameters("uniformMatrix2fv", location, transpose, + v, 4, srcOffset, srcLength)) + return; + contextGL()->UniformMatrix2fv(location->location(), v->length() >> 2, + transpose, v->data() + srcOffset); +} + +void WebGL2RenderingContextBase::uniformMatrix2fv( + const WebGLUniformLocation* location, + GLboolean transpose, + Vector<GLfloat>& v, + GLuint srcOffset, + GLuint srcLength) { + if (isContextLost() || + !validateUniformMatrixParameters("uniformMatrix2fv", location, transpose, + v.data(), v.size(), 4, srcOffset, + srcLength)) + return; + contextGL()->UniformMatrix2fv(location->location(), v.size() >> 2, transpose, + v.data() + srcOffset); +} + +void WebGL2RenderingContextBase::uniformMatrix3fv( + const WebGLUniformLocation* location, + GLboolean transpose, + DOMFloat32Array* v, + GLuint srcOffset, + GLuint srcLength) { + if (isContextLost() || + !validateUniformMatrixParameters("uniformMatrix3fv", location, transpose, + v, 9, srcOffset, srcLength)) + return; + contextGL()->UniformMatrix3fv(location->location(), v->length() / 9, + transpose, v->data() + srcOffset); +} + +void WebGL2RenderingContextBase::uniformMatrix3fv( + const WebGLUniformLocation* location, + GLboolean transpose, + Vector<GLfloat>& v, + GLuint srcOffset, + GLuint srcLength) { + if (isContextLost() || + !validateUniformMatrixParameters("uniformMatrix3fv", location, transpose, + v.data(), v.size(), 9, srcOffset, + srcLength)) + return; + contextGL()->UniformMatrix3fv(location->location(), v.size() / 9, transpose, + v.data() + srcOffset); +} + +void WebGL2RenderingContextBase::uniformMatrix4fv( + const WebGLUniformLocation* location, + GLboolean transpose, + DOMFloat32Array* v, + GLuint srcOffset, + GLuint srcLength) { + if (isContextLost() || + !validateUniformMatrixParameters("uniformMatrix4fv", location, transpose, + v, 16, srcOffset, srcLength)) + return; + contextGL()->UniformMatrix4fv(location->location(), v->length() >> 4, + transpose, v->data() + srcOffset); +} + +void WebGL2RenderingContextBase::uniformMatrix4fv( + const WebGLUniformLocation* location, + GLboolean transpose, + Vector<GLfloat>& v, + GLuint srcOffset, + GLuint srcLength) { + if (isContextLost() || + !validateUniformMatrixParameters("uniformMatrix4fv", location, transpose, + v.data(), v.size(), 16, srcOffset, + srcLength)) + return; + contextGL()->UniformMatrix4fv(location->location(), v.size() >> 4, transpose, + v.data() + srcOffset); } void WebGL2RenderingContextBase::uniformMatrix2x3fv( const WebGLUniformLocation* location, GLboolean transpose, - DOMFloat32Array* value) { + DOMFloat32Array* value, + GLuint srcOffset, + GLuint srcLength) { if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix2x3fv", location, - transpose, value, 6)) + transpose, value, 6, srcOffset, + srcLength)) return; contextGL()->UniformMatrix2x3fv(location->location(), value->length() / 6, - transpose, value->data()); + transpose, value->data() + srcOffset); } void WebGL2RenderingContextBase::uniformMatrix2x3fv( const WebGLUniformLocation* location, GLboolean transpose, - Vector<GLfloat>& value) { + Vector<GLfloat>& value, + GLuint srcOffset, + GLuint srcLength) { if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix2x3fv", location, - transpose, value.data(), value.size(), - 6)) + transpose, value.data(), value.size(), 6, + srcOffset, srcLength)) return; contextGL()->UniformMatrix2x3fv(location->location(), value.size() / 6, - transpose, value.data()); + transpose, value.data() + srcOffset); } void WebGL2RenderingContextBase::uniformMatrix3x2fv( const WebGLUniformLocation* location, GLboolean transpose, - DOMFloat32Array* value) { + DOMFloat32Array* value, + GLuint srcOffset, + GLuint srcLength) { if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix3x2fv", location, - transpose, value, 6)) + transpose, value, 6, srcOffset, + srcLength)) return; contextGL()->UniformMatrix3x2fv(location->location(), value->length() / 6, - transpose, value->data()); + transpose, value->data() + srcOffset); } void WebGL2RenderingContextBase::uniformMatrix3x2fv( const WebGLUniformLocation* location, GLboolean transpose, - Vector<GLfloat>& value) { + Vector<GLfloat>& value, + GLuint srcOffset, + GLuint srcLength) { if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix3x2fv", location, - transpose, value.data(), value.size(), - 6)) + transpose, value.data(), value.size(), 6, + srcOffset, srcLength)) return; contextGL()->UniformMatrix3x2fv(location->location(), value.size() / 6, - transpose, value.data()); + transpose, value.data() + srcOffset); } void WebGL2RenderingContextBase::uniformMatrix2x4fv( const WebGLUniformLocation* location, GLboolean transpose, - DOMFloat32Array* value) { + DOMFloat32Array* value, + GLuint srcOffset, + GLuint srcLength) { if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix2x4fv", location, - transpose, value, 8)) + transpose, value, 8, srcOffset, + srcLength)) return; contextGL()->UniformMatrix2x4fv(location->location(), value->length() / 8, - transpose, value->data()); + transpose, value->data() + srcOffset); } void WebGL2RenderingContextBase::uniformMatrix2x4fv( const WebGLUniformLocation* location, GLboolean transpose, - Vector<GLfloat>& value) { + Vector<GLfloat>& value, + GLuint srcOffset, + GLuint srcLength) { if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix2x4fv", location, - transpose, value.data(), value.size(), - 8)) + transpose, value.data(), value.size(), 8, + srcOffset, srcLength)) return; contextGL()->UniformMatrix2x4fv(location->location(), value.size() / 8, - transpose, value.data()); + transpose, value.data() + srcOffset); } void WebGL2RenderingContextBase::uniformMatrix4x2fv( const WebGLUniformLocation* location, GLboolean transpose, - DOMFloat32Array* value) { + DOMFloat32Array* value, + GLuint srcOffset, + GLuint srcLength) { if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix4x2fv", location, - transpose, value, 8)) + transpose, value, 8, srcOffset, + srcLength)) return; contextGL()->UniformMatrix4x2fv(location->location(), value->length() / 8, - transpose, value->data()); + transpose, value->data() + srcOffset); } void WebGL2RenderingContextBase::uniformMatrix4x2fv( const WebGLUniformLocation* location, GLboolean transpose, - Vector<GLfloat>& value) { + Vector<GLfloat>& value, + GLuint srcOffset, + GLuint srcLength) { if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix4x2fv", location, - transpose, value.data(), value.size(), - 8)) + transpose, value.data(), value.size(), 8, + srcOffset, srcLength)) return; contextGL()->UniformMatrix4x2fv(location->location(), value.size() / 8, - transpose, value.data()); + transpose, value.data() + srcOffset); } void WebGL2RenderingContextBase::uniformMatrix3x4fv( const WebGLUniformLocation* location, GLboolean transpose, - DOMFloat32Array* value) { + DOMFloat32Array* value, + GLuint srcOffset, + GLuint srcLength) { if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix3x4fv", location, - transpose, value, 12)) + transpose, value, 12, srcOffset, + srcLength)) return; contextGL()->UniformMatrix3x4fv(location->location(), value->length() / 12, - transpose, value->data()); + transpose, value->data() + srcOffset); } void WebGL2RenderingContextBase::uniformMatrix3x4fv( const WebGLUniformLocation* location, GLboolean transpose, - Vector<GLfloat>& value) { + Vector<GLfloat>& value, + GLuint srcOffset, + GLuint srcLength) { if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix3x4fv", location, transpose, value.data(), value.size(), - 12)) + 12, srcOffset, srcLength)) return; contextGL()->UniformMatrix3x4fv(location->location(), value.size() / 12, - transpose, value.data()); + transpose, value.data() + srcOffset); } void WebGL2RenderingContextBase::uniformMatrix4x3fv( const WebGLUniformLocation* location, GLboolean transpose, - DOMFloat32Array* value) { + DOMFloat32Array* value, + GLuint srcOffset, + GLuint srcLength) { if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix4x3fv", location, - transpose, value, 12)) + transpose, value, 12, srcOffset, + srcLength)) return; contextGL()->UniformMatrix4x3fv(location->location(), value->length() / 12, - transpose, value->data()); + transpose, value->data() + srcOffset); } void WebGL2RenderingContextBase::uniformMatrix4x3fv( const WebGLUniformLocation* location, GLboolean transpose, - Vector<GLfloat>& value) { + Vector<GLfloat>& value, + GLuint srcOffset, + GLuint srcLength) { if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix4x3fv", location, transpose, value.data(), value.size(), - 12)) + 12, srcOffset, srcLength)) return; contextGL()->UniformMatrix4x3fv(location->location(), value.size() / 12, - transpose, value.data()); + transpose, value.data() + srcOffset); +} + +void WebGL2RenderingContextBase::uniform1fv( + const WebGLUniformLocation* location, + const FlexibleFloat32ArrayView& v) { + WebGLRenderingContextBase::uniform1fv(location, v); +} + +void WebGL2RenderingContextBase::uniform1fv( + const WebGLUniformLocation* location, + Vector<GLfloat>& v) { + WebGLRenderingContextBase::uniform1fv(location, v); +} + +void WebGL2RenderingContextBase::uniform2fv( + const WebGLUniformLocation* location, + const FlexibleFloat32ArrayView& v) { + WebGLRenderingContextBase::uniform2fv(location, v); +} + +void WebGL2RenderingContextBase::uniform2fv( + const WebGLUniformLocation* location, + Vector<GLfloat>& v) { + WebGLRenderingContextBase::uniform2fv(location, v); +} + +void WebGL2RenderingContextBase::uniform3fv( + const WebGLUniformLocation* location, + const FlexibleFloat32ArrayView& v) { + WebGLRenderingContextBase::uniform3fv(location, v); +} + +void WebGL2RenderingContextBase::uniform3fv( + const WebGLUniformLocation* location, + Vector<GLfloat>& v) { + WebGLRenderingContextBase::uniform3fv(location, v); +} + +void WebGL2RenderingContextBase::uniform4fv( + const WebGLUniformLocation* location, + const FlexibleFloat32ArrayView& v) { + WebGLRenderingContextBase::uniform4fv(location, v); +} + +void WebGL2RenderingContextBase::uniform4fv( + const WebGLUniformLocation* location, + Vector<GLfloat>& v) { + WebGLRenderingContextBase::uniform4fv(location, v); +} + +void WebGL2RenderingContextBase::uniform1iv( + const WebGLUniformLocation* location, + const FlexibleInt32ArrayView& v) { + WebGLRenderingContextBase::uniform1iv(location, v); +} + +void WebGL2RenderingContextBase::uniform1iv( + const WebGLUniformLocation* location, + Vector<GLint>& v) { + WebGLRenderingContextBase::uniform1iv(location, v); +} + +void WebGL2RenderingContextBase::uniform2iv( + const WebGLUniformLocation* location, + const FlexibleInt32ArrayView& v) { + WebGLRenderingContextBase::uniform2iv(location, v); +} + +void WebGL2RenderingContextBase::uniform2iv( + const WebGLUniformLocation* location, + Vector<GLint>& v) { + WebGLRenderingContextBase::uniform2iv(location, v); +} + +void WebGL2RenderingContextBase::uniform3iv( + const WebGLUniformLocation* location, + const FlexibleInt32ArrayView& v) { + WebGLRenderingContextBase::uniform3iv(location, v); +} + +void WebGL2RenderingContextBase::uniform3iv( + const WebGLUniformLocation* location, + Vector<GLint>& v) { + WebGLRenderingContextBase::uniform3iv(location, v); +} + +void WebGL2RenderingContextBase::uniform4iv( + const WebGLUniformLocation* location, + const FlexibleInt32ArrayView& v) { + WebGLRenderingContextBase::uniform4iv(location, v); +} + +void WebGL2RenderingContextBase::uniform4iv( + const WebGLUniformLocation* location, + Vector<GLint>& v) { + WebGLRenderingContextBase::uniform4iv(location, v); +} + +void WebGL2RenderingContextBase::uniformMatrix2fv( + const WebGLUniformLocation* location, + GLboolean transpose, + DOMFloat32Array* v) { + WebGLRenderingContextBase::uniformMatrix2fv(location, transpose, v); +} + +void WebGL2RenderingContextBase::uniformMatrix2fv( + const WebGLUniformLocation* location, + GLboolean transpose, + Vector<GLfloat>& v) { + WebGLRenderingContextBase::uniformMatrix2fv(location, transpose, v); +} + +void WebGL2RenderingContextBase::uniformMatrix3fv( + const WebGLUniformLocation* location, + GLboolean transpose, + DOMFloat32Array* v) { + WebGLRenderingContextBase::uniformMatrix3fv(location, transpose, v); +} + +void WebGL2RenderingContextBase::uniformMatrix3fv( + const WebGLUniformLocation* location, + GLboolean transpose, + Vector<GLfloat>& v) { + WebGLRenderingContextBase::uniformMatrix3fv(location, transpose, v); +} + +void WebGL2RenderingContextBase::uniformMatrix4fv( + const WebGLUniformLocation* location, + GLboolean transpose, + DOMFloat32Array* v) { + WebGLRenderingContextBase::uniformMatrix4fv(location, transpose, v); +} + +void WebGL2RenderingContextBase::uniformMatrix4fv( + const WebGLUniformLocation* location, + GLboolean transpose, + Vector<GLfloat>& v) { + WebGLRenderingContextBase::uniformMatrix4fv(location, transpose, v); } void WebGL2RenderingContextBase::vertexAttribI4i(GLuint index,
diff --git a/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.h b/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.h index e97a8541..1578fbd 100644 --- a/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.h +++ b/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.h
@@ -592,50 +592,217 @@ void uniform2ui(const WebGLUniformLocation*, GLuint, GLuint); void uniform3ui(const WebGLUniformLocation*, GLuint, GLuint, GLuint); void uniform4ui(const WebGLUniformLocation*, GLuint, GLuint, GLuint, GLuint); - void uniform1uiv(const WebGLUniformLocation*, const FlexibleUint32ArrayView&); - void uniform1uiv(const WebGLUniformLocation*, Vector<GLuint>&); - void uniform2uiv(const WebGLUniformLocation*, const FlexibleUint32ArrayView&); - void uniform2uiv(const WebGLUniformLocation*, Vector<GLuint>&); - void uniform3uiv(const WebGLUniformLocation*, const FlexibleUint32ArrayView&); - void uniform3uiv(const WebGLUniformLocation*, Vector<GLuint>&); - void uniform4uiv(const WebGLUniformLocation*, const FlexibleUint32ArrayView&); - void uniform4uiv(const WebGLUniformLocation*, Vector<GLuint>&); + void uniform1fv(const WebGLUniformLocation*, + const FlexibleFloat32ArrayView&, + GLuint, + GLuint); + void uniform1fv(const WebGLUniformLocation*, + Vector<GLfloat>&, + GLuint, + GLuint); + void uniform2fv(const WebGLUniformLocation*, + const FlexibleFloat32ArrayView&, + GLuint, + GLuint); + void uniform2fv(const WebGLUniformLocation*, + Vector<GLfloat>&, + GLuint, + GLuint); + void uniform3fv(const WebGLUniformLocation*, + const FlexibleFloat32ArrayView&, + GLuint, + GLuint); + void uniform3fv(const WebGLUniformLocation*, + Vector<GLfloat>&, + GLuint, + GLuint); + void uniform4fv(const WebGLUniformLocation*, + const FlexibleFloat32ArrayView&, + GLuint, + GLuint); + void uniform4fv(const WebGLUniformLocation*, + Vector<GLfloat>&, + GLuint, + GLuint); + void uniform1iv(const WebGLUniformLocation*, + const FlexibleInt32ArrayView&, + GLuint, + GLuint); + void uniform1iv(const WebGLUniformLocation*, Vector<GLint>&, GLuint, GLuint); + void uniform2iv(const WebGLUniformLocation*, + const FlexibleInt32ArrayView&, + GLuint, + GLuint); + void uniform2iv(const WebGLUniformLocation*, Vector<GLint>&, GLuint, GLuint); + void uniform3iv(const WebGLUniformLocation*, + const FlexibleInt32ArrayView&, + GLuint, + GLuint); + void uniform3iv(const WebGLUniformLocation*, Vector<GLint>&, GLuint, GLuint); + void uniform4iv(const WebGLUniformLocation*, + const FlexibleInt32ArrayView&, + GLuint, + GLuint); + void uniform4iv(const WebGLUniformLocation*, Vector<GLint>&, GLuint, GLuint); + void uniform1uiv(const WebGLUniformLocation*, + const FlexibleUint32ArrayView&, + GLuint, + GLuint); + void uniform1uiv(const WebGLUniformLocation*, + Vector<GLuint>&, + GLuint, + GLuint); + void uniform2uiv(const WebGLUniformLocation*, + const FlexibleUint32ArrayView&, + GLuint, + GLuint); + void uniform2uiv(const WebGLUniformLocation*, + Vector<GLuint>&, + GLuint, + GLuint); + void uniform3uiv(const WebGLUniformLocation*, + const FlexibleUint32ArrayView&, + GLuint, + GLuint); + void uniform3uiv(const WebGLUniformLocation*, + Vector<GLuint>&, + GLuint, + GLuint); + void uniform4uiv(const WebGLUniformLocation*, + const FlexibleUint32ArrayView&, + GLuint, + GLuint); + void uniform4uiv(const WebGLUniformLocation*, + Vector<GLuint>&, + GLuint, + GLuint); + void uniformMatrix2fv(const WebGLUniformLocation*, + GLboolean, + DOMFloat32Array*, + GLuint, + GLuint); + void uniformMatrix2fv(const WebGLUniformLocation*, + GLboolean, + Vector<GLfloat>&, + GLuint, + GLuint); + void uniformMatrix3fv(const WebGLUniformLocation*, + GLboolean, + DOMFloat32Array*, + GLuint, + GLuint); + void uniformMatrix3fv(const WebGLUniformLocation*, + GLboolean, + Vector<GLfloat>&, + GLuint, + GLuint); + void uniformMatrix4fv(const WebGLUniformLocation*, + GLboolean, + DOMFloat32Array*, + GLuint, + GLuint); + void uniformMatrix4fv(const WebGLUniformLocation*, + GLboolean, + Vector<GLfloat>&, + GLuint, + GLuint); void uniformMatrix2x3fv(const WebGLUniformLocation*, GLboolean, - DOMFloat32Array*); + DOMFloat32Array*, + GLuint, + GLuint); void uniformMatrix2x3fv(const WebGLUniformLocation*, GLboolean, - Vector<GLfloat>&); + Vector<GLfloat>&, + GLuint, + GLuint); void uniformMatrix3x2fv(const WebGLUniformLocation*, GLboolean, - DOMFloat32Array*); + DOMFloat32Array*, + GLuint, + GLuint); void uniformMatrix3x2fv(const WebGLUniformLocation*, GLboolean, - Vector<GLfloat>&); + Vector<GLfloat>&, + GLuint, + GLuint); void uniformMatrix2x4fv(const WebGLUniformLocation*, GLboolean, - DOMFloat32Array*); + DOMFloat32Array*, + GLuint, + GLuint); void uniformMatrix2x4fv(const WebGLUniformLocation*, GLboolean, - Vector<GLfloat>&); + Vector<GLfloat>&, + GLuint, + GLuint); void uniformMatrix4x2fv(const WebGLUniformLocation*, GLboolean, - DOMFloat32Array*); + DOMFloat32Array*, + GLuint, + GLuint); void uniformMatrix4x2fv(const WebGLUniformLocation*, GLboolean, - Vector<GLfloat>&); + Vector<GLfloat>&, + GLuint, + GLuint); void uniformMatrix3x4fv(const WebGLUniformLocation*, GLboolean, - DOMFloat32Array*); + DOMFloat32Array*, + GLuint, + GLuint); void uniformMatrix3x4fv(const WebGLUniformLocation*, GLboolean, - Vector<GLfloat>&); + Vector<GLfloat>&, + GLuint, + GLuint); void uniformMatrix4x3fv(const WebGLUniformLocation*, GLboolean, - DOMFloat32Array*); + DOMFloat32Array*, + GLuint, + GLuint); void uniformMatrix4x3fv(const WebGLUniformLocation*, GLboolean, - Vector<GLfloat>&); + Vector<GLfloat>&, + GLuint, + GLuint); + // Have to re-declare/re-define the following uniform*() + // functions from the base class. This is because the above + // uniform*() hide the name from base class. + void uniform1fv(const WebGLUniformLocation*, const FlexibleFloat32ArrayView&); + void uniform1fv(const WebGLUniformLocation*, Vector<GLfloat>&); + void uniform2fv(const WebGLUniformLocation*, const FlexibleFloat32ArrayView&); + void uniform2fv(const WebGLUniformLocation*, Vector<GLfloat>&); + void uniform3fv(const WebGLUniformLocation*, const FlexibleFloat32ArrayView&); + void uniform3fv(const WebGLUniformLocation*, Vector<GLfloat>&); + void uniform4fv(const WebGLUniformLocation*, const FlexibleFloat32ArrayView&); + void uniform4fv(const WebGLUniformLocation*, Vector<GLfloat>&); + void uniform1iv(const WebGLUniformLocation*, const FlexibleInt32ArrayView&); + void uniform1iv(const WebGLUniformLocation*, Vector<GLint>&); + void uniform2iv(const WebGLUniformLocation*, const FlexibleInt32ArrayView&); + void uniform2iv(const WebGLUniformLocation*, Vector<GLint>&); + void uniform3iv(const WebGLUniformLocation*, const FlexibleInt32ArrayView&); + void uniform3iv(const WebGLUniformLocation*, Vector<GLint>&); + void uniform4iv(const WebGLUniformLocation*, const FlexibleInt32ArrayView&); + void uniform4iv(const WebGLUniformLocation*, Vector<GLint>&); + void uniformMatrix2fv(const WebGLUniformLocation*, + GLboolean transpose, + DOMFloat32Array* value); + void uniformMatrix2fv(const WebGLUniformLocation*, + GLboolean transpose, + Vector<GLfloat>& value); + void uniformMatrix3fv(const WebGLUniformLocation*, + GLboolean transpose, + DOMFloat32Array* value); + void uniformMatrix3fv(const WebGLUniformLocation*, + GLboolean transpose, + Vector<GLfloat>& value); + void uniformMatrix4fv(const WebGLUniformLocation*, + GLboolean transpose, + DOMFloat32Array* value); + void uniformMatrix4fv(const WebGLUniformLocation*, + GLboolean transpose, + Vector<GLfloat>& value); void vertexAttribI4i(GLuint, GLint, GLint, GLint, GLint); void vertexAttribI4iv(GLuint, const DOMInt32Array*);
diff --git a/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.idl b/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.idl index adfb7fe..ff1b2ce 100644 --- a/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.idl +++ b/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.idl
@@ -358,26 +358,94 @@ void uniform2ui(WebGLUniformLocation? location, GLuint v0, GLuint v1); void uniform3ui(WebGLUniformLocation? location, GLuint v0, GLuint v1, GLuint v2); void uniform4ui(WebGLUniformLocation? location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); - void uniform1uiv(WebGLUniformLocation? location, [FlexibleArrayBufferView] Uint32Array v); - void uniform1uiv(WebGLUniformLocation? location, sequence<GLuint> v); - void uniform2uiv(WebGLUniformLocation? location, [FlexibleArrayBufferView] Uint32Array v); - void uniform2uiv(WebGLUniformLocation? location, sequence<GLuint> v); - void uniform3uiv(WebGLUniformLocation? location, [FlexibleArrayBufferView] Uint32Array v); - void uniform3uiv(WebGLUniformLocation? location, sequence<GLuint> v); - void uniform4uiv(WebGLUniformLocation? location, [FlexibleArrayBufferView] Uint32Array v); - void uniform4uiv(WebGLUniformLocation? location, sequence<GLuint> v); - void uniformMatrix2x3fv(WebGLUniformLocation? location, GLboolean transpose, Float32Array value); - void uniformMatrix2x3fv(WebGLUniformLocation? location, GLboolean transpose, sequence<GLfloat> value); - void uniformMatrix3x2fv(WebGLUniformLocation? location, GLboolean transpose, Float32Array value); - void uniformMatrix3x2fv(WebGLUniformLocation? location, GLboolean transpose, sequence<GLfloat> value); - void uniformMatrix2x4fv(WebGLUniformLocation? location, GLboolean transpose, Float32Array value); - void uniformMatrix2x4fv(WebGLUniformLocation? location, GLboolean transpose, sequence<GLfloat> value); - void uniformMatrix4x2fv(WebGLUniformLocation? location, GLboolean transpose, Float32Array value); - void uniformMatrix4x2fv(WebGLUniformLocation? location, GLboolean transpose, sequence<GLfloat> value); - void uniformMatrix3x4fv(WebGLUniformLocation? location, GLboolean transpose, Float32Array value); - void uniformMatrix3x4fv(WebGLUniformLocation? location, GLboolean transpose, sequence<GLfloat> value); - void uniformMatrix4x3fv(WebGLUniformLocation? location, GLboolean transpose, Float32Array value); - void uniformMatrix4x3fv(WebGLUniformLocation? location, GLboolean transpose, sequence<GLfloat> value); + // The WebGL1 uniform*v signatures are visible here, so srcOffset has to be non-optional + // to avoid conflicts. The effect is the same: if uniform*v is called with only two arguments, + // it goes to the WebGL1 signatures; if it's called with three or four arguments, it goes to + // the WebGL2 specific signatures. + void uniform1fv(WebGLUniformLocation? location, [FlexibleArrayBufferView] Float32Array v, + GLuint srcOffset, optional GLuint srcLength = 0); + void uniform1fv(WebGLUniformLocation? location, sequence<GLfloat> v, + GLuint srcOffset, optional GLuint srcLength = 0); + void uniform2fv(WebGLUniformLocation? location, [FlexibleArrayBufferView] Float32Array v, + GLuint srcOffset, optional GLuint srcLength = 0); + void uniform2fv(WebGLUniformLocation? location, sequence<GLfloat> v, + GLuint srcOffset, optional GLuint srcLength = 0); + void uniform3fv(WebGLUniformLocation? location, [FlexibleArrayBufferView] Float32Array v, + GLuint srcOffset, optional GLuint srcLength = 0); + void uniform3fv(WebGLUniformLocation? location, sequence<GLfloat> v, + GLuint srcOffset, optional GLuint srcLength = 0); + void uniform4fv(WebGLUniformLocation? location, [FlexibleArrayBufferView] Float32Array v, + GLuint srcOffset, optional GLuint srcLength = 0); + void uniform4fv(WebGLUniformLocation? location, sequence<GLfloat> v, + GLuint srcOffset, optional GLuint srcLength = 0); + void uniform1iv(WebGLUniformLocation? location, [FlexibleArrayBufferView] Int32Array v, + GLuint srcOffset, optional GLuint srcLength = 0); + void uniform1iv(WebGLUniformLocation? location, sequence<GLint> v, + GLuint srcOffset, optional GLuint srcLength = 0); + void uniform2iv(WebGLUniformLocation? location, [FlexibleArrayBufferView] Int32Array v, + GLuint srcOffset, optional GLuint srcLength = 0); + void uniform2iv(WebGLUniformLocation? location, sequence<GLint> v, + GLuint srcOffset, optional GLuint srcLength = 0); + void uniform3iv(WebGLUniformLocation? location, [FlexibleArrayBufferView] Int32Array v, + GLuint srcOffset, optional GLuint srcLength = 0); + void uniform3iv(WebGLUniformLocation? location, sequence<GLint> v, + GLuint srcOffset, optional GLuint srcLength = 0); + void uniform4iv(WebGLUniformLocation? location, [FlexibleArrayBufferView] Int32Array v, + GLuint srcOffset, optional GLuint srcLength = 0); + void uniform4iv(WebGLUniformLocation? location, sequence<GLint> v, + GLuint srcOffset, optional GLuint srcLength = 0); + void uniform1uiv(WebGLUniformLocation? location, [FlexibleArrayBufferView] Uint32Array v, + optional GLuint srcOffset = 0, optional GLuint srcLength = 0); + void uniform1uiv(WebGLUniformLocation? location, sequence<GLuint> v, + optional GLuint srcOffset = 0, optional GLuint srcLength = 0); + void uniform2uiv(WebGLUniformLocation? location, [FlexibleArrayBufferView] Uint32Array v, + optional GLuint srcOffset = 0, optional GLuint srcLength = 0); + void uniform2uiv(WebGLUniformLocation? location, sequence<GLuint> v, + optional GLuint srcOffset = 0, optional GLuint srcLength = 0); + void uniform3uiv(WebGLUniformLocation? location, [FlexibleArrayBufferView] Uint32Array v, + optional GLuint srcOffset = 0, optional GLuint srcLength = 0); + void uniform3uiv(WebGLUniformLocation? location, sequence<GLuint> v, + optional GLuint srcOffset = 0, optional GLuint srcLength = 0); + void uniform4uiv(WebGLUniformLocation? location, [FlexibleArrayBufferView] Uint32Array v, + optional GLuint srcOffset = 0, optional GLuint srcLength = 0); + void uniform4uiv(WebGLUniformLocation? location, sequence<GLuint> v, + optional GLuint srcOffset = 0, optional GLuint srcLength = 0); + void uniformMatrix2fv(WebGLUniformLocation? location, GLboolean transpose, Float32Array array, + GLuint srcOffset, optional GLuint srcLength = 0); + void uniformMatrix2fv(WebGLUniformLocation? location, GLboolean transpose, sequence<GLfloat> array, + GLuint srcOffset, optional GLuint srcLength = 0); + void uniformMatrix3fv(WebGLUniformLocation? location, GLboolean transpose, Float32Array array, + GLuint srcOffset, optional GLuint srcLength = 0); + void uniformMatrix3fv(WebGLUniformLocation? location, GLboolean transpose, sequence<GLfloat> array, + GLuint srcOffset, optional GLuint srcLength = 0); + void uniformMatrix4fv(WebGLUniformLocation? location, GLboolean transpose, Float32Array array, + GLuint srcOffset, optional GLuint srcLength = 0); + void uniformMatrix4fv(WebGLUniformLocation? location, GLboolean transpose, sequence<GLfloat> array, + GLuint srcOffset, optional GLuint srcLength = 0); + void uniformMatrix2x3fv(WebGLUniformLocation? location, GLboolean transpose, Float32Array value, + optional GLuint srcOffset = 0, optional GLuint srcLength = 0); + void uniformMatrix2x3fv(WebGLUniformLocation? location, GLboolean transpose, sequence<GLfloat> value, + optional GLuint srcOffset = 0, optional GLuint srcLength = 0); + void uniformMatrix3x2fv(WebGLUniformLocation? location, GLboolean transpose, Float32Array value, + optional GLuint srcOffset = 0, optional GLuint srcLength = 0); + void uniformMatrix3x2fv(WebGLUniformLocation? location, GLboolean transpose, sequence<GLfloat> value, + optional GLuint srcOffset = 0, optional GLuint srcLength = 0); + void uniformMatrix2x4fv(WebGLUniformLocation? location, GLboolean transpose, Float32Array value, + optional GLuint srcOffset = 0, optional GLuint srcLength = 0); + void uniformMatrix2x4fv(WebGLUniformLocation? location, GLboolean transpose, sequence<GLfloat> value, + optional GLuint srcOffset = 0, optional GLuint srcLength = 0); + void uniformMatrix4x2fv(WebGLUniformLocation? location, GLboolean transpose, Float32Array value, + optional GLuint srcOffset = 0, optional GLuint srcLength = 0); + void uniformMatrix4x2fv(WebGLUniformLocation? location, GLboolean transpose, sequence<GLfloat> value, + optional GLuint srcOffset = 0, optional GLuint srcLength = 0); + void uniformMatrix3x4fv(WebGLUniformLocation? location, GLboolean transpose, Float32Array value, + optional GLuint srcOffset = 0, optional GLuint srcLength = 0); + void uniformMatrix3x4fv(WebGLUniformLocation? location, GLboolean transpose, sequence<GLfloat> value, + optional GLuint srcOffset = 0, optional GLuint srcLength = 0); + void uniformMatrix4x3fv(WebGLUniformLocation? location, GLboolean transpose, Float32Array value, + optional GLuint srcOffset = 0, optional GLuint srcLength = 0); + void uniformMatrix4x3fv(WebGLUniformLocation? location, GLboolean transpose, sequence<GLfloat> value, + optional GLuint srcOffset = 0, optional GLuint srcLength = 0); void vertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w); void vertexAttribI4iv(GLuint index, Int32Array v);
diff --git a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp index 010b60b..751fc5eb2 100644 --- a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp +++ b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
@@ -5646,7 +5646,7 @@ const FlexibleFloat32ArrayView& v) { if (isContextLost() || !validateUniformParameters<WTF::Float32Array>("uniform1fv", location, v, - 1)) + 1, 0, v.length())) return; contextGL()->Uniform1fv(location->location(), v.length(), @@ -5656,7 +5656,8 @@ void WebGLRenderingContextBase::uniform1fv(const WebGLUniformLocation* location, Vector<GLfloat>& v) { if (isContextLost() || - !validateUniformParameters("uniform1fv", location, v.data(), v.size(), 1)) + !validateUniformParameters("uniform1fv", location, v.data(), v.size(), 1, + 0, v.size())) return; contextGL()->Uniform1fv(location->location(), v.size(), v.data()); @@ -5679,7 +5680,8 @@ void WebGLRenderingContextBase::uniform1iv(const WebGLUniformLocation* location, const FlexibleInt32ArrayView& v) { if (isContextLost() || - !validateUniformParameters<WTF::Int32Array>("uniform1iv", location, v, 1)) + !validateUniformParameters<WTF::Int32Array>("uniform1iv", location, v, 1, + 0, v.length())) return; contextGL()->Uniform1iv(location->location(), v.length(), @@ -5689,7 +5691,8 @@ void WebGLRenderingContextBase::uniform1iv(const WebGLUniformLocation* location, Vector<GLint>& v) { if (isContextLost() || - !validateUniformParameters("uniform1iv", location, v.data(), v.size(), 1)) + !validateUniformParameters("uniform1iv", location, v.data(), v.size(), 1, + 0, v.size())) return; contextGL()->Uniform1iv(location->location(), v.size(), v.data()); @@ -5714,7 +5717,7 @@ const FlexibleFloat32ArrayView& v) { if (isContextLost() || !validateUniformParameters<WTF::Float32Array>("uniform2fv", location, v, - 2)) + 2, 0, v.length())) return; contextGL()->Uniform2fv(location->location(), v.length() >> 1, @@ -5724,7 +5727,8 @@ void WebGLRenderingContextBase::uniform2fv(const WebGLUniformLocation* location, Vector<GLfloat>& v) { if (isContextLost() || - !validateUniformParameters("uniform2fv", location, v.data(), v.size(), 2)) + !validateUniformParameters("uniform2fv", location, v.data(), v.size(), 2, + 0, v.size())) return; contextGL()->Uniform2fv(location->location(), v.size() >> 1, v.data()); @@ -5748,7 +5752,8 @@ void WebGLRenderingContextBase::uniform2iv(const WebGLUniformLocation* location, const FlexibleInt32ArrayView& v) { if (isContextLost() || - !validateUniformParameters<WTF::Int32Array>("uniform2iv", location, v, 2)) + !validateUniformParameters<WTF::Int32Array>("uniform2iv", location, v, 2, + 0, v.length())) return; contextGL()->Uniform2iv(location->location(), v.length() >> 1, @@ -5758,7 +5763,8 @@ void WebGLRenderingContextBase::uniform2iv(const WebGLUniformLocation* location, Vector<GLint>& v) { if (isContextLost() || - !validateUniformParameters("uniform2iv", location, v.data(), v.size(), 2)) + !validateUniformParameters("uniform2iv", location, v.data(), v.size(), 2, + 0, v.size())) return; contextGL()->Uniform2iv(location->location(), v.size() >> 1, v.data()); @@ -5784,7 +5790,7 @@ const FlexibleFloat32ArrayView& v) { if (isContextLost() || !validateUniformParameters<WTF::Float32Array>("uniform3fv", location, v, - 3)) + 3, 0, v.length())) return; contextGL()->Uniform3fv(location->location(), v.length() / 3, @@ -5794,7 +5800,8 @@ void WebGLRenderingContextBase::uniform3fv(const WebGLUniformLocation* location, Vector<GLfloat>& v) { if (isContextLost() || - !validateUniformParameters("uniform3fv", location, v.data(), v.size(), 3)) + !validateUniformParameters("uniform3fv", location, v.data(), v.size(), 3, + 0, v.size())) return; contextGL()->Uniform3fv(location->location(), v.size() / 3, v.data()); @@ -5819,7 +5826,8 @@ void WebGLRenderingContextBase::uniform3iv(const WebGLUniformLocation* location, const FlexibleInt32ArrayView& v) { if (isContextLost() || - !validateUniformParameters<WTF::Int32Array>("uniform3iv", location, v, 3)) + !validateUniformParameters<WTF::Int32Array>("uniform3iv", location, v, 3, + 0, v.length())) return; contextGL()->Uniform3iv(location->location(), v.length() / 3, @@ -5829,7 +5837,8 @@ void WebGLRenderingContextBase::uniform3iv(const WebGLUniformLocation* location, Vector<GLint>& v) { if (isContextLost() || - !validateUniformParameters("uniform3iv", location, v.data(), v.size(), 3)) + !validateUniformParameters("uniform3iv", location, v.data(), v.size(), 3, + 0, v.size())) return; contextGL()->Uniform3iv(location->location(), v.size() / 3, v.data()); @@ -5856,7 +5865,7 @@ const FlexibleFloat32ArrayView& v) { if (isContextLost() || !validateUniformParameters<WTF::Float32Array>("uniform4fv", location, v, - 4)) + 4, 0, v.length())) return; contextGL()->Uniform4fv(location->location(), v.length() >> 2, @@ -5866,7 +5875,8 @@ void WebGLRenderingContextBase::uniform4fv(const WebGLUniformLocation* location, Vector<GLfloat>& v) { if (isContextLost() || - !validateUniformParameters("uniform4fv", location, v.data(), v.size(), 4)) + !validateUniformParameters("uniform4fv", location, v.data(), v.size(), 4, + 0, v.size())) return; contextGL()->Uniform4fv(location->location(), v.size() >> 2, v.data()); @@ -5892,7 +5902,8 @@ void WebGLRenderingContextBase::uniform4iv(const WebGLUniformLocation* location, const FlexibleInt32ArrayView& v) { if (isContextLost() || - !validateUniformParameters<WTF::Int32Array>("uniform4iv", location, v, 4)) + !validateUniformParameters<WTF::Int32Array>("uniform4iv", location, v, 4, + 0, v.length())) return; contextGL()->Uniform4iv(location->location(), v.length() >> 2, @@ -5902,7 +5913,8 @@ void WebGLRenderingContextBase::uniform4iv(const WebGLUniformLocation* location, Vector<GLint>& v) { if (isContextLost() || - !validateUniformParameters("uniform4iv", location, v.data(), v.size(), 4)) + !validateUniformParameters("uniform4iv", location, v.data(), v.size(), 4, + 0, v.size())) return; contextGL()->Uniform4iv(location->location(), v.size() >> 2, v.data()); @@ -5914,7 +5926,7 @@ DOMFloat32Array* v) { if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix2fv", location, transpose, - v, 4)) + v, 4, 0, v->length())) return; contextGL()->UniformMatrix2fv(location->location(), v->length() >> 2, transpose, v->data()); @@ -5926,7 +5938,7 @@ Vector<GLfloat>& v) { if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix2fv", location, transpose, - v.data(), v.size(), 4)) + v.data(), v.size(), 4, 0, v.size())) return; contextGL()->UniformMatrix2fv(location->location(), v.size() >> 2, transpose, v.data()); @@ -5938,7 +5950,7 @@ DOMFloat32Array* v) { if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix3fv", location, transpose, - v, 9)) + v, 9, 0, v->length())) return; contextGL()->UniformMatrix3fv(location->location(), v->length() / 9, transpose, v->data()); @@ -5950,7 +5962,7 @@ Vector<GLfloat>& v) { if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix3fv", location, transpose, - v.data(), v.size(), 9)) + v.data(), v.size(), 9, 0, v.size())) return; contextGL()->UniformMatrix3fv(location->location(), v.size() / 9, transpose, v.data()); @@ -5962,7 +5974,7 @@ DOMFloat32Array* v) { if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix4fv", location, transpose, - v, 16)) + v, 16, 0, v->length())) return; contextGL()->UniformMatrix4fv(location->location(), v->length() >> 4, transpose, v->data()); @@ -5974,7 +5986,7 @@ Vector<GLfloat>& v) { if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix4fv", location, transpose, - v.data(), v.size(), 16)) + v.data(), v.size(), 16, 0, v.size())) return; contextGL()->UniformMatrix4fv(location->location(), v.size() >> 4, transpose, v.data()); @@ -7159,37 +7171,13 @@ bool WebGLRenderingContextBase::validateUniformParameters( const char* functionName, const WebGLUniformLocation* location, - DOMFloat32Array* v, - GLsizei requiredMinSize) { - if (!v) { - synthesizeGLError(GL_INVALID_VALUE, functionName, "no array"); - return false; - } - return validateUniformMatrixParameters( - functionName, location, false, v->data(), v->length(), requiredMinSize); -} - -bool WebGLRenderingContextBase::validateUniformParameters( - const char* functionName, - const WebGLUniformLocation* location, - DOMInt32Array* v, - GLsizei requiredMinSize) { - if (!v) { - synthesizeGLError(GL_INVALID_VALUE, functionName, "no array"); - return false; - } - return validateUniformMatrixParameters( - functionName, location, false, v->data(), v->length(), requiredMinSize); -} - -bool WebGLRenderingContextBase::validateUniformParameters( - const char* functionName, - const WebGLUniformLocation* location, void* v, GLsizei size, - GLsizei requiredMinSize) { + GLsizei requiredMinSize, + GLuint srcOffset, + GLuint srcLength) { return validateUniformMatrixParameters(functionName, location, false, v, size, - requiredMinSize); + requiredMinSize, srcOffset, srcLength); } bool WebGLRenderingContextBase::validateUniformMatrixParameters( @@ -7197,14 +7185,16 @@ const WebGLUniformLocation* location, GLboolean transpose, DOMFloat32Array* v, - GLsizei requiredMinSize) { + GLsizei requiredMinSize, + GLuint srcOffset, + GLuint srcLength) { if (!v) { synthesizeGLError(GL_INVALID_VALUE, functionName, "no array"); return false; } return validateUniformMatrixParameters(functionName, location, transpose, v->data(), v->length(), - requiredMinSize); + requiredMinSize, srcOffset, srcLength); } bool WebGLRenderingContextBase::validateUniformMatrixParameters( @@ -7213,7 +7203,10 @@ GLboolean transpose, void* v, GLsizei size, - GLsizei requiredMinSize) { + GLsizei requiredMinSize, + GLuint srcOffset, + GLuint srcLength) { + DCHECK(size >= 0 && requiredMinSize > 0); if (!location) return false; if (location->program() != m_currentProgram) { @@ -7229,7 +7222,20 @@ synthesizeGLError(GL_INVALID_VALUE, functionName, "transpose not FALSE"); return false; } - if (size < requiredMinSize || (size % requiredMinSize)) { + if (srcOffset >= static_cast<GLuint>(size)) { + synthesizeGLError(GL_INVALID_VALUE, functionName, "invalid srcOffset"); + return false; + } + GLsizei actualSize = size - srcOffset; + if (srcLength > 0) { + if (srcLength > static_cast<GLuint>(actualSize)) { + synthesizeGLError(GL_INVALID_VALUE, functionName, + "invalid srcOffset + srcLength"); + return false; + } + actualSize = srcLength; + } + if (actualSize < requiredMinSize || (actualSize % requiredMinSize)) { synthesizeGLError(GL_INVALID_VALUE, functionName, "invalid size"); return false; }
diff --git a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h index 27acdfa..23c818a 100644 --- a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h +++ b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h
@@ -1352,42 +1352,42 @@ // Helper function to validate input parameters for uniform functions. bool validateUniformParameters(const char* functionName, const WebGLUniformLocation*, - DOMFloat32Array*, - GLsizei mod); - bool validateUniformParameters(const char* functionName, - const WebGLUniformLocation*, - DOMInt32Array*, - GLsizei mod); - bool validateUniformParameters(const char* functionName, - const WebGLUniformLocation*, void*, GLsizei, - GLsizei mod); + GLsizei mod, + GLuint srcOffset, + GLuint srcLength); bool validateUniformMatrixParameters(const char* functionName, const WebGLUniformLocation*, GLboolean transpose, DOMFloat32Array*, - GLsizei mod); + GLsizei mod, + GLuint srcOffset, + GLuint srcLength); bool validateUniformMatrixParameters(const char* functionName, const WebGLUniformLocation*, GLboolean transpose, void*, GLsizei, - GLsizei mod); + GLsizei mod, + GLuint srcOffset, + GLuint srcLength); template <typename WTFTypedArray> bool validateUniformParameters( const char* functionName, const WebGLUniformLocation* location, const TypedFlexibleArrayBufferView<WTFTypedArray>& v, - GLsizei requiredMinSize) { + GLsizei requiredMinSize, + GLuint srcOffset, + GLuint srcLength) { if (!v.dataMaybeOnStack()) { synthesizeGLError(GL_INVALID_VALUE, functionName, "no array"); return false; } - return validateUniformMatrixParameters(functionName, location, false, - v.dataMaybeOnStack(), v.length(), - requiredMinSize); + return validateUniformMatrixParameters( + functionName, location, false, v.dataMaybeOnStack(), v.length(), + requiredMinSize, srcOffset, srcLength); } // Helper function to validate the target for bufferData and
diff --git a/third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.h b/third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.h index ce505128..86b2b363c 100644 --- a/third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.h +++ b/third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.h
@@ -5,14 +5,15 @@ #ifndef CanvasSurfaceLayerBridge_h #define CanvasSurfaceLayerBridge_h +#include <memory> #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" +#include "cc/ipc/display_compositor.mojom-blink.h" #include "cc/surfaces/surface_id.h" #include "cc/surfaces/surface_reference_factory.h" #include "mojo/public/cpp/bindings/binding.h" #include "platform/PlatformExport.h" #include "public/platform/modules/offscreencanvas/offscreen_canvas_surface.mojom-blink.h" -#include <memory> namespace cc { class Layer; @@ -33,7 +34,7 @@ }; class PLATFORM_EXPORT CanvasSurfaceLayerBridge - : NON_EXPORTED_BASE(public mojom::blink::OffscreenCanvasSurfaceClient) { + : NON_EXPORTED_BASE(public cc::mojom::blink::DisplayCompositorClient) { public: explicit CanvasSurfaceLayerBridge(CanvasSurfaceLayerBridgeObserver*, WebLayerTreeView*); @@ -42,7 +43,7 @@ WebLayer* getWebLayer() const { return m_webLayer.get(); } const cc::FrameSinkId& getFrameSinkId() const { return m_frameSinkId; } - // Implementation of mojom::blink::OffscreenCanvasSurfaceClient + // Implementation of cc::mojom::blink::DisplayCompositorClient void OnSurfaceCreated(const cc::SurfaceInfo&) override; void satisfyCallback(const cc::SurfaceSequence&); @@ -58,7 +59,7 @@ CanvasSurfaceLayerBridgeObserver* m_observer; mojom::blink::OffscreenCanvasSurfacePtr m_service; - mojo::Binding<mojom::blink::OffscreenCanvasSurfaceClient> m_binding; + mojo::Binding<cc::mojom::blink::DisplayCompositorClient> m_binding; const cc::FrameSinkId m_frameSinkId; cc::SurfaceId m_currentSurfaceId;
diff --git a/third_party/WebKit/Source/platform/scheduler/renderer/task_queue_throttler.cc b/third_party/WebKit/Source/platform/scheduler/renderer/task_queue_throttler.cc index c64fbd46..8d42886 100644 --- a/third_party/WebKit/Source/platform/scheduler/renderer/task_queue_throttler.cc +++ b/third_party/WebKit/Source/platform/scheduler/renderer/task_queue_throttler.cc
@@ -485,7 +485,8 @@ return; base::TimeTicks runtime = - std::max(now, AlignedThrottledRunTime(unaligned_runtime)); + AlignedThrottledRunTime(std::max(now, unaligned_runtime)); + DCHECK_LE(now, runtime); // If there is a pending call to PumpThrottledTasks and it's sooner than // |runtime| then return.
diff --git a/third_party/WebKit/public/platform/modules/offscreencanvas/offscreen_canvas_surface.mojom b/third_party/WebKit/public/platform/modules/offscreencanvas/offscreen_canvas_surface.mojom index afd4249..3c32a12 100644 --- a/third_party/WebKit/public/platform/modules/offscreencanvas/offscreen_canvas_surface.mojom +++ b/third_party/WebKit/public/platform/modules/offscreencanvas/offscreen_canvas_surface.mojom
@@ -5,10 +5,10 @@ module blink.mojom; import "cc/ipc/compositor_frame.mojom"; +import "cc/ipc/display_compositor.mojom"; import "cc/ipc/frame_sink_id.mojom"; import "cc/ipc/mojo_compositor_frame_sink.mojom"; import "cc/ipc/surface_id.mojom"; -import "cc/ipc/surface_info.mojom"; import "cc/ipc/surface_sequence.mojom"; interface OffscreenCanvasSurface { @@ -16,15 +16,10 @@ Satisfy(cc.mojom.SurfaceSequence sequence); }; -interface OffscreenCanvasSurfaceClient { - // TODO(fsamuel, xlai): Replace this with DisplayCompositorClient - OnSurfaceCreated(cc.mojom.SurfaceInfo surface_info); -}; - interface OffscreenCanvasSurfaceFactory { CreateOffscreenCanvasSurface(cc.mojom.FrameSinkId parent_frame_sink_id, cc.mojom.FrameSinkId frame_sink_id, - OffscreenCanvasSurfaceClient client, + cc.mojom.DisplayCompositorClient client, OffscreenCanvasSurface& service); };
diff --git a/ui/base/dragdrop/os_exchange_data_provider_win.cc b/ui/base/dragdrop/os_exchange_data_provider_win.cc index c09780f..4a23569 100644 --- a/ui/base/dragdrop/os_exchange_data_provider_win.cc +++ b/ui/base/dragdrop/os_exchange_data_provider_win.cc
@@ -7,6 +7,7 @@ #include <stdint.h> #include <algorithm> +#include <iterator> #include "base/files/file_path.h" #include "base/i18n/file_util_icu.h" @@ -99,7 +100,7 @@ // retarded IEnumFORMATETC API assumes a deterministic ordering of elements // through methods like Next and Skip. This exposes the underlying data // structure to the user. Bah. - ScopedVector<FORMATETC> contents_; + std::vector<std::unique_ptr<FORMATETC>> contents_; // The cursor of the active enumeration - an index into |contents_|. size_t cursor_; @@ -125,9 +126,9 @@ : cursor_(0), ref_count_(0) { // Copy FORMATETC data from our source into ourselves. while (start != end) { - FORMATETC* format_etc = new FORMATETC; - CloneFormatEtc(&(*start)->format_etc, format_etc); - contents_.push_back(format_etc); + auto format_etc = base::MakeUnique<FORMATETC>(); + CloneFormatEtc(&(*start)->format_etc, format_etc.get()); + contents_.push_back(std::move(format_etc)); ++start; } } @@ -144,7 +145,7 @@ // This method copies count elements into |elements_array|. ULONG index = 0; while (cursor_ < contents_.size() && index < count) { - CloneFormatEtc(contents_[cursor_], &elements_array[index]); + CloneFormatEtc(contents_[cursor_].get(), &elements_array[index]); ++cursor_; ++index; } @@ -206,13 +207,13 @@ const FormatEtcEnumerator* other) { FormatEtcEnumerator* e = new FormatEtcEnumerator; // Copy FORMATETC data from our source into ourselves. - ScopedVector<FORMATETC>::const_iterator start = other->contents_.begin(); - while (start != other->contents_.end()) { - FORMATETC* format_etc = new FORMATETC; - CloneFormatEtc(*start, format_etc); - e->contents_.push_back(format_etc); - ++start; - } + std::transform(other->contents_.cbegin(), other->contents_.cend(), + std::back_inserter(e->contents_), + [](const std::unique_ptr<FORMATETC>& format_etc) { + auto clone = base::MakeUnique<FORMATETC>(); + CloneFormatEtc(format_etc.get(), clone.get()); + return clone; + }); // Carry over e->cursor_ = other->cursor_; return e; @@ -284,7 +285,7 @@ void OSExchangeDataProviderWin::MarkOriginatedFromRenderer() { STGMEDIUM* storage = GetStorageForString(std::string()); - data_->contents_.push_back(new DataObjectImpl::StoredDataInfo( + data_->contents_.push_back(base::MakeUnique<DataObjectImpl::StoredDataInfo>( GetRendererTaintFormatType().ToFormatEtc(), storage)); } @@ -294,12 +295,12 @@ void OSExchangeDataProviderWin::SetString(const base::string16& data) { STGMEDIUM* storage = GetStorageForString(data); - data_->contents_.push_back(new DataObjectImpl::StoredDataInfo( + data_->contents_.push_back(base::MakeUnique<DataObjectImpl::StoredDataInfo>( Clipboard::GetPlainTextWFormatType().ToFormatEtc(), storage)); // Also add the UTF8-encoded version. storage = GetStorageForString(base::UTF16ToUTF8(data)); - data_->contents_.push_back(new DataObjectImpl::StoredDataInfo( + data_->contents_.push_back(base::MakeUnique<DataObjectImpl::StoredDataInfo>( Clipboard::GetPlainTextFormatType().ToFormatEtc(), storage)); } @@ -316,7 +317,7 @@ x_moz_url_str += '\n'; x_moz_url_str += title; STGMEDIUM* storage = GetStorageForString(x_moz_url_str); - data_->contents_.push_back(new DataObjectImpl::StoredDataInfo( + data_->contents_.push_back(base::MakeUnique<DataObjectImpl::StoredDataInfo>( Clipboard::GetMozUrlFormatType().ToFormatEtc(), storage)); // Add a .URL shortcut file for dragging to Explorer. @@ -328,10 +329,10 @@ // Add a UniformResourceLocator link for apps like IE and Word. storage = GetStorageForString(base::UTF8ToUTF16(url.spec())); - data_->contents_.push_back(new DataObjectImpl::StoredDataInfo( + data_->contents_.push_back(base::MakeUnique<DataObjectImpl::StoredDataInfo>( Clipboard::GetUrlWFormatType().ToFormatEtc(), storage)); storage = GetStorageForString(url.spec()); - data_->contents_.push_back(new DataObjectImpl::StoredDataInfo( + data_->contents_.push_back(base::MakeUnique<DataObjectImpl::StoredDataInfo>( Clipboard::GetUrlFormatType().ToFormatEtc(), storage)); // TODO(beng): add CF_HTML. @@ -344,25 +345,22 @@ void OSExchangeDataProviderWin::SetFilename(const base::FilePath& path) { STGMEDIUM* storage = GetStorageForFileName(path); - DataObjectImpl::StoredDataInfo* info = new DataObjectImpl::StoredDataInfo( - Clipboard::GetCFHDropFormatType().ToFormatEtc(), storage); - data_->contents_.push_back(info); + data_->contents_.push_back(base::MakeUnique<DataObjectImpl::StoredDataInfo>( + Clipboard::GetCFHDropFormatType().ToFormatEtc(), storage)); storage = GetIDListStorageForFileName(path); if (!storage) return; - info = new DataObjectImpl::StoredDataInfo( - Clipboard::GetIDListFormatType().ToFormatEtc(), storage); - data_->contents_.push_back(info); + data_->contents_.push_back(base::MakeUnique<DataObjectImpl::StoredDataInfo>( + Clipboard::GetIDListFormatType().ToFormatEtc(), storage)); } void OSExchangeDataProviderWin::SetFilenames( const std::vector<FileInfo>& filenames) { for (size_t i = 0; i < filenames.size(); ++i) { STGMEDIUM* storage = GetStorageForFileName(filenames[i].path); - DataObjectImpl::StoredDataInfo* info = new DataObjectImpl::StoredDataInfo( - Clipboard::GetCFHDropFormatType().ToFormatEtc(), storage); - data_->contents_.push_back(info); + data_->contents_.push_back(base::MakeUnique<DataObjectImpl::StoredDataInfo>( + Clipboard::GetCFHDropFormatType().ToFormatEtc(), storage)); } } @@ -370,8 +368,8 @@ const Clipboard::FormatType& format, const base::Pickle& data) { STGMEDIUM* storage = GetStorageForBytes(data.data(), data.size()); - data_->contents_.push_back( - new DataObjectImpl::StoredDataInfo(format.ToFormatEtc(), storage)); + data_->contents_.push_back(base::MakeUnique<DataObjectImpl::StoredDataInfo>( + format.ToFormatEtc(), storage)); } void OSExchangeDataProviderWin::SetFileContents( @@ -379,12 +377,12 @@ const std::string& file_contents) { // Add CFSTR_FILEDESCRIPTOR STGMEDIUM* storage = GetStorageForFileDescriptor(filename); - data_->contents_.push_back(new DataObjectImpl::StoredDataInfo( + data_->contents_.push_back(base::MakeUnique<DataObjectImpl::StoredDataInfo>( Clipboard::GetFileDescriptorFormatType().ToFormatEtc(), storage)); // Add CFSTR_FILECONTENTS storage = GetStorageForBytes(file_contents.data(), file_contents.length()); - data_->contents_.push_back(new DataObjectImpl::StoredDataInfo( + data_->contents_.push_back(base::MakeUnique<DataObjectImpl::StoredDataInfo>( Clipboard::GetFileContentZeroFormatType().ToFormatEtc(), storage)); } @@ -396,12 +394,12 @@ std::string cf_html = ClipboardUtil::HtmlToCFHtml(utf8_html, url); STGMEDIUM* storage = GetStorageForBytes(cf_html.c_str(), cf_html.size()); - data_->contents_.push_back(new DataObjectImpl::StoredDataInfo( + data_->contents_.push_back(base::MakeUnique<DataObjectImpl::StoredDataInfo>( Clipboard::GetHtmlFormatType().ToFormatEtc(), storage)); STGMEDIUM* storage_plain = GetStorageForBytes(utf8_html.c_str(), utf8_html.size()); - data_->contents_.push_back(new DataObjectImpl::StoredDataInfo( + data_->contents_.push_back(base::MakeUnique<DataObjectImpl::StoredDataInfo>( Clipboard::GetTextHtmlFormatType().ToFormatEtc(), storage_plain)); } @@ -532,10 +530,10 @@ storage = GetStorageForFileName(download.filename); // Add CF_HDROP. - DataObjectImpl::StoredDataInfo* info = new DataObjectImpl::StoredDataInfo( + auto info = base::MakeUnique<DataObjectImpl::StoredDataInfo>( Clipboard::GetCFHDropFormatType().ToFormatEtc(), storage); info->downloader = download.downloader; - data_->contents_.push_back(info); + data_->contents_.push_back(std::move(info)); // Adding a download file always enables async mode. data_->SetAsyncMode(VARIANT_TRUE); @@ -795,14 +793,14 @@ DuplicateMedium(format_etc->cfFormat, medium, local_medium); } - DataObjectImpl::StoredDataInfo* info = - new DataObjectImpl::StoredDataInfo(*format_etc, local_medium); + auto info = base::MakeUnique<DataObjectImpl::StoredDataInfo>(*format_etc, + local_medium); info->medium->tymed = format_etc->tymed; info->owns_medium = !!should_release; // Make newly added data appear first. // TODO(dcheng): Make various setters agree whether elements should be // prioritized from front to back or back to front. - contents_.insert(contents_.begin(), info); + contents_.insert(contents_.begin(), std::move(info)); return S_OK; }
diff --git a/ui/base/dragdrop/os_exchange_data_provider_win.h b/ui/base/dragdrop/os_exchange_data_provider_win.h index 1f431c74..9987779f 100644 --- a/ui/base/dragdrop/os_exchange_data_provider_win.h +++ b/ui/base/dragdrop/os_exchange_data_provider_win.h
@@ -8,6 +8,7 @@ #include <objidl.h> #include <shlobj.h> #include <stddef.h> +#include <memory> #include <string> #include <vector> @@ -20,7 +21,6 @@ #endif #include "base/macros.h" -#include "base/memory/scoped_vector.h" #include "base/win/scoped_comptr.h" #include "ui/base/dragdrop/os_exchange_data.h" #include "ui/base/ui_base_export.h" @@ -110,7 +110,7 @@ ~StoredDataInfo(); }; - typedef ScopedVector<StoredDataInfo> StoredData; + typedef std::vector<std::unique_ptr<StoredDataInfo>> StoredData; StoredData contents_; base::win::ScopedComPtr<IDataObject> source_object_;
diff --git a/ui/base/ime/input_method.h b/ui/base/ime/input_method.h index a20da19..67010a3 100644 --- a/ui/base/ime/input_method.h +++ b/ui/base/ime/input_method.h
@@ -7,11 +7,11 @@ #include <stdint.h> +#include <memory> #include <string> #include <vector> #include "base/event_types.h" -#include "base/memory/scoped_vector.h" #include "build/build_config.h" #include "ui/base/ime/text_input_mode.h" #include "ui/base/ime/text_input_type.h"
diff --git a/ui/base/resource/data_pack.cc b/ui/base/resource/data_pack.cc index 6de2568..c7def6da 100644 --- a/ui/base/resource/data_pack.cc +++ b/ui/base/resource/data_pack.cc
@@ -284,13 +284,13 @@ #if DCHECK_IS_ON() void DataPack::CheckForDuplicateResources( - const ScopedVector<ResourceHandle>& packs) { + const std::vector<std::unique_ptr<ResourceHandle>>& packs) { for (size_t i = 0; i < resource_count_ + 1; ++i) { const DataPackEntry* entry = reinterpret_cast<const DataPackEntry*>( data_source_->GetData() + kHeaderLength + (i * sizeof(DataPackEntry))); const uint16_t resource_id = entry->resource_id; const float resource_scale = GetScaleForScaleFactor(scale_factor_); - for (const ResourceHandle* handle : packs) { + for (const auto& handle : packs) { if (GetScaleForScaleFactor(handle->GetScaleFactor()) != resource_scale) continue; DCHECK(!handle->HasResource(resource_id)) << "Duplicate resource "
diff --git a/ui/base/resource/data_pack.h b/ui/base/resource/data_pack.h index 8bb5e5c..56d30d2 100644 --- a/ui/base/resource/data_pack.h +++ b/ui/base/resource/data_pack.h
@@ -14,11 +14,11 @@ #include <map> #include <memory> +#include <vector> #include "base/files/file.h" #include "base/files/memory_mapped_file.h" #include "base/macros.h" -#include "base/memory/scoped_vector.h" #include "base/strings/string_piece.h" #include "ui/base/resource/data_pack_export.h" #include "ui/base/resource/resource_handle.h" @@ -70,7 +70,8 @@ #if DCHECK_IS_ON() // Checks to see if any resource in this DataPack already exists in the list // of resources. - void CheckForDuplicateResources(const ScopedVector<ResourceHandle>& packs); + void CheckForDuplicateResources( + const std::vector<std::unique_ptr<ResourceHandle>>& packs); #endif private:
diff --git a/ui/base/resource/resource_bundle.cc b/ui/base/resource/resource_bundle.cc index 10064e0..b5a9a4f 100644 --- a/ui/base/resource/resource_bundle.cc +++ b/ui/base/resource/resource_bundle.cc
@@ -16,6 +16,7 @@ #include "base/files/file_util.h" #include "base/logging.h" #include "base/macros.h" +#include "base/memory/ptr_util.h" #include "base/memory/ref_counted_memory.h" #include "base/path_service.h" #include "base/stl_util.h" @@ -273,7 +274,7 @@ ScaleFactor scale_factor) { std::unique_ptr<DataPack> data_pack(new DataPack(scale_factor)); if (data_pack->LoadFromBuffer(buffer)) { - AddDataPack(data_pack.release()); + AddDataPack(std::move(data_pack)); } else { LOG(ERROR) << "Failed to load data pack from buffer"; } @@ -285,7 +286,7 @@ ScaleFactor scale_factor) { std::unique_ptr<DataPack> data_pack(new DataPack(scale_factor)); if (data_pack->LoadFromFileRegion(std::move(file), region)) { - AddDataPack(data_pack.release()); + AddDataPack(std::move(data_pack)); } else { LOG(ERROR) << "Failed to load data pack from file." << "\nSome features may not be available."; @@ -358,7 +359,7 @@ // Use the given resource pak for both common and localized resources. std::unique_ptr<DataPack> data_pack(new DataPack(scale_factor)); if (!path.empty() && data_pack->LoadFromPath(path)) - AddDataPack(data_pack.release()); + AddDataPack(std::move(data_pack)); data_pack.reset(new DataPack(ui::SCALE_FACTOR_NONE)); if (!locale_path.empty() && data_pack->LoadFromPath(locale_path)) { @@ -762,22 +763,23 @@ std::unique_ptr<DataPack> data_pack(new DataPack(scale_factor)); if (data_pack->LoadFromPath(pack_path)) { - AddDataPack(data_pack.release()); + AddDataPack(std::move(data_pack)); } else if (!optional) { LOG(ERROR) << "Failed to load " << pack_path.value() << "\nSome features may not be available."; } } -void ResourceBundle::AddDataPack(DataPack* data_pack) { +void ResourceBundle::AddDataPack(std::unique_ptr<DataPack> data_pack) { #if DCHECK_IS_ON() data_pack->CheckForDuplicateResources(data_packs_); #endif - data_packs_.push_back(data_pack); if (GetScaleForScaleFactor(data_pack->GetScaleFactor()) > GetScaleForScaleFactor(max_scale_factor_)) max_scale_factor_ = data_pack->GetScaleFactor(); + + data_packs_.push_back(std::move(data_pack)); } void ResourceBundle::InitDefaultFontList() {
diff --git a/ui/base/resource/resource_bundle.h b/ui/base/resource/resource_bundle.h index 404e7965..12e9ccf 100644 --- a/ui/base/resource/resource_bundle.h +++ b/ui/base/resource/resource_bundle.h
@@ -10,13 +10,13 @@ #include <map> #include <memory> #include <string> +#include <vector> #include "base/containers/hash_tables.h" #include "base/files/file_path.h" #include "base/files/memory_mapped_file.h" #include "base/gtest_prod_util.h" #include "base/macros.h" -#include "base/memory/scoped_vector.h" #include "base/strings/string16.h" #include "base/strings/string_piece.h" #include "build/build_config.h" @@ -329,7 +329,7 @@ // Inserts |data_pack| to |data_pack_| and updates |max_scale_factor_| // accordingly. - void AddDataPack(DataPack* data_pack); + void AddDataPack(std::unique_ptr<DataPack> data_pack); // Try to load the locale specific strings from an external data module. // Returns the locale that is loaded. @@ -401,7 +401,7 @@ // Handles for data sources. std::unique_ptr<ResourceHandle> locale_resources_data_; - ScopedVector<ResourceHandle> data_packs_; + std::vector<std::unique_ptr<ResourceHandle>> data_packs_; // The maximum scale factor currently loaded. ScaleFactor max_scale_factor_;
diff --git a/ui/base/resource/resource_bundle_win.cc b/ui/base/resource/resource_bundle_win.cc index f962e057..e5c649e 100644 --- a/ui/base/resource/resource_bundle_win.cc +++ b/ui/base/resource/resource_bundle_win.cc
@@ -5,6 +5,7 @@ #include "ui/base/resource/resource_bundle_win.h" #include "base/logging.h" +#include "base/memory/ptr_util.h" #include "base/path_service.h" #include "base/strings/utf_string_conversions.h" #include "skia/ext/image_operations.h" @@ -31,7 +32,8 @@ void ResourceBundle::LoadCommonResources() { // As a convenience, add the current resource module as a data packs. - data_packs_.push_back(new ResourceDataDLL(GetCurrentResourceDLL())); + data_packs_.push_back( + base::MakeUnique<ResourceDataDLL>(GetCurrentResourceDLL())); LoadChromeResources(); }
diff --git a/ui/base/win/hwnd_subclass.cc b/ui/base/win/hwnd_subclass.cc index 7faed27..184698b 100644 --- a/ui/base/win/hwnd_subclass.cc +++ b/ui/base/win/hwnd_subclass.cc
@@ -8,7 +8,7 @@ #include "base/logging.h" #include "base/macros.h" -#include "base/memory/scoped_vector.h" +#include "base/memory/ptr_util.h" #include "base/memory/singleton.h" #include "base/stl_util.h" #include "ui/gfx/win/hwnd_util.h" @@ -69,12 +69,12 @@ ui::ViewProp::GetValue(target, kHWNDSubclassKey)); if (!subclass) { subclass = new ui::HWNDSubclass(target); - hwnd_subclasses_.push_back(subclass); + hwnd_subclasses_.push_back(base::WrapUnique(subclass)); } return subclass; } - const ScopedVector<HWNDSubclass>& hwnd_subclasses() { + const std::vector<std::unique_ptr<HWNDSubclass>>& hwnd_subclasses() { return hwnd_subclasses_; } @@ -83,7 +83,7 @@ HWNDSubclassFactory() {} - ScopedVector<HWNDSubclass> hwnd_subclasses_; + std::vector<std::unique_ptr<HWNDSubclass>> hwnd_subclasses_; DISALLOW_COPY_AND_ASSIGN(HWNDSubclassFactory); }; @@ -97,10 +97,8 @@ // static void HWNDSubclass::RemoveFilterFromAllTargets(HWNDMessageFilter* filter) { HWNDSubclassFactory* factory = HWNDSubclassFactory::GetInstance(); - ScopedVector<ui::HWNDSubclass>::const_iterator it; - for (it = factory->hwnd_subclasses().begin(); - it != factory->hwnd_subclasses().end(); ++it) - (*it)->RemoveFilter(filter); + for (const auto& subclass : factory->hwnd_subclasses()) + subclass->RemoveFilter(filter); } // static
diff --git a/ui/gfx/vector_icons/BUILD.gn b/ui/gfx/vector_icons/BUILD.gn index c737b8c5..1bd790f 100644 --- a/ui/gfx/vector_icons/BUILD.gn +++ b/ui/gfx/vector_icons/BUILD.gn
@@ -24,25 +24,15 @@ "cookie.icon", "default_favicon.icon", "eol.icon", - "error_circle.icon", "extension.icon", "extension_crashed.icon", "file_download.icon", - "file_download_incognito.1x.icon", - "file_download_incognito.icon", - "file_download_shelf.icon", "fullscreen.icon", "globe.icon", "help_outline.icon", "image.icon", "info_outline.icon", - "location_on.icon", "lock.icon", - "media_router_active.icon", - "media_router_error.icon", - "media_router_idle.icon", - "media_router_warning.icon", - "microphone.icon", "midi.icon", "mixed_content.icon", "mode_edit.icon",
diff --git a/ui/vector_icons/BUILD.gn b/ui/vector_icons/BUILD.gn index 52e95265..f4fd78e0 100644 --- a/ui/vector_icons/BUILD.gn +++ b/ui/vector_icons/BUILD.gn
@@ -2,6 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import("//build/util/branding.gni") import("//ui/vector_icons/vector_icons.gni") aggregate_vector_icons("ui_vector_icons") { @@ -12,8 +13,21 @@ "back_arrow.icon", "close.1x.icon", "close.icon", + "error_circle.icon", + "extension.icon", "forward_arrow.1x.icon", "forward_arrow.icon", + "location_on.icon", + "media_router_active.icon", + "media_router_error.icon", + "media_router_idle.icon", + "media_router_warning.icon", + "microphone.icon", + "midi.icon", + "notifications.icon", + "protocol_handler.icon", + "videocam.icon", + "warning.icon", ] }
diff --git a/ui/gfx/vector_icons/error_circle.icon b/ui/vector_icons/error_circle.icon similarity index 100% rename from ui/gfx/vector_icons/error_circle.icon rename to ui/vector_icons/error_circle.icon
diff --git a/ui/vector_icons/extension.icon b/ui/vector_icons/extension.icon new file mode 100644 index 0000000..75fe2c8 --- /dev/null +++ b/ui/vector_icons/extension.icon
@@ -0,0 +1,35 @@ +// Copyright 2015 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. + +MOVE_TO, 41, 22, +R_H_LINE_TO, -3, +R_V_LINE_TO, -8, +R_CUBIC_TO, 0, -2.21f, -1.79f, -4, -4, -4, +R_H_LINE_TO, -8, +V_LINE_TO, 7, +R_CUBIC_TO, 0, -2.76f, -2.24f, -5, -5, -5, +R_CUBIC_TO, -2.76f, 0, -5, 2.24f, -5, 5, +R_V_LINE_TO, 3, +H_LINE_TO, 8, +R_CUBIC_TO, -2.21f, 0, -3.98f, 1.79f, -3.98f, 4, +R_LINE_TO, -0.01f, 7.6f, +H_LINE_TO, 7, +R_CUBIC_TO, 2.98f, 0, 5.4f, 2.42f, 5.4f, 5.4f, +R_CUBIC_TO, 0, 2.98f, -2.42f, 5.4f, -5.4f, 5.4f, +H_LINE_TO, 4.01f, +LINE_TO, 4, 40, +R_CUBIC_TO, 0, 2.21f, 1.79f, 4, 4, 4, +R_H_LINE_TO, 7.6f, +R_V_LINE_TO, -3, +R_CUBIC_TO, 0, -2.98f, 2.42f, -5.4f, 5.4f, -5.4f, +R_CUBIC_TO, 2.98f, 0, 5.4f, 2.42f, 5.4f, 5.4f, +R_V_LINE_TO, 3, +H_LINE_TO, 34, +R_CUBIC_TO, 2.21f, 0, 4, -1.79f, 4, -4, +R_V_LINE_TO, -8, +R_H_LINE_TO, 3, +R_CUBIC_TO, 2.76f, 0, 5, -2.24f, 5, -5, +R_CUBIC_TO, 0, -2.76f, -2.24f, -5, -5, -5, +CLOSE, +END
diff --git a/ui/gfx/vector_icons/location_on.icon b/ui/vector_icons/location_on.icon similarity index 100% rename from ui/gfx/vector_icons/location_on.icon rename to ui/vector_icons/location_on.icon
diff --git a/ui/gfx/vector_icons/media_router_active.icon b/ui/vector_icons/media_router_active.icon similarity index 100% rename from ui/gfx/vector_icons/media_router_active.icon rename to ui/vector_icons/media_router_active.icon
diff --git a/ui/gfx/vector_icons/media_router_error.icon b/ui/vector_icons/media_router_error.icon similarity index 100% rename from ui/gfx/vector_icons/media_router_error.icon rename to ui/vector_icons/media_router_error.icon
diff --git a/ui/gfx/vector_icons/media_router_idle.icon b/ui/vector_icons/media_router_idle.icon similarity index 100% rename from ui/gfx/vector_icons/media_router_idle.icon rename to ui/vector_icons/media_router_idle.icon
diff --git a/ui/gfx/vector_icons/media_router_warning.icon b/ui/vector_icons/media_router_warning.icon similarity index 100% rename from ui/gfx/vector_icons/media_router_warning.icon rename to ui/vector_icons/media_router_warning.icon
diff --git a/ui/gfx/vector_icons/microphone.icon b/ui/vector_icons/microphone.icon similarity index 100% rename from ui/gfx/vector_icons/microphone.icon rename to ui/vector_icons/microphone.icon
diff --git a/ui/vector_icons/midi.icon b/ui/vector_icons/midi.icon new file mode 100644 index 0000000..10c73a8 --- /dev/null +++ b/ui/vector_icons/midi.icon
@@ -0,0 +1,41 @@ +// Copyright 2015 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. + +MOVE_TO, 33, 31, +LINE_TO, 33, 41, +LINE_TO, 29, 41, +LINE_TO, 29, 31, +CUBIC_TO, 27.9f, 31, 27, 30.1f, 27, 29, +LINE_TO, 27, 7, +LINE_TO, 35, 7, +LINE_TO, 35, 29, +CUBIC_TO, 35, 30.1f, 34.1f, 31, 33, 31, +CLOSE, +MOVE_TO, 19, 31, +LINE_TO, 19, 41, +LINE_TO, 15, 41, +LINE_TO, 15, 31, +CUBIC_TO, 13.9f, 31, 13, 30.1f, 13, 29, +LINE_TO, 13, 7, +LINE_TO, 21, 7, +LINE_TO, 21, 29, +CUBIC_TO, 21, 30.1f, 20.1f, 31, 19, 31, +CLOSE, +MOVE_TO, 40, 4, +LINE_TO, 8, 4, +CUBIC_TO, 5.8f, 4, 4, 5.8f, 4, 8, +LINE_TO, 4, 40, +CUBIC_TO, 4, 42.2f, 5.8f, 44, 8, 44, +LINE_TO, 40, 44, +CUBIC_TO, 42.2f, 44, 44, 42.2f, 44, 40, +LINE_TO, 44, 8, +CUBIC_TO, 44, 5.8f, 42.2f, 4, 40, 4, +CLOSE, +MOVE_TO, 7, 7, +LINE_TO, 41, 7, +LINE_TO, 41, 41, +LINE_TO, 7, 41, +LINE_TO, 7, 7, +CLOSE, +END
diff --git a/ui/vector_icons/notifications.icon b/ui/vector_icons/notifications.icon new file mode 100644 index 0000000..8240b82 --- /dev/null +++ b/ui/vector_icons/notifications.icon
@@ -0,0 +1,24 @@ +// Copyright 2015 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. + +MOVE_TO, 24, 44, +R_CUBIC_TO, 2.21f, 0, 4, -1.49f, 4, -4, +R_H_LINE_TO, -8, +R_CUBIC_TO, 0, 2.21f, 1.79f, 4, 4, 4, +CLOSE, +R_MOVE_TO, 12, -12, +V_LINE_TO, 22, +R_CUBIC_TO, 0, -6.15f, -3.27f, -11.28f, -9, -12.64f, +V_LINE_TO, 8, +R_CUBIC_TO, 0, -1.66f, -1.34f, -3, -3, -3, +R_CUBIC_TO, -1.66f, 0, -3, 1.34f, -3, 3, +R_V_LINE_TO, 1.36f, +R_CUBIC_TO, -5.73f, 1.36f, -9, 6.49f, -9, 12.64f, +R_V_LINE_TO, 10, +R_LINE_TO, -4, 4, +R_V_LINE_TO, 2, +R_H_LINE_TO, 32, +R_V_LINE_TO, -2, +R_LINE_TO, -4, -4, +END
diff --git a/ui/vector_icons/protocol_handler.icon b/ui/vector_icons/protocol_handler.icon new file mode 100644 index 0000000..3ded270d1e --- /dev/null +++ b/ui/vector_icons/protocol_handler.icon
@@ -0,0 +1,48 @@ +// Copyright 2015 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. + +MOVE_TO, 43.44f, 22.66f, +LINE_TO, 30.15f, 8.59f, +CUBIC_TO, 29.42f, 7.82f, 28.14f, 7.81f, 27.39f, 8.57f, +LINE_TO, 24.05f, 12.01f, +LINE_TO, 20.82f, 8.59f, +CUBIC_TO, 20.08f, 7.81f, 18.79f, 7.81f, 18.06f, 8.57f, +LINE_TO, 4.58f, 22.44f, +CUBIC_TO, 4.21f, 22.82f, 4, 23.33f, 4, 23.87f, +CUBIC_TO, 4, 24.42f, 4.2f, 24.93f, 4.56f, 25.32f, +LINE_TO, 17.85f, 39.39f, +CUBIC_TO, 18.22f, 39.78f, 18.71f, 40, 19.24f, 40, +CUBIC_TO, 19.75f, 40, 20.24f, 39.79f, 20.61f, 39.41f, +LINE_TO, 23.95f, 35.97f, +LINE_TO, 27.18f, 39.39f, +CUBIC_TO, 27.55f, 39.78f, 28.04f, 40, 28.57f, 40, +CUBIC_TO, 29.09f, 40, 29.58f, 39.79f, 29.94f, 39.41f, +LINE_TO, 43.42f, 25.54f, +CUBIC_TO, 44.18f, 24.76f, 44.19f, 23.46f, 43.44f, 22.66f, +LINE_TO, 43.44f, 22.66f, +LINE_TO, 43.44f, 22.66f, +CLOSE, +MOVE_TO, 13.89f, 24.93f, +LINE_TO, 21.21f, 32.5f, +LINE_TO, 19.26f, 34.46f, +LINE_TO, 8.71f, 23.54f, +LINE_TO, 19.41f, 12.79f, +LINE_TO, 21.27f, 14.71f, +LINE_TO, 13.92f, 22.11f, +CUBIC_TO, 13.54f, 22.49f, 13.34f, 22.98f, 13.33f, 23.52f, +CUBIC_TO, 13.33f, 24.05f, 13.53f, 24.55f, 13.89f, 24.93f, +LINE_TO, 13.89f, 24.93f, +LINE_TO, 13.89f, 24.93f, +CLOSE, +MOVE_TO, 28.59f, 34.46f, +LINE_TO, 26.73f, 32.54f, +LINE_TO, 34.09f, 25.14f, +CUBIC_TO, 34.85f, 24.37f, 34.86f, 23.1f, 34.11f, 22.32f, +LINE_TO, 26.79f, 14.75f, +LINE_TO, 28.74f, 12.79f, +LINE_TO, 39.29f, 23.71f, +LINE_TO, 28.59f, 34.46f, +LINE_TO, 28.59f, 34.46f, +CLOSE, +END
diff --git a/ui/vector_icons/videocam.icon b/ui/vector_icons/videocam.icon new file mode 100644 index 0000000..994e07ed --- /dev/null +++ b/ui/vector_icons/videocam.icon
@@ -0,0 +1,19 @@ +// Copyright 2015 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. + +MOVE_TO, 34, 21, +R_V_LINE_TO, -7, +R_CUBIC_TO, 0, -1.1f, -0.9f, -2, -2, -2, +H_LINE_TO, 8, +R_CUBIC_TO, -1.1f, 0, -2, 0.9f, -2, 2, +R_V_LINE_TO, 20, +R_CUBIC_TO, 0, 1.1f, 0.9f, 2, 2, 2, +R_H_LINE_TO, 24, +R_CUBIC_TO, 1.1f, 0, 2, -0.9f, 2, -2, +R_V_LINE_TO, -7, +R_LINE_TO, 8, 8, +V_LINE_TO, 13, +R_LINE_TO, -8, 8, +CLOSE, +END
diff --git a/ui/vector_icons/warning.icon b/ui/vector_icons/warning.icon new file mode 100644 index 0000000..7a5f4256 --- /dev/null +++ b/ui/vector_icons/warning.icon
@@ -0,0 +1,25 @@ +// Copyright 2015 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. + +MOVE_TO, 2, 42, +R_H_LINE_TO, 44, +LINE_TO, 24, 4, +LINE_TO, 2, 42, +CLOSE, +// Divergence from ic_warning: white fill on the ! portion. +NEW_PATH, +PATH_COLOR_ARGB, 0xFF, 0xFF, 0xFF, 0xFF, +MOVE_TO, 26, 36, +R_H_LINE_TO, -4, +R_V_LINE_TO, -4, +R_H_LINE_TO, 4, +R_V_LINE_TO, 4, +CLOSE, +R_MOVE_TO, 0, -8, +R_H_LINE_TO, -4, +R_V_LINE_TO, -8, +R_H_LINE_TO, 4, +R_V_LINE_TO, 8, +CLOSE, +END