Closed
Bug 566577
Opened 15 years ago
Closed 15 years ago
e10s: Serialize nsIFileInputStream
Categories
(Core :: Networking: HTTP, defect)
Core
Networking: HTTP
Tracking
()
RESOLVED
WONTFIX
People
(Reporter: lusian, Unassigned)
References
Details
Attachments
(2 files, 3 obsolete files)
13.14 KB,
patch
|
Biesinger
:
superreview+
|
Details | Diff | Splinter Review |
4.51 KB,
patch
|
dougt
:
review+
|
Details | Diff | Splinter Review |
From my understanding, I need to access PRFileDesc* mFD to get the file name because nsCOMPtr<nsIFile> mFile is not there all the time. My questions are, how do I access mFD & how do I get the file name from PRFileDesc?
![]() |
||
Comment 1•15 years ago
|
||
We could fix things so that we always have an mFile, no? We certainly do for HTTP form uploads right now (since those are OPEN_ON_REWIND, iirc).
Reporter | ||
Comment 2•15 years ago
|
||
Comment 3•15 years ago
|
||
Comment on attachment 447539 [details] [diff] [review]
patch, 0
> We could fix things so that we always have an mFile, no?
So this patch just assumes the file is there, correct? Is there something else we need to do to make sure that works?
![]() |
||
Comment 4•15 years ago
|
||
> Is there something else we need to do to make sure that works?
Change nsFileInputStream::Open to always set mFile?
Comment 5•15 years ago
|
||
As per bug 564553 comment 6, we can get rid of the buffered stream (is IsNeckoChild() only: leave them for chrome requests) by changing NS_NewPostDataStream() in nsNetUtil.h to take an extra arg (or maybe an enum to replace the isFile arg, with notFile, unbuffered, and buffered values).
Comment 6•15 years ago
|
||
(while we're at it, can we remove the "nsIIOService *unused = nsnull" argument, or are the repeated incantations of that in nsNetUtil.h actually serving some purpose? The nsNetUtil.h API isn't frozen in any way, is it?
Reporter | ||
Comment 7•15 years ago
|
||
1. Serialize/Deserialize nsIFileInputStream*
2. Change nsFileStreams.cpp to always set mFile
3. comment 5
Attachment #447539 -
Attachment is obsolete: true
Attachment #448202 -
Flags: review?(bzbarsky)
Reporter | ||
Comment 8•15 years ago
|
||
Comment on attachment 448202 [details] [diff] [review]
patch, 1
This patch fails to build after Bug 536273 landed.
Attachment #448202 -
Attachment is obsolete: true
Attachment #448202 -
Flags: review?(bzbarsky)
Reporter | ||
Comment 9•15 years ago
|
||
This patch contains a test that changes https://bug566305.bugzilla.mozilla.org/attachment.cgi?id=448358
Attachment #448451 -
Flags: review?(jduell.mcbugs)
Updated•15 years ago
|
Attachment #448451 -
Flags: superreview?(cbiesinger)
Comment 10•15 years ago
|
||
Comment on attachment 448451 [details] [diff] [review]
patch, 2
+++ b/ipc/glue/IPCMessageUtils.h
+template<>
+struct ParamTraits<nsAutoString> : ParamTraits<nsString>
Is this useful? Why not serialize/deserialize nsStrings?
+++ b/netwerk/base/public/nsIFileStreams.idl
this needs a new IID
+++ b/netwerk/base/public/nsNetUtil.h
+typedef enum {
+ UploadStream_notFile = 0,
+ UploadStream_unbuffered,
+ UploadStream_buffered
+} UploadStreamType;
This is C++, not C. Please make this:
enum UploadStreamType {
...
};
Also, necko enums are fairly inconsistent, but please either name these as eUploadStream_NotFile or UPLOADSTREAM_NOTFILE, etc.
I think the names would also be easier to understand if they were eUploadStream_File_Buffered, eUploadStream_File_Unbuffered, eUploadStream_NoFile
+ } else
+ NS_ADDREF(*result = fileStream);
please put braces around the else-body if you put them around the then-body
+++ b/netwerk/base/src/nsFileStreams.cpp
// If the file will be reopened on rewind, save the info to open the file
if (mBehaviorFlags & REOPEN_ON_REWIND) {
- mFile = aFile;
mIOFlags = aIOFlags;
mPerm = aPerm;
}
at this point I think you can just remove the if and always set mIOFlags/mPerm, that's just two integers.
+ *aFile = mFile;
+ NS_IF_ADDREF(*aFile);
make that NS_ADDREF, you are nullchecking mFile above.
+++ b/netwerk/protocol/http/src/PHttpChannelParams.h
+ nsCOMPtr<nsILocalFile> file =
+ do_CreateInstance("@mozilla.org/file/local;1", &rv);
You can simplify this a bit by using NS_NewLocalFile.
+ rv = stream->Init(file, -1, -1, nsIFileInputStream::CLOSE_ON_EOF |
+ nsIFileInputStream::REOPEN_ON_REWIND);
Hmm, don't you want to serialize the flags too?
Attachment #448451 -
Flags: superreview?(cbiesinger) → superreview-
Reporter | ||
Comment 11•15 years ago
|
||
Attachment #448451 -
Attachment is obsolete: true
Attachment #451206 -
Flags: superreview?
Attachment #448451 -
Flags: review?(jduell.mcbugs)
Reporter | ||
Updated•15 years ago
|
Attachment #451206 -
Flags: superreview? → superreview?(cbiesinger)
Updated•15 years ago
|
Attachment #451206 -
Flags: superreview?(cbiesinger) → superreview+
Reporter | ||
Updated•15 years ago
|
Attachment #451206 -
Flags: review?(jduell.mcbugs)
Reporter | ||
Comment 12•15 years ago
|
||
Please review test_FileInputStream (the test_String part is reviewed in 566305) or the whole thing if you have time. I want to make sure the test is correct before adding test_MultiplexInputStream.
Attachment #458609 -
Flags: review?(jduell.mcbugs)
Comment 13•15 years ago
|
||
Comment on attachment 458609 [details] [diff] [review]
test
applied and ran 7 tests without failure. looks fine.
Attachment #458609 -
Flags: review?(jduell.mcbugs) → review+
Comment 14•15 years ago
|
||
Comment on attachment 451206 [details] [diff] [review]
patch, 3
I do not like adding this enum everywhere. I would rather just have a new NS_NewPostDataStream method and safe us from polluting the namespace.
Reporter | ||
Comment 15•15 years ago
|
||
Comment on attachment 451206 [details] [diff] [review]
patch, 3
Bug 564553 made a different approach; so this patch is unnecessary and Bug 566305 needs to be backed out.
Attachment #451206 -
Flags: review?(jduell.mcbugs)
Comment 16•15 years ago
|
||
Without reading the patch in detail, I'm not sure exactly what you mean by "unnecessary". Should we WONTFIX this, or is this something we still want even after bug 564553 lands?
Reporter | ||
Comment 17•15 years ago
|
||
Will be fixed by bug 564553
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → WONTFIX
You need to log in
before you can comment on or make changes to this bug.
Description
•