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

Issue 9117015: Add functions to list library and script urls in an isolate. (Closed)

Created:
8 years, 11 months ago by hausner
Modified:
8 years, 11 months ago
Reviewers:
siva
CC:
reviews_dartlang.org, Anton Muhin, pavel.podivilov
Visibility:
Public.

Description

Add functions to list library and script urls in an isolate. Committed: https://code.google.com/p/dart/source/detail?r=3571

Patch Set 1 #

Patch Set 2 : '' #

Patch Set 3 : '' #

Total comments: 20
Unified diffs Side-by-side diffs Delta from patch set Stats (+224 lines, -29 lines) Patch
M runtime/include/dart_debugger_api.h View 1 2 1 chunk +35 lines, -0 lines 2 comments Download
M runtime/vm/debugger_api_impl.cc View 1 2 2 chunks +81 lines, -0 lines 10 comments Download
M runtime/vm/debugger_api_impl_test.cc View 1 2 1 chunk +33 lines, -0 lines 4 comments Download
M runtime/vm/object.h View 2 chunks +2 lines, -0 lines 0 comments Download
M runtime/vm/object.cc View 3 chunks +72 lines, -29 lines 4 comments Download
M runtime/vm/raw_object.h View 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 3 (0 generated)
hausner
8 years, 11 months ago (2012-01-24 00:26:30 UTC) #1
siva
LGTM with some comments. http://codereview.chromium.org/9117015/diff/2010/runtime/include/dart_debugger_api.h File runtime/include/dart_debugger_api.h (right): http://codereview.chromium.org/9117015/diff/2010/runtime/include/dart_debugger_api.h#newcode44 runtime/include/dart_debugger_api.h:44: * Returns a a string ...
8 years, 11 months ago (2012-01-24 18:37:13 UTC) #2
hausner
8 years, 11 months ago (2012-01-24 21:34:42 UTC) #3
Thank you.

http://codereview.chromium.org/9117015/diff/2010/runtime/include/dart_debugge...
File runtime/include/dart_debugger_api.h (right):

http://codereview.chromium.org/9117015/diff/2010/runtime/include/dart_debugge...
runtime/include/dart_debugger_api.h:44: * Returns a a string containing the
source code of the given script
On 2012/01/24 18:37:14, asiva wrote:
> a a

Done.

http://codereview.chromium.org/9117015/diff/2010/runtime/vm/debugger_api_impl.cc
File runtime/vm/debugger_api_impl.cc (right):

http://codereview.chromium.org/9117015/diff/2010/runtime/vm/debugger_api_impl...
runtime/vm/debugger_api_impl.cc:266: intptr_t num_scripts =
loaded_scripts.Length();
On 2012/01/24 18:37:14, asiva wrote:
> Move this line up and using num_scripts for creating the list?

Done.

http://codereview.chromium.org/9117015/diff/2010/runtime/vm/debugger_api_impl...
runtime/vm/debugger_api_impl.cc:270: const String& url =
String::Handle(script.url());
On 2012/01/24 18:37:14, asiva wrote:
> This handle could be allocated outside the loop.
Ah yes.

http://codereview.chromium.org/9117015/diff/2010/runtime/vm/debugger_api_impl...
runtime/vm/debugger_api_impl.cc:271: Dart_ListSetAt(script_list, i,
Api::NewLocalHandle(url));
On 2012/01/24 18:37:14, asiva wrote:
> Do we have to create the List using the API functions?
> We could just create the list as Array::New(...)
> set all the elements using SetAt(...) would avoid the need of doing a
> Api::NewLocalHandle for each url.
> 
> At the end of the loop we could return as
> return Api::NewLocalHandle(...);
Seems to work. Good tip.

http://codereview.chromium.org/9117015/diff/2010/runtime/vm/debugger_api_impl...
runtime/vm/debugger_api_impl.cc:296: const String& lib_url =
String::Handle(lib.url());
On 2012/01/24 18:37:14, asiva wrote:
> This handle could be created outside the loop?

Done.

http://codereview.chromium.org/9117015/diff/2010/runtime/vm/debugger_api_impl...
runtime/vm/debugger_api_impl.cc:297: Dart_ListSetAt(library_list, i,
Api::NewLocalHandle(lib_url));
On 2012/01/24 18:37:14, asiva wrote:
> Ditto comment about creating the list using API functions instead of using
> Array::New(...).

Done.

http://codereview.chromium.org/9117015/diff/2010/runtime/vm/debugger_api_impl...
File runtime/vm/debugger_api_impl_test.cc (right):

http://codereview.chromium.org/9117015/diff/2010/runtime/vm/debugger_api_impl...
runtime/vm/debugger_api_impl_test.cc:206: printf("Lib %d: %s\n", i, chars);
On 2012/01/24 18:37:14, asiva wrote:
> instead of printf would it make sense to do an EXPECT_STREQ(..)

Yes, if I knew what the expected library names are, and in which order they get
enumerated. I think the test would become too fragile if I baked in these
details.  As it is now, I can use this test as a sanity check by running it
manually and checking the output.

http://codereview.chromium.org/9117015/diff/2010/runtime/vm/debugger_api_impl...
runtime/vm/debugger_api_impl_test.cc:217: printf("  script %d: '%s'\n", i + 1,
chars);
On 2012/01/24 18:37:14, asiva wrote:
> Ditto.

Ditto regarding script urls.

http://codereview.chromium.org/9117015/diff/2010/runtime/vm/object.cc
File runtime/vm/object.cc (right):

http://codereview.chromium.org/9117015/diff/2010/runtime/vm/object.cc#newcode...
runtime/vm/object.cc:4051: }
On 2012/01/24 18:37:14, asiva wrote:
> Should this be an assertion that loaded_scripts should always be null over
here?
See comment below.

http://codereview.chromium.org/9117015/diff/2010/runtime/vm/object.cc#newcode...
runtime/vm/object.cc:4064: // cached in loaded_scripts_.
On 2012/01/24 18:37:14, asiva wrote:
> Should we assert that this should be called only after class finalization is
> done.

I had an assert at first that made sure this is only called when the library is
in load_state_ == RawLibrary::kLoaded. The assert fired for the core libraries,
though.

Rather than figuring out why the core libs are not considered kLoaded, I made
this function more flexible by invalidating the cache whenever anything is
loaded. In all practical sense, I never expect this cache to be invalidated
though.

Powered by Google App Engine
This is Rietveld 408576698