Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(563)

Issue 6823016: Create a VarPrivate interface to contain the scripting helper functions of Var. (Closed)

Created:
9 years, 8 months ago by brettw
Modified:
9 years, 7 months ago
CC:
chromium-reviews, piman+watch_chromium.org, darin-cc_chromium.org
Visibility:
Public.

Description

Create a VarPrivate interface to contain the scripting helper functions of Var. Currently, the old functions are left in Var. When people have a chance to move to this new API, we can delete them from Var. This also adds new enums for ARRAY and DICTIONARY vars, and makes the var C++ wrapper forward-compatible with them by refcounting any enums that it doesn't know about. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=81068

Patch Set 1 #

Patch Set 2 : '' #

Total comments: 11

Patch Set 3 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+166 lines, -402 lines) Patch
M ppapi/c/pp_var.h View 1 2 2 chunks +45 lines, -4 lines 0 comments Download
M ppapi/cpp/dev/scriptable_object_deprecated.h View 1 2 2 chunks +2 lines, -1 line 0 comments Download
A + ppapi/cpp/private/var_private.h View 1 2 5 chunks +35 lines, -128 lines 0 comments Download
A + ppapi/cpp/private/var_private.cc View 6 chunks +45 lines, -250 lines 0 comments Download
M ppapi/cpp/var.h View 1 2 2 chunks +6 lines, -2 lines 0 comments Download
M ppapi/cpp/var.cc View 1 2 2 chunks +2 lines, -5 lines 0 comments Download
M ppapi/example/example.cc View 1 2 6 chunks +13 lines, -12 lines 0 comments Download
M ppapi/ppapi_cpp.gypi View 1 2 1 chunk +4 lines, -0 lines 0 comments Download
M ppapi/proxy/serialized_var.cc View 1 2 2 chunks +10 lines, -0 lines 0 comments Download
M webkit/plugins/ppapi/npapi_glue.cc View 1 2 1 chunk +4 lines, -0 lines 0 comments Download

Messages

Total messages: 5 (0 generated)
brettw
9 years, 8 months ago (2011-04-08 21:42:56 UTC) #1
dmichael(do not use this one)
http://codereview.chromium.org/6823016/diff/2005/ppapi/c/pp_var.h File ppapi/c/pp_var.h (right): http://codereview.chromium.org/6823016/diff/2005/ppapi/c/pp_var.h#newcode30 ppapi/c/pp_var.h:30: * A var with an undefined value. Maybe just ...
9 years, 8 months ago (2011-04-08 22:16:28 UTC) #2
brettw
http://codereview.chromium.org/6823016/diff/2005/ppapi/c/pp_var.h File ppapi/c/pp_var.h (right): http://codereview.chromium.org/6823016/diff/2005/ppapi/c/pp_var.h#newcode75 ppapi/c/pp_var.h:75: PP_VARTYPE_DICTIONARY If we had designed this API without scripting ...
9 years, 8 months ago (2011-04-09 16:41:34 UTC) #3
brettw
New snap up. http://codereview.chromium.org/6823016/diff/2005/ppapi/cpp/private/var_private.h File ppapi/cpp/private/var_private.h (right): http://codereview.chromium.org/6823016/diff/2005/ppapi/cpp/private/var_private.h#newcode28 ppapi/cpp/private/var_private.h:28: VarPrivate(const VarPrivate& other) : Var((const Var&)other) ...
9 years, 8 months ago (2011-04-10 05:08:41 UTC) #4
dmichael (off chromium)
9 years, 8 months ago (2011-04-11 00:09:15 UTC) #5
LGTM

http://codereview.chromium.org/6823016/diff/2005/ppapi/c/pp_var.h
File ppapi/c/pp_var.h (right):

http://codereview.chromium.org/6823016/diff/2005/ppapi/c/pp_var.h#newcode75
ppapi/c/pp_var.h:75: PP_VARTYPE_DICTIONARY
On 2011/04/09 16:41:34, brettw wrote:
> If we had designed this API without scripting from the beginning then it's
quite
> possible we would have come up with a non-refcounting solution.
> 
> It seems like it would be a bad idea to have some vars be refcounted and some
> require a special free function since it would be impossible to know how to do
> any memory management. And given that we have a refcounted API today, I think
> it's not really practical to change (and it's worked pretty well, the C++ API
is
> pretty clean and you don't really have to worry about this stuff).
Thanks for explaining.  I think we may still need some special 'free' function,
because removing a ref count from a dictionary with a cycle back to the root
shouldn't delete it.  So a nice 'delete this whole graph' function may be
worthwhile.  But otherwise, I can live with ref counting.

http://codereview.chromium.org/6823016/diff/2005/ppapi/cpp/private/var_private.h
File ppapi/cpp/private/var_private.h (right):

http://codereview.chromium.org/6823016/diff/2005/ppapi/cpp/private/var_privat...
ppapi/cpp/private/var_private.h:28: VarPrivate(const VarPrivate& other) :
Var((const Var&)other) {}
On 2011/04/10 05:08:41, brettw wrote:
> The conversion constructors are important for the Vars being usable (otherwise
> the scripting API starts looking like:
>   foo.Call(pp::Var("function"), pp::Var(2));
> instead of
>   foo.Call("function", 2);
> 
> I tried sticking NOLINT in and it looked stupid. I'm hoping that this header
> will be used externally, so I'd prefer not to ugly up the header with extra
> stuff to make our code review tool happy.
> 
> BTW The C cast is unnecessary and I removed it (was an experiment I forgot to
> remove).
Makes sense.

Powered by Google App Engine
This is Rietveld 408576698