Closed Bug 489015 Opened 15 years ago Closed 15 years ago

optimize Mac OS X filesystem time methods

Categories

(Core :: XPCOM, defect)

All
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: jaas, Assigned: jaas)

References

Details

Attachments

(1 file, 2 obsolete files)

We should optimize the code for setting and getting the filesystem modification times on Mac OS X. Right now we are using old catalog info APIs.
Attached patch fix v1.0 (obsolete) — Splinter Review
This moves us to the same posix/utime APIs used in our unix impl and optimizes the way we get UTF8 path strings.

I got rid of the FNNotify call, it isn't very important that we do it and if we do want to do it then this isn't necessarily the right place. I plan to file another bug on adding filesystem notifications consistently in our implementation.
Attachment #373507 - Flags: review?(mstange)
Comment on attachment 373507 [details] [diff] [review]
fix v1.0

This became so much easier to review when I noticed the similarities to nsLocalFileUnix.cpp...

> NS_IMETHODIMP nsLocalFile::GetLastModifiedTime(PRInt64 *aLastModifiedTime)
...
>-  // Check we are correctly initialized.
>-  CHECK_mBaseURL();

Why can you remove this check? (in SetLastModifiedTime, too)


> nsresult nsLocalFile::GetPathInternal(nsACString& path)
> {
...
>+  if (!whichURLRef)
>+    return NS_ERROR_FAILURE;
...
>-  NS_ENSURE_TRUE(whichURLRef, NS_ERROR_NULL_POINTER);

What's wrong with NS_ENSURE_TRUE?
(In reply to comment #2)
> This became so much easier to review when I noticed the similarities to
> nsLocalFileUnix.cpp...

Oh, you even mentioned it.
(In reply to comment #2)

> >-  CHECK_mBaseURL();
> 
> Why can you remove this check? (in SetLastModifiedTime, too)

Both use "GetPathInternal", the result of which we check and that will fail if we don't have a base URL.

> > nsresult nsLocalFile::GetPathInternal(nsACString& path)
> > {
> ...
> >+  if (!whichURLRef)
> >+    return NS_ERROR_FAILURE;
> ...
> >-  NS_ENSURE_TRUE(whichURLRef, NS_ERROR_NULL_POINTER);
> 
> What's wrong with NS_ENSURE_TRUE?

Nothing really, I just have a tendency to only use that for boolean values not pointer null checks. I'd rather leave it my way if that is OK.
Comment on attachment 373507 [details] [diff] [review]
fix v1.0

OK.
Attachment #373507 - Flags: review?(mstange) → review+
Attachment #373507 - Flags: superreview?(roc)
Can you get rid of the LL_ macro usage in nsLocalFileUnix and then refresh this patch so we're not copying that deprecated goop in here?
Attached patch fix v1.1 (obsolete) — Splinter Review
Stop using LL_ macros, some other minor compile stuff.
Attachment #373507 - Attachment is obsolete: true
Attachment #374091 - Flags: superreview?(roc)
Attachment #373507 - Flags: superreview?(roc)
Comment on attachment 374091 [details] [diff] [review]
fix v1.1

wrong (old) patch
Attachment #374091 - Attachment is obsolete: true
Attachment #374091 - Flags: superreview?(roc)
Attached patch fix v1.2Splinter Review
don't need to check for zero when multiplying
Attachment #374093 - Flags: superreview?(roc)
Attachment #374093 - Flags: superreview?(roc) → superreview+
pushed to mozilla-central

http://hg.mozilla.org/mozilla-central/rev/0c250e6e2062
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: