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

Issue 8334009: Use the distinguished class, ApiFailure, to signal when a Dart_Result is (Closed)

Created:
9 years, 2 months ago by turnidge
Modified:
9 years, 2 months ago
Reviewers:
Ivan Posva
CC:
reviews_dartlang.org, vm-dev_dartlang.org
Visibility:
Public.

Description

Use the distinguished class, ApiFailure, to signal when a Dart_Result is invalid. We eventually plan to drop the Dart_Result type entirely, but this change allows us to try out the functionality before we munge the user-visible api. Committed: https://code.google.com/p/dart/source/detail?r=566

Patch Set 1 #

Total comments: 14

Patch Set 2 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+153 lines, -24 lines) Patch
M runtime/include/dart_api.h View 1 4 chunks +4 lines, -16 lines 0 comments Download
M runtime/vm/dart_api_impl.cc View 1 3 chunks +55 lines, -8 lines 0 comments Download
M runtime/vm/object.h View 1 4 chunks +25 lines, -0 lines 0 comments Download
M runtime/vm/object.cc View 1 6 chunks +33 lines, -0 lines 0 comments Download
M runtime/vm/raw_object.h View 1 2 chunks +14 lines, -0 lines 0 comments Download
M runtime/vm/raw_object.cc View 1 1 chunk +7 lines, -0 lines 0 comments Download
M runtime/vm/raw_object_snapshot.cc View 1 1 chunk +15 lines, -0 lines 0 comments Download

Messages

Total messages: 3 (0 generated)
turnidge
9 years, 2 months ago (2011-10-18 03:23:54 UTC) #1
Ivan Posva
LGTM with comments. -Ivan http://codereview.chromium.org/8334009/diff/1/runtime/vm/dart_api_impl.cc File runtime/vm/dart_api_impl.cc (right): http://codereview.chromium.org/8334009/diff/1/runtime/vm/dart_api_impl.cc#newcode31 runtime/vm/dart_api_impl.cc:31: assert(Isolate::Current() != NULL); ASSERT http://codereview.chromium.org/8334009/diff/1/runtime/vm/dart_api_impl.cc#newcode45 ...
9 years, 2 months ago (2011-10-18 20:44:27 UTC) #2
turnidge
9 years, 2 months ago (2011-10-18 22:03:12 UTC) #3
http://codereview.chromium.org/8334009/diff/1/runtime/vm/dart_api_impl.cc
File runtime/vm/dart_api_impl.cc (right):

http://codereview.chromium.org/8334009/diff/1/runtime/vm/dart_api_impl.cc#new...
runtime/vm/dart_api_impl.cc:31: assert(Isolate::Current() != NULL);
On 2011/10/18 20:44:28, Ivan Posva wrote:
> ASSERT

Done.

http://codereview.chromium.org/8334009/diff/1/runtime/vm/dart_api_impl.cc#new...
runtime/vm/dart_api_impl.cc:45: assert(Isolate::Current() != NULL);
On 2011/10/18 20:44:28, Ivan Posva wrote:
> ditto

Done.

http://codereview.chromium.org/8334009/diff/1/runtime/vm/dart_api_impl.cc#new...
runtime/vm/dart_api_impl.cc:50:
ApiFailure::CheckedHandle(Api::UnwrapHandle(result.retval_.obj_value));
On 2011/10/18 20:44:28, Ivan Posva wrote:
> If the result does not contain an ApiFailure object we will fail here and
abort.
> Is that really what we want?

Well, it's potentially inconsistent as it currently stands.  If somebody calls
Dart_GetErrrorCString when the Dart_Result contains an int, the ASSERT above
will fire -- why should we not fail if they also try to get the error string
from a non-error reference?

That said, once all results are handles, this inconsistency will go away, so I
will make it more resilient.

http://codereview.chromium.org/8334009/diff/1/runtime/vm/dart_api_impl.cc#new...
runtime/vm/dart_api_impl.cc:61: assert(Isolate::Current() != NULL);
On 2011/10/18 20:44:28, Ivan Posva wrote:
> ditto

Done.

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

http://codereview.chromium.org/8334009/diff/1/runtime/vm/object.cc#newcode18
runtime/vm/object.cc:18: #include "vm/dart_api_impl.h"
On 2011/10/18 20:44:28, Ivan Posva wrote:
> Is this still needed?

Removed.

http://codereview.chromium.org/8334009/diff/1/runtime/vm/object.cc#newcode4337
runtime/vm/object.cc:4337: Heap::Space space) {
On 2011/10/18 20:44:28, Ivan Posva wrote:
> Is a new line needed here?

Removed.

http://codereview.chromium.org/8334009/diff/1/runtime/vm/object.cc#newcode4360
runtime/vm/object.cc:4360: 
On 2011/10/18 20:44:28, Ivan Posva wrote:
> new line

Done.

Powered by Google App Engine
This is Rietveld 408576698