[Webkit-unassigned] [Bug 27511] Add WinCE specific platform/graphics files to WebCore

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Aug 9 16:50:39 PDT 2009


https://bugs.webkit.org/show_bug.cgi?id=27511





--- Comment #64 from Yong Li <yong.li at torchmobile.com>  2009-08-09 16:50:36 PDT ---
(In reply to comment #63)
> (In reply to comment #60)
> > Heap allocation is slower than stack allocation. 2K is arbitrary.
> 
> I know heap allocation is slower :).  You didn't answer my question.  Does
> WTF::Vector have any code in it to automatically stack-allocate for smaller
> vectors?  (There are certainly Gecko classes that do...)

No. I'm kind of familiar with Vector (I modified it a little bit, but the patch
has not been post yet)

> 
> I would definitely comment in the code about 2k being arbitrary, and why you're
> doing it.

Just a guess, no other reason. 2K seems not too big, compared to other big
buffer on stack, and canvas objects narrower than 683 can benefit.
> 
> There is no WebKit style rule on this one, but I don't consider clarity a small
> thing, and I'll always suggest what I think is the clearest code.  Statements
> with side effects are inherently less clear, even if (as in this case) the code
> is simple enough that it's not too much more difficult to determine what the
> code is doing.

Well, as I mentioned, += 1 might be clearer that ++. Making code too much
readable just makes me feel that I'm not doing C++, or I'm doing C++ in MS
style :) I may be sick at the point. But still, too many restrictions and
requirements on such things make programming no more interesting, because one
tries to write code as he was another person, tries to follow another person's
mind. Although he can still do it, but there's no fun.

> 
> 
> > In this case, I agree that while() is better. But what's your opinion about
> > "while(true)" vs. "for(;;)"?
> 
> I have used both.  while(true) is significantly more common, and thus easier
> for most people to read, and therefore slightly better IMO.

Sigh. I don't know why "while(true)" is more common. Probably it's written in
some programming books? Yeah, there's no such powerful "for(;;)" in languages
other than C/C++, that may be the reason.

> 
> (In reply to comment #61)
> > About "m_" for the members in struct: this is a good example that one reviewer
> > says this, but another says opposite. Sigh...
> > 
> > I'm going to use:
> > 
> > class JpegDestinationManager
> > {
> > public:
> >     Foo m_foo;
> >     ...
> > };
> > 
> > Will anyone say that the data member shouldn't be public? or suggest me to
> > change back to struct?
> 
> I don't know what WebKit style is on that last question.  Google style (which I
> only mention because it's the set of style rules I happen to know well) would
> suggest you use a struct rather than a class for something that's purely a
> container of public members, and personally I agree; I would leave it as a
> struct and change the names as you suggested.  Someone like Eric should have
> the last word on that kind of thing, though.

It should be struct in this case, because it's used by libjpeg, like a C
struct. Probably it should better be wrapped with "extern "C"", although it
doesn't really change anything. And at the point, jpeg_dest_mgr is a better
name.

"pub" acts as the base class of jpeg_dest_mgr. Another idea is:

struct JpegDestinationManager: jpeg_destination_mgr
{
};

What do you think?

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list