Closed Bug 183859 Opened 22 years ago Closed 22 years ago

[FIXr]fix up use of chrome prototype cache for stylesheets

Categories

(Core :: CSS Parsing and Computation, defect, P1)

defect

Tracking

()

RESOLVED FIXED
mozilla1.3beta

People

(Reporter: bzbarsky, Assigned: bzbarsky)

References

Details

(Whiteboard: [whitebox])

Attachments

(1 file, 2 obsolete files)

We end up with a lot of misses on the prototype cache because it's called both
inside and outside the CSSLoader.  We should just let the CSSLoader handle that...

Oh, and some of those calls to Clone() in nsXULDocument are pretty bogus...
oops, this is mine...
Assignee: dbaron → bzbarsky
really sorta repends on the changes in bug 183299
Depends on: 183299
Patch to the css loader to check the prototype cache coming up?  Is it good
modularity for the style subsystem to depend on rdf/chrome?  I hope I haven't
misunderstood something.

/be
No longer depends on: 183299
Depends on: 183299
Duh, it should have been obvious from bz's comment #0 that the css loader
already knows about the prototype cache.  I guess it's all one happy ball of string.

/be
Yeah, the CSS Loader already knows about the prototype cache (#ifdef
INCLUDE_XUL, though).

I'm not completely happy with it either, and I would be ok with pushing that
stuff completely out to the callers, but we should do one or the other.  The way
it's set up right now is just silly.
Priority: -- → P1
Summary: fix up use of chrome prototype cache for stylesheets → [FIX]fix up use of chrome prototype cache for stylesheets
Target Milestone: --- → mozilla1.3beta
Comment on attachment 108454 [details] [diff] [review]
I think this should be faster....

>+    mCSSLoader = do_CreateInstance(kCSSLoaderCID, &rv);
>+    if (NS_FAILED(rv)) return rv;

NS_ENSURE_SUCCESS :-)

>+  }
>+  
>+  if (mCSSLoader) {
>+    rv = mCSSLoader->LoadAgentSheet(aURL, aSheet);
>+    if (NS_FAILED(rv)) return rv;

same same

>+        // If the sheet is a chrome URL, then we can refetch the sheet
>+        // synchronously, since we know the sheet is local.  It's not
>+        // too late! :) If we're lucky, the loader will just pull it
>+        // from the prototype cache anyway.
>+        // Otherwise we just bail.  It shouldn't currently
>+        // be possible to get into this situation for any reason
>+        // other than a skin switch anyway (since skin switching is the
>+        // only system that partially invalidates the XUL cache).
>+        // - dwh
>+        //XXXbz we hit this code from fastload all the time...

Hmm.. i wonder if you should just remove the part about this only happening in
skin-switch since that is not likly to be true anytime soon. And It's not
really as if that comments helps anyone anyway. Feel free to keep it if you
want though.

>+        nsCOMPtr<nsICSSLoader> loader;
>+        GetCSSLoader(*getter_AddRefs(loader));

Check that GetCSSLoader succeeds

>+        rv = loader->LoadAgentSheet(uri, getter_AddRefs(sheet));
>         if (NS_FAILED(rv)) return rv;

Please fix this one.
Attachment #108454 - Flags: review+
locale switching will eventually nuke or change the prototype cache (right now
it just causes some nasty fastload assertions). i haven't quite figured out what
it will do, it has to do something. i think the correct thing is to change the
cache so that all urls actually encode the locale they contained, but that's a
major version bump.

i'm sure bz will leave the comment in, the reason it's there is to remind us
about something which will happen and does happen in some rare developer's
builds (mine).

Ensure success results in warnings...
http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/xpcom/glue/nsDebug.h&rev=1.9&mark=308-313,323-324#307

+        // If the sheet is a chrome URL, then we can refetch the sheet
+        // synchronously, since we know the sheet is local.
bz, that assertion isn't valid. chrome urls can map to http urls, and some
people do it (although most packages don't). -- you've been warned.
Yes, I know that the assumption that chrome is synchronously fetchable is bogus.
 Forget mapping to HTTP, just think NFS or AFS.  This is why it takes Mozilla so
frigging long (order of 10 minutes) to start out of AFS on a fast machine with a
100Mbit direct pipe to the fileserver....  give me a few days before I start
rewriting all of chrome to remove this assumption (we make it for _everything_).

I thought about putting this in the callers some more... there are 6-7 callers
of LoadAgentSheet/LoadStyleLink that may want chrome:// sheets.  I think doing
the check in the one central location is cleaner overall...
yes, i think making chrome non-sync would be a pretty big undertaking.
Especially doing so without regressing Ts on systems where loading chrome can be
done syncronyously.
Attached patch updated to sicking's review (obsolete) — Splinter Review
Attachment #108454 - Attachment is obsolete: true
Comment on attachment 108503 [details] [diff] [review]
updated to sicking's review

Brendan, would you sr?	Or do you think it's better to move the chrome registry
stuff out of the loader (probably with some helper functions to reduce the
massive code duplication)?
Attachment #108503 - Flags: superreview?(brendan)
Comment on attachment 108503 [details] [diff] [review]
updated to sicking's review

+	 //XXXbz we hit this code from fastload all the time...

Could you cite the bug # for this issue?

I don't mind the #ifdef INCLUDE_XUL dependencies on XUL from CSS, for now. 
Instead of helpers, you might provide some generic, abstract way for CSS to
check a cache for a hit, and have XUL register some object implementing that
interface.  But no rush, seems low priority, may never happen.	If it were
important to exclude XUL from a Gecko build, the fastest course might be to
make the #ifdefs work (I understand they don't at present).

/be
Comment on attachment 108503 [details] [diff] [review]
updated to sicking's review

+	 //XXXbz we hit this code from fastload all the time...

Could you cite the bug # for this issue?

I don't mind the #ifdef INCLUDE_XUL dependencies on XUL from CSS, for now. 
Instead of helpers, you might provide some generic, abstract way for CSS to
check a cache for a hit, and have XUL register some object implementing that
interface.  But no rush, seems low priority, may never happen.	If it were
important to exclude XUL from a Gecko build, the fastest course might be to
make the #ifdefs work (I understand they don't at present).

/be
Attachment #108503 - Flags: superreview?(brendan) → superreview+
Summary: [FIX]fix up use of chrome prototype cache for stylesheets → [FIXr]fix up use of chrome prototype cache for stylesheets
Attachment #108503 - Attachment is obsolete: true
checked in
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Whiteboard: [whitebox]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: