This also adds it to the whitelist used in
third_party/blink/renderer/DEPS
Gab/Francois, I've used your refactoring script for this, the rule is:
matches = re.compile(r'(\n *[^/\n][^/\n]*base::Bind(Once|Repeating)?\b[^*])', re.DOTALL).findall(content)
if not matches:
return False
updated_content = refactor_lib.AddInclude(file_path, content, "base/bind.h")
if updated_content == content:
return False
# Write updated file
refactor_lib.WriteFile(file_path, updated_content)
TBR=fdoray@chromium.org
Change-Id: I7a9a991255a560c6ebedaade47cffe1ac1c7baff
Reviewed-on: https://chromium-review.googlesource.com/c/1437069
Commit-Queue: Sébastien Marchand <sebmarchand@chromium.org>
Reviewed-by: François Doray <fdoray@chromium.org>
Cr-Commit-Position: refs/heads/master@{#626098}
ObjectTemplateBuilder (and Wrappable) allow setting functions that are
exposed in JS and then forwarded to the type in C++. If these are C++
member functions, the context object is retrieved by looking at the
this-object in JavaScript, and trying to convert that to the underlying
C++ type (which will succeed if it was called on the V8 object created
by the Wrappable).
However, these member functions will fail if the JS function is called
on an improper this-object (including null and undefined). This means
that doing things like:
var obj = getObj(); // Some object from a Wrappable
var doFoo = obj.doFoo;
doFoo();
will fail because it's applied on an invalid this-object (undefined),
and the conversion will fail. This makes sense, but unfortunatley the
error gin throws in this case is unhelpful:
"Uncaught TypeError: Error processing argument at index -1, conversion
failure from undefined"
Instead, allow Wrappables and ObjectTemplateBuilders to specify a type
name, which will be surfaced in these errors to provide guidance to
developers. Update the error message to either include the type name or
to match the error message used in similar circumstances in blink
("Illegal invocation").
The new error messages will only be shown for failures in converting to
the context object, not for failure to convert subsequent arguments.
Bug: <File One>
Change-Id: I515a17e92992bfcb709b97455b9167b350e931f2
Reviewed-on: https://chromium-review.googlesource.com/987304
Commit-Queue: Devlin <rdevlin.cronin@chromium.org>
Reviewed-by: Jeremy Roman <jbroman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#549219}
This updates //gin to use base::OnceCallback or base::RepeatingCallback
instead of legacy base::Callback. No intended functional change is included.
This reduces the number of 'base::Bind' in //gin from 8 to 1
as tracked at http://goo.gl/LUVhDj
Bug: 714018
Change-Id: I5c4bb758181c09e2d7b0e2fec5c51a4e1eec24bb
Reviewed-on: https://chromium-review.googlesource.com/952646
Reviewed-by: Jeremy Roman <jbroman@chromium.org>
Commit-Queue: Taiju Tsuiki <tzik@chromium.org>
Cr-Commit-Position: refs/heads/master@{#541664}
For consistency between the methods, have all converters take v8::Isolate*,
as all of the ones that presently take v8::Local<v8::Context> implicitly
assume it to be the current context anyhow.
Bug: None
Change-Id: I565fb54bdc7a1d5ac1796ef5d7c1c69ca83290bb
Reviewed-on: https://chromium-review.googlesource.com/876563
Commit-Queue: Jeremy Roman <jbroman@chromium.org>
Reviewed-by: Devlin <rdevlin.cronin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#532473}
This changes gin::Wrappable to track its cleanup
state in order to prevent async operations from
recreating a wrapper between first and second weak
callbacks.
GetWrapper is changed to return a MaybeLocal,
and callers are updated accordingly; checking
in some cases and failing gracefully in others.
Mojo JS's WaitingCallback is changed to silently
ignore handle notifications if its wrapper is
no longer alive.
BUG=707689
Change-Id: I3fc11a24209f0ef35bfa18556f5734c4b18ae229
Reviewed-on: https://chromium-review.googlesource.com/475077
Commit-Queue: Ken Rockot <rockot@chromium.org>
Reviewed-by: Jochen Eisinger <jochen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#464134}
The previous CL was reverted because it broke layout tests.
Cause:
GetKeyModifiersFromV8() in test_runner/event_sender.cc passes
NULL as v8::Isolate*, which is cleary wrong. Pass
blink::mainThreadIsolate() as the other callsites do.
BUG=479439
Review URL: https://codereview.chromium.org/1152653004
Cr-Commit-Position: refs/heads/master@{#332312}
The Google C++ style guide states:
Explicitly annotate overrides of virtual functions or virtual
destructors with an override or (less frequently) final specifier.
Older (pre-C++11) code will use the virtual keyword as an inferior
alternative annotation. For clarity, use exactly one of override,
final, or virtual when declaring an override.
To better conform to these guidelines, the following constructs have
been rewritten:
- if a base class has a virtual destructor, then:
virtual ~Foo(); -> ~Foo() override;
- virtual void Foo() override; -> void Foo() override;
- virtual void Foo() override final; -> void Foo() final;
This patch was automatically generated. The clang plugin can generate
fixit hints, which are suggested edits when it is 100% sure it knows how
to fix a problem. The hints from the clang plugin were applied to the
source tree using the tool in https://codereview.chromium.org/598073004.
BUG=417463
R=abarth@chromium.org
Review URL: https://codereview.chromium.org/645853012
Cr-Commit-Position: refs/heads/master@{#300925}
This step is a giant search and replace for OVERRIDE and FINAL to
replace them with their lowercase versions.
BUG=417463
Review URL: https://codereview.chromium.org/629153002
Cr-Commit-Position: refs/heads/master@{#298220}