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

Issue 15018011: dart:io | Add FileSystemEntity.stat() and FileStat class. (Closed)

Created:
7 years, 7 months ago by Bill Hesse
Modified:
7 years, 7 months ago
Reviewers:
Søren Gjesse
CC:
reviews_dartlang.org
Visibility:
Public.

Description

dart:io | Add FileSystemEntity.stat() and FileStat class. BUG= R=sgjesse@google.com Committed: https://code.google.com/p/dart/source/detail?r=22685

Patch Set 1 #

Patch Set 2 : Add implementation #

Total comments: 1

Patch Set 3 : Add documentation comments to new FileStat class. Fix type error in implementation. #

Patch Set 4 : Fix Windows failures. #

Total comments: 13
Unified diffs Side-by-side diffs Delta from patch set Stats (+420 lines, -7 lines) Patch
M runtime/bin/builtin_natives.cc View 1 1 chunk +1 line, -0 lines 0 comments Download
M runtime/bin/dartutils.h View 1 2 chunks +9 lines, -0 lines 6 comments Download
M runtime/bin/dartutils.cc View 1 1 chunk +0 lines, -5 lines 0 comments Download
M runtime/bin/file.h View 1 2 chunks +14 lines, -1 line 0 comments Download
M runtime/bin/file.cc View 1 3 chunks +55 lines, -0 lines 2 comments Download
M runtime/bin/file_android.cc View 1 1 chunk +28 lines, -0 lines 0 comments Download
M runtime/bin/file_linux.cc View 1 1 chunk +28 lines, -0 lines 0 comments Download
M runtime/bin/file_macos.cc View 1 1 chunk +28 lines, -0 lines 0 comments Download
M runtime/bin/file_system_entity_patch.dart View 1 chunk +5 lines, -0 lines 0 comments Download
M runtime/bin/file_win.cc View 1 1 chunk +25 lines, -0 lines 0 comments Download
M runtime/include/dart_api.h View 1 chunk +1 line, -1 line 0 comments Download
M sdk/lib/_internal/compiler/implementation/lib/io_patch.dart View 1 chunk +6 lines, -0 lines 0 comments Download
M sdk/lib/io/common.dart View 1 1 chunk +1 line, -0 lines 0 comments Download
M sdk/lib/io/file_impl.dart View 1 1 chunk +1 line, -0 lines 0 comments Download
M sdk/lib/io/file_system_entity.dart View 1 2 1 chunk +133 lines, -0 lines 5 comments Download
A tests/standalone/io/file_stat_test.dart View 1 2 3 1 chunk +85 lines, -0 lines 0 comments Download

Messages

Total messages: 5 (0 generated)
Bill Hesse
https://codereview.chromium.org/15018011/diff/2001/runtime/bin/dartutils.h File runtime/bin/dartutils.h (right): https://codereview.chromium.org/15018011/diff/2001/runtime/bin/dartutils.h#newcode212 runtime/bin/dartutils.h:212: static const int kArgumentError = 1; We could make ...
7 years, 7 months ago (2013-05-14 11:34:12 UTC) #1
Søren Gjesse
lgtm, with comments https://codereview.chromium.org/15018011/diff/9001/runtime/bin/dartutils.h File runtime/bin/dartutils.h (right): https://codereview.chromium.org/15018011/diff/9001/runtime/bin/dartutils.h#newcode210 runtime/bin/dartutils.h:210: // These match the constants in ...
7 years, 7 months ago (2013-05-14 13:50:36 UTC) #2
Bill Hesse
Committed patchset #4 manually as r22685 (presubmit successful).
7 years, 7 months ago (2013-05-14 16:26:28 UTC) #3
Bill Hesse
https://codereview.chromium.org/15018011/diff/9001/runtime/bin/dartutils.h File runtime/bin/dartutils.h (right): https://codereview.chromium.org/15018011/diff/9001/runtime/bin/dartutils.h#newcode210 runtime/bin/dartutils.h:210: // These match the constants in sdk/lib/io/common.dart. I would ...
7 years, 7 months ago (2013-05-14 16:33:58 UTC) #4
Søren Gjesse
7 years, 7 months ago (2013-05-15 14:06:35 UTC) #5
Message was sent while issue was closed.
lgtm

https://codereview.chromium.org/15018011/diff/9001/runtime/bin/dartutils.h
File runtime/bin/dartutils.h (right):

https://codereview.chromium.org/15018011/diff/9001/runtime/bin/dartutils.h#ne...
runtime/bin/dartutils.h:210: // These match the constants in
sdk/lib/io/common.dart.
On 2013/05/14 16:33:58, Bill Hesse wrote:
> I would do this, but I don't know where you think they should be moved to. 
The
> relevant file would seem to be native_service.h, but there is not much there
> about this.
> The code that uses these constants is in the implementation of the CObject
class
> in dartutils.cc, so the RPC protocol currently used between Dart and native
> ports seems to be pretty well encapsulated in CObject and related classes,
which
> is in dartutils.
> 
> So I don't know where you want to move this, so I can't do it.
> 
> 
> I could move them further down in the class, to where FileClosedError is
> declared, but consts and enums are supposed to be at the top of the class.
> 
> On 2013/05/14 13:50:36, Søren Gjesse wrote:
> > These constants should be moved. They are not part of the serialization, but
> the
> > RPC protocol currently used between Dart code and the native threads.
> 

Let's create a new class NativePortRPC with these constants. and move then
methods IllegalArgumentError, FileClosedError and NewOSError (x2) from CObject
as well. It can be here in dartutils.h.

https://codereview.chromium.org/15018011/diff/9001/runtime/bin/dartutils.h#ne...
runtime/bin/dartutils.h:262: static Dart_CObject* NewString(const char* str);
On 2013/05/14 16:33:58, Bill Hesse wrote:
> On 2013/05/14 13:50:36, Søren Gjesse wrote:
> > I don't think this comment belongs here. It is specific to the current RPC
> > protocol used between the Dart code and the native port.
> 
> Removed.  But the RPC protocol is exactly the function NewOSError,
> FileClosedError, and IllegalArgumentError, just below, isn't it?

That's right, see comment above.

https://codereview.chromium.org/15018011/diff/9001/sdk/lib/io/file_system_ent...
File sdk/lib/io/file_system_entity.dart (right):

https://codereview.chromium.org/15018011/diff/9001/sdk/lib/io/file_system_ent...
sdk/lib/io/file_system_entity.dart:114: var result = [];
On 2013/05/14 16:33:58, Bill Hesse wrote:
> On 2013/05/14 13:50:36, Søren Gjesse wrote:
> > These flags does not match the content of the man page for stat.
> > 
> >      S_ISUID    0004000   set UID bit
> >      S_ISGID    0002000   set-group-ID bit (see below)
> >      S_ISVTX    0001000   sticky bit (see below)
> >      S_IRWXU    00700     mask for file owner permissions
> >      S_IRUSR    00400     owner has read permission
> >      S_IWUSR    00200     owner has write permission
> >      S_IXUSR    00100     owner has execute permission
> >      S_IRWXG    00070     mask for group permissions
> >      S_IRGRP    00040     group has read permission
> >      S_IWGRP    00020     group has write permission
> >      S_IXGRP    00010     group has execute permission
> >      S_IRWXO    00007     mask for permissions for others (not in group)
> >      S_IROTH    00004     others have read permission
> >      S_IWOTH    00002     others have write permission
> >      S_IXOTH    00001     others have execute permission
> 
> Those numbers are in octal, and mine are in hex or decimal.

My bad, sorry for the confusion.

Powered by Google App Engine
This is Rietveld 408576698