0
Commit Graph

37 Commits

Author SHA1 Message Date
Peter Kasting
e8b56394f1 Deprecate DISALLOW_xxx and add Dos-And-Don'ts guidance around it.
Bug: 1010217
Change-Id: Iaa1d73bfec3522db08d04bedeb59603e16c8ffe0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1895857
Auto-Submit: Peter Kasting <pkasting@chromium.org>
Reviewed-by: danakj <danakj@chromium.org>
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#711900}
2019-11-01 22:26:01 +00:00
Avi Drissman
72b4cbab5a Remove arraysize.
BUG=837308

Change-Id: I91071794afd9915486548196ae09831c7093664b
Reviewed-on: https://chromium-review.googlesource.com/c/1390417
Reviewed-by: Scott Violet <sky@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#621760}
2019-01-10 21:54:23 +00:00
Lei Zhang
1e78585880 Remove __mips32__ and __mips64__ defines from base/macros.h.
BUG=882085

Change-Id: I07243c03a28a45f3d368269668b54eadc0b50e98
Reviewed-on: https://chromium-review.googlesource.com/c/1362223
Reviewed-by: Chris Palmer <palmer@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#618650}
2018-12-21 22:58:50 +00:00
Avi Drissman
94ea9d34dd Remove CR_DEFINE_STATIC_LOCAL.
BUG=893317

Cq-Include-Trybots: luci.chromium.try:ios-simulator-cronet;luci.chromium.try:ios-simulator-full-configs;luci.chromium.try:win_optional_gpu_tests_rel
Change-Id: I8920fd240a55a32ee5dd27e049cc528193644dcf
Reviewed-on: https://chromium-review.googlesource.com/c/1273809
Commit-Queue: Avi Drissman <avi@chromium.org>
Reviewed-by: Sami Kyöstilä <skyostil@chromium.org>
Reviewed-by: Sylvain Defresne <sdefresne@chromium.org>
Reviewed-by: Mitsuru Oshima <oshima@chromium.org>
Reviewed-by: Wei Li <weili@chromium.org>
Reviewed-by: Reilly Grant <reillyg@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Ken Rockot <rockot@chromium.org>
Reviewed-by: Bo <boliu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#599267}
2018-10-12 17:23:59 +00:00
Avi Drissman
b00a9e7e3d Remove an MSVC-required macro.
BUG=none

Change-Id: I118976f80f3c605f7b2c5cb05e8b60278fded19d
Reviewed-on: https://chromium-review.googlesource.com/c/1272495
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Alexei Svitkine <asvitkine@chromium.org>
Reviewed-by: Nico Weber <thakis@chromium.org>
Commit-Queue: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#599047}
2018-10-12 01:01:56 +00:00
Avi Drissman
04b5b4fdee Link removal of CR_DEFINE_STATIC_LOCAL to a bug.
BUG=893317

Change-Id: I05774ba71205167bc4f49cbdca750039ad59a009
Reviewed-on: https://chromium-review.googlesource.com/c/1269556
Reviewed-by: Albert J. Wong <ajwong@chromium.org>
Commit-Queue: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#597764}
2018-10-09 01:18:09 +00:00
jdoerrie
d7d10ab898 [base] Deprecate arraysize in favor of base::size(array)
This change deprecates arraysize in favor of base::size(array) and adds
a corresponding PRESUBMIT warning to discourage further usage.

