Closed
Bug 221593
Opened 21 years ago
Closed 21 years ago
win nsIconChannel.cpp should not call streamlistener methods synchronously
Categories
(Core :: Graphics: ImageLib, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: Biesinger, Assigned: Biesinger)
Details
Attachments
(1 file, 4 obsolete files)
11.53 KB,
patch
|
darin.moz
:
review+
tor
:
superreview+
|
Details | Diff | Splinter Review |
416 aListener->OnDataAvailable(this, ctxt, inputStr, 0, 417 iconBuffer.Length()); 418 aListener->OnStopRequest(this, ctxt, rv); should be done via a proxy
Assignee | ||
Updated•21 years ago
|
OS: Linux → Windows 2000
Assignee | ||
Comment 1•21 years ago
|
||
something like this, but I want to implement nsIconChannel::Open as well
Assignee | ||
Comment 2•21 years ago
|
||
Attachment #133537 -
Attachment is obsolete: true
Assignee | ||
Comment 3•21 years ago
|
||
(bug 222694 will bitrot this patch, so not requesting review yet)
Comment 4•21 years ago
|
||
OK, 222694 is in. Should this be updated? can the OS/2 version just go in? (bug 223128)
Assignee | ||
Comment 5•21 years ago
|
||
mkaply: yes, I'm updating this right now. os/2 can go in as-is.
Assignee | ||
Comment 6•21 years ago
|
||
Attachment #133577 -
Attachment is obsolete: true
Assignee | ||
Updated•21 years ago
|
Attachment #134519 -
Flags: review?(darin)
Comment 7•21 years ago
|
||
Comment on attachment 134519 [details] [diff] [review] merge to trunk >Index: modules/libpr0n/decoders/icon/win/nsIconChannel.cpp > #include "nsNetUtil.h" ... >+#include "nsNetCID.h" >+#include "nsIPipe.h" >+#include "nsIInputStream.h" >+#include "nsIOutputStream.h" nsNetUtil.h already includes all of these. >+ // Add ourself to the load group, if available >+ if (mLoadGroup) >+ mLoadGroup->AddRequest(this, nsnull); >+ >+ rv = mPump->AsyncRead(this, ctxt); >+ if (NS_FAILED(rv)) { >+ // Break possibly reference cycle >+ mListener = nsnull; >+ } >+ return rv; >+} you don't want to call AddRequest until you know AsyncOpen is going to return NS_OK. see nsFileChannel::AsyncOpen for example. >+nsresult nsIconChannel::MakeInputStream(nsIInputStream** _retval) ... >+ // Now, create a pipe and stuff our data into it >+ nsCOMPtr<nsIInputStream> inStream; >+ nsCOMPtr<nsIOutputStream> outStream; >+ rv = NS_NewPipe(getter_AddRefs(inStream), getter_AddRefs(outStream), >+ iconSize, iconSize); >+ if (NS_SUCCEEDED(rv)) { >+ PRUint32 written; >+ rv = outStream->Write(buffer, iconSize, &written); >+ if (NS_SUCCEEDED(rv)) { >+ NS_ADDREF(*_retval = inStream); >+ } you should make the input end of the pipe non-blocking, when it will be used with AsyncOpen. that way, the nsInputStreamPump will not need to read from the pipe on a background thread to make it asynchronous ;-) nsIInputStreamPump.idl explains this a bit. i would add a nonBlockingInput parameter to MakeInputStream and pass that to NS_NewPipe. otherwise, this patch looks good to me.
Attachment #134519 -
Flags: review?(darin) → review-
Assignee | ||
Comment 8•21 years ago
|
||
Attachment #134519 -
Attachment is obsolete: true
Assignee | ||
Updated•21 years ago
|
Status: NEW → ASSIGNED
Assignee | ||
Updated•21 years ago
|
Attachment #135074 -
Flags: review?(darin)
Comment 9•21 years ago
|
||
Comment on attachment 135074 [details] [diff] [review] per darin's comments i think you got the sense of the nonBlocking argument backwards. nsIconChannel::Open must return a "blocking" input stream, so you want to pass PR_FALSE in ::Open and PR_TRUE in ::AsyncOpen. otherwise, the patch looks good.
Attachment #135074 -
Flags: review?(darin) → review-
Assignee | ||
Comment 10•21 years ago
|
||
"oops" guess I thought of it as "blocking" rather than "nonblocking"
Assignee | ||
Comment 11•21 years ago
|
||
Assignee | ||
Updated•21 years ago
|
Attachment #135074 -
Attachment is obsolete: true
Assignee | ||
Updated•21 years ago
|
Attachment #135118 -
Flags: review?(darin)
Updated•21 years ago
|
Attachment #135118 -
Flags: review?(darin) → review+
Assignee | ||
Updated•21 years ago
|
Attachment #135118 -
Flags: superreview?(tor)
Comment 12•21 years ago
|
||
On OS/2, I had to use: aContentType = NS_LITERAL_CSTRING("image/icon"); instead of aContentType = NS_LITERAL_CSTRING("image/x-icon"); to get stuff to work. Anyone have a clue why?
Assignee | ||
Comment 13•21 years ago
|
||
mkaply: yes - neil recently changed the windows iconchannel code to generate .ico files - those have the image/x-icon content type, and are decoded by nsICODecoder.cpp. but os/2 was not changed and still creates some strange format for which the type image/icon is used (and nsIconDecoder.cpp) I don't think GetContentType was changed in this patch though...
Comment 14•21 years ago
|
||
That code didn't change - it's more that when I ported the Windows code back to OS/2, I noticed that difference and wondered why. So if I understand correctly, image/x-icon is used, Mozilla assumes a Windows icon and goes through the Windows icon format decoder. Since the OS/2 format is not at all compatible with Windows, I wonder if I should name the content type image/x-os2-icon or image/moz-os2-icon or something like that?
Assignee | ||
Comment 15•21 years ago
|
||
>So if I understand correctly, image/x-icon is used, Mozilla assumes a Windows >icon and goes through the Windows icon format decoder. correct - also see bug 222694 which changed that (before, the windows icons were converted to an intermediate format - that image/icon thing) image/icon is not os/2 specific... the macos icon decoder also creates image/icon icons.
Attachment #135118 -
Flags: superreview?(tor) → superreview+
Assignee | ||
Comment 16•21 years ago
|
||
Checking in win/nsIconChannel.cpp; /cvsroot/mozilla/modules/libpr0n/decoders/icon/win/nsIconChannel.cpp,v <-- nsIconChannel.cpp new revision: 1.28; previous revision: 1.27 done Checking in win/nsIconChannel.h; /cvsroot/mozilla/modules/libpr0n/decoders/icon/win/nsIconChannel.h,v <-- nsIconChannel.h new revision: 1.6; previous revision: 1.5 done
Status: ASSIGNED → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•