0
Commit Graph

20 Commits

Author SHA1 Message Date
Sebastien Marchand
6d0558fd10 Include base/bind.h in the files that use it.
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}
2019-01-25 16:49:37 +00:00
Ross McIlroy
d298cced6c [Cleanup] Avoid using deprecated v8::Function::Call in gin unittests.
Also replace deprecated uses of arraysize with base::size(array).

BUG=v8:7290,v8:8238

Change-Id: I1ea89bcc0162e8ac1f530be979511171d53c5467
Reviewed-on: https://chromium-review.googlesource.com/c/1349321
Commit-Queue: Ross McIlroy <rmcilroy@chromium.org>
Reviewed-by: Dan Elphick <delphick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#610627}
2018-11-23 16:14:13 +00:00
Andreas Haas
c0715d308c [cleanup][v8] Replace uses of deprecated API
R=mcilroy@chromium.org

Bug: v8:7295 v8:8015
Change-Id: I5de6e97a1e1ede6da0dc678579685bf5161abd35
Reviewed-on: https://chromium-review.googlesource.com/1237674
Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#595015}
2018-09-28 08:12:17 +00:00
Devlin Cronin
e9db984c7e [Gin] Allow ObjectTemplateBuilder and Wrappable to provide a typename
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}
2018-04-09 17:51:05 +00:00
tzik
6934a31e7f Migrate //gin from base::Callback to base::{Once,Repeating}Callback
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}
2018-03-08 01:03:16 +00:00
Jeremy Roman
eb8a2f1758 [gin] Make Converter<std::vector<T>> return v8::Local if Converter<T> does.
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}
2018-01-29 17:33:40 +00:00
Adam Klein
8a35b5b1fb Remove calls to deprecated v8::Script methods
Bug: v8:7269, v8:7273, v8:7274
Change-Id: If64c08cfeb252a1bc2a09b49c9d9d10d73c4d213
Reviewed-on: https://chromium-review.googlesource.com/865160
Reviewed-by: Jochen Eisinger <jochen@chromium.org>
Commit-Queue: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#529531}
2018-01-17 00:51:00 +00:00
Chris Watkins
756035a7b0 Run clang-tidy modernize-use-equals-{delete,default} on //gin
See the bugs and cxx post for justification and details:
https://groups.google.com/a/chromium.org/forum/#!topic/cxx/RkOHzIK6Tq8

This change was done using clang-tidy as described here:
https://chromium.googlesource.com/chromium/src/+/lkcr/docs/clang_tidy.md

In some cases the the tool leaves behind a string of commas where it
replaced a member initializer list
(https://bugs.llvm.org/show_bug.cgi?id=35051). They were cleaned up with:
  git diff --name-only | \
    xargs sed -E -i 's/(^\s*|\)\s*):[ ,]*= default/\1 = default/'

BUG=778959,778957

Change-Id: Ib4d1680c615407583a6ad72ce51634d2f444db99
Reviewed-on: https://chromium-review.googlesource.com/789742
Reviewed-by: Jeremy Roman <jbroman@chromium.org>
Commit-Queue: Chris Watkins <watk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#520826}
2017-12-01 03:03:27 +00:00
Ken Rockot
2b0f0765ad Prevent gin from recreating wrappers after GC
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}
2017-04-12 20:26:20 +00:00
avi
90e658dde8 Switch to standard integer types in gin/.
BUG=138542
TBR=aa@chromium.org
Switch to standard integer types in gin/.

BUG=138542
TBR=aa@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#366345}
2015-12-21 07:17:28 +00:00
bashi
dbd2ef9bb1 Re-land: gin: Use V8 Maybe APIs
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}
2015-06-02 01:40:55 +00:00
bashi
b76f78b6c8 Revert of gin: Use V8 Maybe APIs (patchset id:160001 of https://codereview.chromium.org/1106393002/)
Reason for revert:
Broke layout tests

Original issue's description:
> gin: Use V8 Maybe APIs
>
> TEST=gin_unittests
> BUG=479439
>
> Committed: https://crrev.com/7a6acf6c7d45e24f07781c69249d90967013bbe4
> Cr-Commit-Position: refs/heads/master@{#331923}

TBR=jochen@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=479439

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

Cr-Commit-Position: refs/heads/master@{#331930}
2015-05-29 06:54:34 +00:00
bashi
7a6acf6c7d gin: Use V8 Maybe APIs
TEST=gin_unittests
BUG=479439

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

Cr-Commit-Position: refs/heads/master@{#331923}
2015-05-29 04:06:44 +00:00
deepak.s
faaa1b6a47 Replace Handle<> with Local in remaining gin/*
Handle is an alias for Local

BUG=424445

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

Cr-Commit-Position: refs/heads/master@{#327672}
2015-04-30 07:31:17 +00:00
dcarney
36f78b64fc replace to be deprecated v8::PersistentValueMap with v8::GlobalValueMap
R=jochen@chromium.org
TBR=kalman@chromium.org
BUG=

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

Cr-Commit-Position: refs/heads/master@{#326766}
2015-04-24 10:22:58 +00:00
dcheng
074c039593 Standardize usage of virtual/override/final in gin/
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}
2014-10-23 19:09:19 +00:00
anujk.sharma
e548191bdc Replacing the OVERRIDE with override and FINAL with final in /src/gin
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}
2014-10-06 11:24:33 +00:00
jochen@chromium.org
d656f872a5 [gin] Allow interceptors to signal whether a they intercepted something
TEST=InterceptorTest.BypassInterceptor*
R=abarth@chromium.org,raymes@chromium.org
BUG=none

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

Cr-Commit-Position: refs/heads/master@{#289325}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@289325 0039d316-1c4b-4281-b951-d872f2087c98
2014-08-13 17:14:32 +00:00
jochen@chromium.org
dda52e48bf Add a function template cache to the interceptor unittest
The unittest also serves as an example how to use the interceptor API.

BUG=none
R=abarth@chromium.org,raymes@chromium.org

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@280350 0039d316-1c4b-4281-b951-d872f2087c98
2014-06-27 17:08:16 +00:00
jochen@chromium.org
5c969b88b4 gin: Add the concept of named and indexed interceptors.
This will allow for using gin as a drop-in replacement for NPObject.

BUG=347565
R=abarth@chromium.org,dcarney@chromium.org,aa@chromium.org

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@256431 0039d316-1c4b-4281-b951-d872f2087c98
2014-03-12 04:59:05 +00:00