Bug: 837308
Change-Id: Iedd676f691cb46ca4a108462cedefbe91690240b
Reviewed-on: https://chromium-review.googlesource.com/1030333
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Jan Wilken Dörrie <jdoerrie@chromium.org>
Cr-Commit-Position: refs/heads/master@{#554351}
2018-04-27 10:46:13 +00:00
Daniel Cheng
cda1df5bb8 Improve mojo enum quality-of-life for UMAs and legacy IPC.
Rather than forcing enums to define a kMaxValue enumerator and
manually update it, just automatically generate it for mojo
enums. kMaxValue shares the value of the highest enumerator:
this is done to avoid switch statements having to handle useless
sentinel values.

However, since the UMA histogram macros for enums require that
the boundary is 1 greater than the highest legal value, also
add a new helper that automatically calculate boundary based on
the existence of Enum::kMaxValue to avoid awkward static_casts
to int and then back to the enum type.

Bug: 742517
Tbr: sky@chromium.org
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_mojo
Change-Id: I84b1985c9d93b6ca7576947936f3dc9cd9ec22c8
Reviewed-on: https://chromium-review.googlesource.com/982944
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Dominic Mazzoni <dmazzoni@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Reviewed-by: Alexei Svitkine <asvitkine@chromium.org>
Reviewed-by: Ken Rockot <rockot@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#547276}
2018-03-30 21:30:16 +00:00
Daniel Cheng
73999fe67f Add base::NoDestructor<T>.
This is simlar to base::LazyInstance<T>::Leaky but intended for use in
function-local scope.

This is intended to be a drop-in replacement for:
- CR_DEFINE_STATIC_LOCAL(...); in function scope
- static T* x = new X; in function scope
- static T& x = *new X; in function scope
- base::LazyInstance<T> x; in global scope
and should be preferred in new code.

Change-Id: I75eda47e7dca8205f4086bd298839c261454a3e7
Reviewed-on: https://chromium-review.googlesource.com/869351
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: danakj <danakj@chromium.org>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#530361}
2018-01-19 00:28:15 +00:00
Nico Weber
c5bbb48108 remove static initializer and exit-time destructor from aw_contents.cc
no intended behavior change.

Bug: 94925
Change-Id: Ic8851094ab7f851c3fffdf515502c5e89cefccf4
Reviewed-on: https://chromium-review.googlesource.com/719159
Commit-Queue: Nico Weber <thakis@chromium.org>
Reviewed-by: Richard Coles <torne@chromium.org>
Cr-Commit-Position: refs/heads/master@{#508938}
2017-10-14 15:55:31 +00:00
Gordana Cmiljanovic
2d4aa3a485 Fix __mips64__ macro redefinition
This fixes macro redefinition introduced by:
https://chromium-review.googlesource.com/c/chromium/src/+/571385

Bug: 742738, 766913
Change-Id: Ie2583e3069da939b73208c92ba7c574417ece1af
Reviewed-on: https://chromium-review.googlesource.com/673185
Reviewed-by: Chris Palmer <palmer@chromium.org>
Reviewed-by: Frank Barchard <fbarchard@google.com>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#503731}
2017-09-22 14:25:18 +00:00
Wang Qing
534d7ce2af Add support for using seccomp_bpf on mips64el.
Currently, seccomp_bpf is not supported on mips64el, and the build 
configuration sets use_seccomp_bpf=false on mips64el. This CL adds support
for seccomp-bpf on mips64el, and resolves many compiler errors when
compiling on mips64el.

R= machenbach@chromium.org, brettw@chromium.org
TBR=jorgelo

Bug: 742738
Change-Id: I79c5d1800c0a198a70c1f19a818885b726cbcc4f
Reviewed-on: https://chromium-review.googlesource.com/571385
Reviewed-by: Chris Palmer <palmer@chromium.org>
Reviewed-by: Brett Wilson <brettw@chromium.org>
Commit-Queue: Chris Palmer <palmer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#502712}
2017-09-18 23:35:59 +00:00
Lei Zhang
46df67b790 Remove base::LinkerInitialized.
Nobody is using it, and those that want to are defining their own to
avoid needing a constructor.

Change-Id: I2cc723fc4f432186bc6cd7130637df9705be8908
Reviewed-on: https://chromium-review.googlesource.com/645007
Reviewed-by: Scott Graham <scottmg@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#499758}
2017-09-05 21:54:09 +00:00
Clemens Hammacher
cec5fdea18 [base] Fix macros and comments for C++11
Since the DISALLOW_* macros now use the C++11 syntax "= delete", it
does not matter whether they are used in the public or the private
section of a class definition.
In fact, the style guide recomments putting deleted constructors or
assignment operators in the public section.
Thus, remove the hint to put them in the private: declarations.

Drive-by: Fix the syntax of the deleted copy assignment operator.

R=thakis@chromium.org

Change-Id: I10af0d71c18dc1f3b08e4601ae571ed53d8c71e3
Reviewed-on: https://chromium-review.googlesource.com/578027
Reviewed-by: Nico Weber <thakis@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#488172}
2017-07-20 08:53:16 +00:00
pkasting
4bca3e6c23 Implement DISALLOW_COPY_AND_ASSIGN using =delete, stage three.
This enables the new implementation all the time.

BUG=447156
TEST=none
TBR=thakis

Review-Url: https://codereview.chromium.org/2017213002
Cr-Commit-Position: refs/heads/master@{#396628}
2016-05-28 02:35:27 +00:00
pkasting
bdc5de3268 Implement DISALLOW_COPY_AND_ASSIGN using =delete, stage two.
This enables the new implementation on all platforms, but only for non-branded
builds.  Since the CQ doesn't include these by default, the chance of breaking
them is greater.

Stage three will be to enable this all the time.

BUG=447156
TEST=none
TBR=thakis

Review-Url: https://codereview.chromium.org/2017813002
Cr-Commit-Position: refs/heads/master@{#396380}
2016-05-27 04:35:52 +00:00
pkasting
999f15f718 Implement DISALLOW_COPY_AND_ASSIGN using =delete for Linux only.
This lands the new implementation for only (non-CrOS) Linux.  Hopefully this
will prevent regressions in cross-platform code while other platforms are
brought up.

BUG=447156
TEST=none

Review-Url: https://codereview.chromium.org/2006733006
Cr-Commit-Position: refs/heads/master@{#396295}
2016-05-26 22:04:54 +00:00
hajimehoshi
449883eb67 Revert of Implement DISALLOW_COPY_AND_ASSIGN using = delete. (patchset id:540001 of https://codereview.chromium.org/1981053002/ )
Reason for revert:
This causes compile errors on some bots (e.g. https://build.chromium.org/p/chromium.chromiumos/buildstatus?builder=Linux%20ChromiumOS%20Builder&number=40216)

Original issue's description:
> Implement DISALLOW_COPY_AND_ASSIGN using = delete.
>
> BUG=447156
> TEST=none
> CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel
> TBR=rdevlin.cronin
>
> Committed: https://crrev.com/16afbf1fd62d6d4d4cf34c148333bd5b7aaf997f
> Cr-Commit-Position: refs/heads/master@{#395814}

TBR=thakis@chromium.org,hcarmona@chromium.org,lazyboy@chromium.org,rdevlin.cronin@chromium.org,pkasting@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=447156

Review-Url: https://codereview.chromium.org/2009783002
Cr-Commit-Position: refs/heads/master@{#395825}
2016-05-25 07:46:26 +00:00
pkasting
16afbf1fd6 Implement DISALLOW_COPY_AND_ASSIGN using = delete.
BUG=447156
TEST=none
CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel
TBR=rdevlin.cronin

Review-Url: https://codereview.chromium.org/1981053002
Cr-Commit-Position: refs/heads/master@{#395814}
2016-05-25 06:28:58 +00:00
dcheng
093de9b30c Convert //base to use std::unique_ptr
With bonus IWYU fixes that weren't caught by local android gn, cros gn,
linux gn, mac gyp, and win gyp builds.

BUG=554298
TBR=brettw@chromium.org

Review URL: https://codereview.chromium.org/1852433005

Cr-Commit-Position: refs/heads/master@{#385011}
2016-04-04 21:27:51 +00:00
tapted
174fde3325 Move bit_cast from base/macros.h to its own header
There isn't much that uses bit_cast. bit_cast requires memcpy which
requires <string.h>

On Mac, <string.h> includes AvailabilityInternal.h which is half a
megabyte and defines dozens of macros. Providing <string.h> in
base/macros.h also tempts IWYU violations. Try to avoid it.

Add base/bit_cast.h and include it from the 17 files that need it. Then
remove the <string.h> #include from base/macros.h and IWYU.

BUG=395001

Review URL: https://codereview.chromium.org/399313006

Cr-Commit-Position: refs/heads/master@{#369348}
2016-01-14 06:28:13 +00:00
avi
9b6f42934e Switch to standard integer types in base/.
BUG=138542
TBR=mark@chromium.org
NOPRESUBMIT=true

Review URL: https://codereview.chromium.org/1538743002

Cr-Commit-Position: refs/heads/master@{#366910}
2015-12-26 22:16:15 +00:00
tnagel
aeb6648f17 Add a web reference to arraysize() macro docs.
BUG=none

Review URL: https://codereview.chromium.org/1534763002

Cr-Commit-Position: refs/heads/master@{#365990}
2015-12-18 02:29:20 +00:00
thakis
e02e02604b Remove DISALLOW_EVIL_CONSTRUCTORS
Looks like nothing needs it anymore, everything uses the
DISALLOW_COPY_AND_ASSIGN spelling these days.

No behavior change.

BUG=none
NOTRY=true

Review URL: https://codereview.chromium.org/1499933002

Cr-Commit-Position: refs/heads/master@{#363223}
2015-12-04 16:27:16 +00:00
avi
7c021364e9 Remove COMPILE_ASSERT.
BUG=442514

Review URL: https://codereview.chromium.org/1472023003

Cr-Commit-Position: refs/heads/master@{#361602}
2015-11-25 07:43:31 +00:00
avi
4ec0dffe9e Switch to static_assert in base/.
BUG=442514

Review URL: https://codereview.chromium.org/1467003002

Cr-Commit-Position: refs/heads/master@{#361337}
2015-11-24 14:27:16 +00:00
danakj
a5f0d96bc4 Remove base's implicit_cast.
There's no momentum on making this a thing in the C++ standard. We
should have less magic that is non-standard in base.

R=ricea@chromium.org, thakis@chromium.org, vmpstr
BUG=529769

Review URL: https://codereview.chromium.org/1340683002

Cr-Commit-Position: refs/heads/master@{#348978}
2015-09-15 20:28:00 +00:00
mlamouri
8cd0029ed0 Use "= delete" for DISALLOW_IMPLICIT_CONSTRUCTORS.
This will guarantee the error to be at compile time, and not rely on
the call visibility (private).

This is part of a three-sided CL:
1. https://codereview.chromium.org/1211403004
2. <this>
3. https://codereview.chromium.org/1222143003

BUG=447156

Review URL: https://codereview.chromium.org/1212403003

Cr-Commit-Position: refs/heads/master@{#337298}
2015-07-03 10:28:30 +00:00
mlamouri
a99741d56b Use "= delete" for DISALLOW_COPY and DISALLOW_ASSIGN.
This will guarantee the error to be at compile time, and not rely on
the call visibility (private).

DISALLOW_COPY_AND_ASSIGN and DISSALOW_IMPLICIT_CONSTRUCTORS can't be
changed yet because they are redefine in different place in the code
base.

BUG=447156

Review URL: https://codereview.chromium.org/1151443003

Cr-Commit-Position: refs/heads/master@{#331017}
2015-05-21 22:55:37 +00:00
tfarina
2e252345d4 base: Remove gcc and msvs workaround limitations for arraysize template magic.
Mike (mtklein) built this simplified version when doing https://codereview.chromium.org/1114283003/.

TEST=trybots seems happy
R=danakj@chromium.org

Review URL: https://codereview.chromium.org/1115993004

Cr-Commit-Position: refs/heads/master@{#328904}
2015-05-08 02:15:45 +00:00
qsr
6d0be449b4 Fully qualify usage of ArraySizeHelper to prevent conflict.
mojo redefines ArraySizeHelper in the mojo namespace. When arraysize is used
in the mojo namespace, with both version in scope, the compiler, on android, is complaining that the reference is
not unique. To prevent this, qualify the usage of ArraySizeHelper in
base/macros.h

Review URL: https://codereview.chromium.org/804023002

Cr-Commit-Position: refs/heads/master@{#315290}
2015-02-09 13:53:16 +00:00
pkasting
5cd8444c9a Remove #include of compiler_specific.h from macros.h.
Include it directly in files which want it.

BUG=none
TEST=none

Review URL: https://codereview.chromium.org/733763003

Cr-Commit-Position: refs/heads/master@{#305137}
2014-11-21 01:38:17 +00:00
Viet-Trung Luu
59602fb678 Delete ARRAYSIZE_UNSAFE (from base/macros.h).
R=thestig@chromium.org
BUG=423134

Review URL: https://codereview.chromium.org/664743003

Cr-Commit-Position: refs/heads/master@{#300417}
2014-10-21 03:56:06 +00:00
viettrungluu
fbe886d379 Don't define ARRAYSIZE_UNSAFE except in Blink.
(We want to remove it, but there are currently some uses in Blink. We
can stop it from reappearing in Chromium.)

R=thestig@chromium.org
BUG=423134

Review URL: https://codereview.chromium.org/647433004

Cr-Commit-Position: refs/heads/master@{#300184}
2014-10-17 22:53:19 +00:00
viettrungluu
eb552d78ea Make ARRAYSIZE_UNSAFE() just use arraysize().
For every two problems that C++11 causes, it fixes at least one.

R=thestig@chromium.org,tsepez@chromium.org
BUG=423134

Review URL: https://codereview.chromium.org/647753003

Cr-Commit-Position: refs/heads/master@{#299419}
2014-10-14 01:40:19 +00:00
Nico Weber
83ea589954 Use a better c++11 readiness check.
This is like https://codereview.chromium.org/443483002/ , but that check wasn't
as convincing as it could have been since clang accepts override and final as
an extension in c++98 mode. No intended behavior change.

If your bot can't deal with this, please let me know!

BUG=none
R=viettrungluu@chromium.org

Review URL: https://codereview.chromium.org/555383004

Cr-Commit-Position: refs/heads/master@{#295128}
2014-09-16 19:43:56 +00:00
viettrungluu@chromium.org
a1683a1fa2 Split macros, etc. from base/basictypes.h into base/macros.h.
Document the old-school types as deprecated, now that we use stdint.h
everywhere.

R=brettw@chromium.org
BUG=138542

Review URL: https://codereview.chromium.org/127293002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@243653 0039d316-1c4b-4281-b951-d872f2087c98
2014-01-08 21:38:30 +00:00