[chromium-dev] Re: More plugin questions

2009-03-06 Thread John Abd-El-Malek
On Thu, Mar 5, 2009 at 8:59 PM, eager_learner
vijay.sankar.ra...@gmail.comwrote:


 Hello Plugin Gurus

 The following link is very well written and I hope it still holds good

 http://sites.google.com/a/chromium.org/dev/developers/design-documents/plugin-architecture

 I have some followup questions on plugin development (internal)

 1. Based on the plugin architecture design document, can you point me
 to an existing plugin (flash, shockwave, activeX) code file names? The
 source Navigator project that I have created does not show any
 inheritance of WebPplugin


I think there's some confusion between the internal Chrome classes used to
implement multi-process plugins, and the NPAPI APIs that are exposed by any
plugin (external or internal).



 2. Again the debugging process seems a little difficult if new
 processes are spawned (one for the browser, one for the renderer and
 one for the plugin). How can we attach Visual Studio to the plugin?


Start chrome with --renderer-startup-dialog and/or --plugin-startup-dialog
to have a message box load on process startup, then you can attach VS.




 3. Do plugin writers need to know anything about the class
 PluginInstance? It seems to create the WebPlugin or atleast gets
 passed it and has a reference to it.


No it's internal to the plugin implementation.



 Simply put, what needs to be done by plugin developers to develop an
 internal plugin?


Have a look at plugin_list.cc, specifically the constructor which adds
default_plugin.  The main thing to look at is how it maps the three NPAPI
methods (NP_GetEntryPoints/NP_Initialize/NP_Shutdown) to functions that are
linked in the same binary.



 Does the NPAPI need to know about the PluginInstance?


No



 Perhaps there is a clearer document that explains this.

 Thanks
 Vijay
 


--~--~-~--~~~---~--~~
Chromium Developers mailing list: chromium-dev@googlegroups.com 
View archives, change email options, or unsubscribe: 
http://groups.google.com/group/chromium-dev
-~--~~~~--~~--~--~---



[chromium-dev] Re: Profile Corruption, cause?

2009-03-06 Thread Mohamed Mansour
Hello, thanks for your reply.
I understand about User Agreement between the user and Google, I thought a
Stack trace would help a little to figure out what is really going on.
People are getting really annoyed (on the forums) since their browser
quickly crashes when they open it, after couple seconds, when they click on
a tab, etc. All this was resolved by a profile cleanup.

Would it be possibly to do an integrity check if the profile is valid? How
much cost would that add to the run-time of chrome? If we somehow check if
the profile is valid, and as you said, inform the user that it is corrupt,
we can even break it down even further, to find out which section of his
profile is corrupt. That way, we might have a mechanism to attempt fixing it
or wiping it.

I believe adding that small performance cost will make browsing more
enjoyable due to corruption, it never happened to me, and I always cross my
fingers that it does, because I could try and attempt debugging it at my
end.

Thanks!

On Fri, Mar 6, 2009 at 1:20 AM, Mark Larson (Google) m...@chromium.orgwrote:

 Mohamed,

 I'm glad to see your interest in tackling this problem.

 Unfortunately, that data is collected under an agreement between the user
 and Google, so we cannot share the dumps. It's OK to share the stack traces,
 which have no personally identifying information, but I'm not sure we can
 even find a set of reports definitely correlated with profile corruption.
 This makes me wonder if we should have an integrity check when we detect
 that the browser crashed in the previous session. It might be useful to
 offer to reset the user's profile or (ideally) drop the parts that are
 corrupt. I'd personally rather drop my entire browsing history to keep my
 saved passwords (and vice versa). The UI would have to be diplomatic.

 Maybe some developers who have dealt with corruption issues in the past can
 provide some advice on things we could do to address corruption.

 Thanks,
 Mark

 On Thu, Mar 5, 2009 at 21:09, Mohamed Mansour m0.interact...@gmail.comwrote:

 Hello, on the Google Help Forums, 80-85% of the crashes reported there are
 due to profile corruptions. What they have to do is run chrome in a new user
 directory, chrome.exe --user-data-dir=c:\foo, or deleting the local state
 file.
 Anyone have any idea what may of caused this? Users who don't know the
 answer to this problem, usually give up using the browser. Chrome is a great
 browser, and its sad to see people not using it because of this. If anyone
 has any crash logs due to this (from user reporting), and since its internal
 to Google, can you share the stack trace? I would like to spend one weekend
 taking a look at it.

 Thanks!

 



--~--~-~--~~~---~--~~
Chromium Developers mailing list: chromium-dev@googlegroups.com 
View archives, change email options, or unsubscribe: 
http://groups.google.com/group/chromium-dev
-~--~~~~--~~--~--~---



[chromium-dev] Re: More plugin questions

2009-03-06 Thread Marshall Greenblatt
Hi Vijay,

Once you have your code linking with chromium, you have two options for
registering your internal NPAPI plugin.

1. Add an entry to the builtin_plugins array in
webkit/glue/plugins/plugin_list_win.cc PluginList::PlatformInit().

2. Use the following approach that can be called from anywhere once chromium
has been initialized.

A. Include the appropriate header.

#include webkit/glue/plugins/plugin_list.h

B. Create an instance of NPAPI::PluginVersionInfo populated with your plugin
information and NP function pointers.

NPAPI::PluginVersionInfo info;

info.path = FilePath(Lmy_dummy_path);
info.product_name = LMy Product Name;
info.file_description = LMy Product Description;
info.file_version = L1, 0, 0, 1;

info.mime_types = Lapplication/x-my-plugin;
info.file_extensions = L*;
info.type_descriptions = L;

info.entry_points.np_getentrypoints = my_np_getentrypoints;
info.entry_points.np_initialize = my_np_initialize;
info.entry_points.np_shutdown = my_np_shutdown;

C. Register the plugin information with the system.

NPAPI::PluginList::RegisterInternalPlugin(info);
NPAPI::PluginList::Singleton()-LoadPlugin(FilePath(info.path));


Finally, to the load plugin in an HTML page you use an embed tag like the
following:

embed type=application/x-my-plugin width=600 height=40


I recommend looking at the chromium embedded framework for a simple NPAPI
plugin example and plugin development environment.

http://code.google.com/p/chromiumembedded


Regards,
Marshall

On Thu, Mar 5, 2009 at 11:59 PM, eager_learner vijay.sankar.ra...@gmail.com
 wrote:


 Hello Plugin Gurus

 The following link is very well written and I hope it still holds good

 http://sites.google.com/a/chromium.org/dev/developers/design-documents/plugin-architecture

 I have some followup questions on plugin development (internal)

 1. Based on the plugin architecture design document, can you point me
 to an existing plugin (flash, shockwave, activeX) code file names? The
 source Navigator project that I have created does not show any
 inheritance of WebPplugin

 2. Again the debugging process seems a little difficult if new
 processes are spawned (one for the browser, one for the renderer and
 one for the plugin). How can we attach Visual Studio to the plugin?

 3. Do plugin writers need to know anything about the class
 PluginInstance? It seems to create the WebPlugin or atleast gets
 passed it and has a reference to it.

 Simply put, what needs to be done by plugin developers to develop an
 internal plugin? Does the NPAPI need to know about the PluginInstance?

 Perhaps there is a clearer document that explains this.

 Thanks
 Vijay
 


--~--~-~--~~~---~--~~
Chromium Developers mailing list: chromium-dev@googlegroups.com 
View archives, change email options, or unsubscribe: 
http://groups.google.com/group/chromium-dev
-~--~~~~--~~--~--~---



[chromium-dev] Re: Profile Corruption, cause?

2009-03-06 Thread Erik Kay

One thing that would help is if some of the users who are running into
this would be willing to share their whole profile with us.

While our best guess is that this is sqlite corruption, we don't know
for sure.  Even if it is sqlite corruption, having the specific db
might help us figure out how to more reliably detect it.

Erik


On Thu, Mar 5, 2009 at 10:39 PM, Finnur Thorarinsson
fin...@chromium.org wrote:
 I suspect this is like crashes due to memory corruption: It won't do much
 good to stare at the call stack at the time corruption was detected; we need
 to know the stack at the time corruption occurred (assuming this is Chrome
 that is corrupting the profile).
 For memory corruptions we have gflags; I wonder if there is something in
 SqlLite that can help us here?

 On Thu, Mar 5, 2009 at 22:20, Mark Larson (Google) m...@chromium.org wrote:

 Mohamed,
 I'm glad to see your interest in tackling this problem.
 Unfortunately, that data is collected under an agreement between the user
 and Google, so we cannot share the dumps. It's OK to share the stack traces,
 which have no personally identifying information, but I'm not sure we can
 even find a set of reports definitely correlated with profile corruption.
 This makes me wonder if we should have an integrity check when we detect
 that the browser crashed in the previous session. It might be useful to
 offer to reset the user's profile or (ideally) drop the parts that are
 corrupt. I'd personally rather drop my entire browsing history to keep my
 saved passwords (and vice versa). The UI would have to be diplomatic.
 Maybe some developers who have dealt with corruption issues in the past
 can provide some advice on things we could do to address corruption.
 Thanks,
 Mark
 On Thu, Mar 5, 2009 at 21:09, Mohamed Mansour m0.interact...@gmail.com
 wrote:

 Hello, on the Google Help Forums, 80-85% of the crashes reported there
 are due to profile corruptions. What they have to do is run chrome in a new
 user directory, chrome.exe --user-data-dir=c:\foo, or deleting the local
 state file.
 Anyone have any idea what may of caused this? Users who don't know the
 answer to this problem, usually give up using the browser. Chrome is a great
 browser, and its sad to see people not using it because of this. If anyone
 has any crash logs due to this (from user reporting), and since its internal
 to Google, can you share the stack trace? I would like to spend one weekend
 taking a look at it.
 Thanks!






 


--~--~-~--~~~---~--~~
Chromium Developers mailing list: chromium-dev@googlegroups.com 
View archives, change email options, or unsubscribe: 
http://groups.google.com/group/chromium-dev
-~--~~~~--~~--~--~---



[chromium-dev] Re: Profile Corruption, cause?

2009-03-06 Thread Erik Kay

On Fri, Mar 6, 2009 at 9:33 AM, Brett Wilson bre...@google.com wrote:
 Getting the database has helped in a few cases where it turned out some
 assumptions were being violated, but if the sqlite data structures are
 corrupted, getting the DB has never been helpful to diagnose the root cause.

 It might help us make sqlite not crash for these types of corruption,
 though.

 I think we should install an exception handler on the DB threads, and if we
 get two crashes in a row from sqlite, recreate the DB.

Yep.  This would be nice.  If these crashes are really this frequent,
perhaps we should move the db out of the browser process. Or perhaps
we could simply have an out of process validator that we could run if
we got a single browser crash from sqlite.

Erik



 Brett

 On Mar 6, 2009 9:19 AM, Erik Kay erik...@chromium.org wrote:


 One thing that would help is if some of the users who are running into
 this would be willing to share their whole profile with us.

 While our best guess is that this is sqlite corruption, we don't know
 for sure.  Even if it is sqlite corruption, having the specific db
 might help us figure out how to more reliably detect it.

 Erik

 On Thu, Mar 5, 2009 at 10:39 PM, Finnur Thorarinsson fin...@chromium.org
 wrote:  I suspect this...

--~--~-~--~~~---~--~~
Chromium Developers mailing list: chromium-dev@googlegroups.com 
View archives, change email options, or unsubscribe: 
http://groups.google.com/group/chromium-dev
-~--~~~~--~~--~--~---



[chromium-dev] Spam on chromium-reviews

2009-03-06 Thread John Abd-El-Malek
I'm guessing I'm not the only one who's irritated by it.  Can we make it so
that only members can post to chromium-reviews?  We can automatically
subscribe everyone who's sent a review in the last month or something.
What do people think?

--~--~-~--~~~---~--~~
Chromium Developers mailing list: chromium-dev@googlegroups.com 
View archives, change email options, or unsubscribe: 
http://groups.google.com/group/chromium-dev
-~--~~~~--~~--~--~---



[chromium-dev] Re: Spam on chromium-reviews

2009-03-06 Thread Peter Kasting
On Fri, Mar 6, 2009 at 10:34 AM, John Abd-El-Malek j...@chromium.org wrote:

 I'm guessing I'm not the only one who's irritated by it.  Can we make it so
 that only members can post to chromium-reviews?  We can automatically
 subscribe everyone who's sent a review in the last month or something.


Would this prevent random new people from submitting a patch to Rietveld and
having it mailed out for review?

We might have to ask Jon Conradt to moderate first posts like he does
already for some of the other lists.

PK

--~--~-~--~~~---~--~~
Chromium Developers mailing list: chromium-dev@googlegroups.com 
View archives, change email options, or unsubscribe: 
http://groups.google.com/group/chromium-dev
-~--~~~~--~~--~--~---



[chromium-dev] Re: Metalink (XML Download Description) support

2009-03-06 Thread Adam Langley

 I'd really like to see Chromium support Metalink.

 Metalinks are simple XML files that list mirrors, checksum,
 signatures, and other info useful for making downloads more robust.
 [1]

Metalink looks like a neat spec. However, I don't think all that
complexity belongs in Chromium itself. Since metalink files have a
MIME type, Chromium can execute a helper application as normal for
these files and a special purpose downloader process can deal with it.


AGL

--~--~-~--~~~---~--~~
Chromium Developers mailing list: chromium-dev@googlegroups.com 
View archives, change email options, or unsubscribe: 
http://groups.google.com/group/chromium-dev
-~--~~~~--~~--~--~---



[chromium-dev] Re: Spam on chromium-reviews

2009-03-06 Thread Ian Fette
I enabled moderation for new senders. This shouldn't cause the problem Peter
mentions below, though may cause delays for new posters. Hopefully between
myself and others we can moderate reasonably efficiently (we're already
doing this for dev, many -bugs messages get held for moderation because they
look like spam, and we seem to have a reasonable turnaround time.)
-Ian

On Fri, Mar 6, 2009 at 10:38 AM, Peter Kasting pkast...@chromium.orgwrote:

 On Fri, Mar 6, 2009 at 10:34 AM, John Abd-El-Malek j...@chromium.orgwrote:

 I'm guessing I'm not the only one who's irritated by it.  Can we make it
 so that only members can post to chromium-reviews?  We can automatically
 subscribe everyone who's sent a review in the last month or something.


 Would this prevent random new people from submitting a patch to Rietveld
 and having it mailed out for review?

 We might have to ask Jon Conradt to moderate first posts like he does
 already for some of the other lists.

 PK

 


--~--~-~--~~~---~--~~
Chromium Developers mailing list: chromium-dev@googlegroups.com 
View archives, change email options, or unsubscribe: 
http://groups.google.com/group/chromium-dev
-~--~~~~--~~--~--~---



[chromium-dev] Re: Profile Corruption, cause?

2009-03-06 Thread Scott Hess

If SQLite is crashing due to corruption in the database, we should be
able to get Dr Hipp to help fix it.  But we'd need a repeatable case
to send to him.  If we had a database which demonstrated this, I could
certainly see about crafting a simplified database of example data to
replicate the problem.

If it's due to the in-memory data structures being corrupted, that's a
whole 'nother kettle of fish, I'm not sure what SQLite can really do
about that.  An idea I've had in the past was so implement a custom
memory allocator to keep the SQLite data structures in a distinct zone
from regular data structures, so that you at least can't get the case
of stale references being used to overwrite data structures, and
should help protect against other code's buffer overflows.  Random
rogue pointers would still be dangerous, though!

Some of our databases we preemptively read to warm up the disk cache,
so just running PRAGMA integrity_check; might be cheap enough to be
useful.  Another option we could consider would be adding (or looking
for) code to checksum pages.  We could also perhaps implement
independent page validity checks at the VFS layer, before things go to
disk, to protect against in-memory structures being corrupted, which
could at least keep things valid at a metadata level.

In my experience SQLite is pretty good about throwing SQLITE_CORRUPT
when it detects corruption, but due to how data is encoded there are a
lot of cases where the corruption is not easy to detect w/in SQLite
(you get back garbage, but it's well-formed garbage :-).  If SQLite
itself is overrunning buffers or something, that's a definite bug
which I'm sure Dr Hipp would be interested in helping fix.

-scott


On Fri, Mar 6, 2009 at 10:02 AM, Erik Kay erik...@chromium.org wrote:

 On Fri, Mar 6, 2009 at 9:33 AM, Brett Wilson bre...@google.com wrote:
 Getting the database has helped in a few cases where it turned out some
 assumptions were being violated, but if the sqlite data structures are
 corrupted, getting the DB has never been helpful to diagnose the root cause.

 It might help us make sqlite not crash for these types of corruption,
 though.

 I think we should install an exception handler on the DB threads, and if we
 get two crashes in a row from sqlite, recreate the DB.

 Yep.  This would be nice.  If these crashes are really this frequent,
 perhaps we should move the db out of the browser process. Or perhaps
 we could simply have an out of process validator that we could run if
 we got a single browser crash from sqlite.

 Erik



 Brett

 On Mar 6, 2009 9:19 AM, Erik Kay erik...@chromium.org wrote:


 One thing that would help is if some of the users who are running into
 this would be willing to share their whole profile with us.

 While our best guess is that this is sqlite corruption, we don't know
 for sure.  Even if it is sqlite corruption, having the specific db
 might help us figure out how to more reliably detect it.

 Erik

 On Thu, Mar 5, 2009 at 10:39 PM, Finnur Thorarinsson fin...@chromium.org
 wrote:  I suspect this...

 


--~--~-~--~~~---~--~~
Chromium Developers mailing list: chromium-dev@googlegroups.com 
View archives, change email options, or unsubscribe: 
http://groups.google.com/group/chromium-dev
-~--~~~~--~~--~--~---



[chromium-dev] Re: Unit tests and anonymous namespaces.

2009-03-06 Thread Scott Hess

I just wanted to make sure I understood your proposal.

Right now, test classes want to be in the anonymous namespace so that
unit test files do not have to coordinate with each other in the
naming of test classes.  With your proposal, the thing which is
exposed outside of the anonymous namespace (MyClassPeer) is based on a
thing already known to be unique (MyClass), so coordinate is not an
issue unless you have multiple unit test files testing the same class.
 There are still just as many items exposed outside of the anonymous
namespace, but they are named in a way which prevents collisions.

Is that about right?

Thanks,
scott


On Tue, Mar 3, 2009 at 4:49 PM, William Chan (陈智昌)
willc...@chromium.org wrote:
 My old team never really used FRIEND_TEST.  We found it ugly that our
 production code depended on test code.  We typically used friended
 Peer classes defined in the unittest file, but not in the anonymous
 namespace.  These are simple shims that provide access to the private
 section.  It also saves on having to FRIEND_TEST each individual test
 as you add them.  It looks like almost every time FRIEND_TEST is used,
 it's used for multiple tests, not just a single one.  I'm not sure how
 much of a problem chrome has with build dependencies leading to
 rebuilds, but it was very annoying in google projects to add a
 FRIEND_TEST to a widely used .h file, thus forcing everyone to
 rebuild, even though you're only adding a new test.

 On Tue, Mar 3, 2009 at 4:30 PM, Darin Fisher da...@chromium.org wrote:
 On Tue, Mar 3, 2009 at 3:55 PM, Scott Hess sh...@chromium.org wrote:

 On the Mac, code like this:

 namespace {
 class MyTest : public testing::Test {
 };
 }  // namespace

 TEST_F(MyTest, ATest) {
 }

 generates errors like this:
 warning: 'MyTest_ATest_Test' has a field
 'MyTest_ATest_Test::anonymous' whose type uses the anonymous
 namespace
 warning: 'MyTest_ATest_Test' has a base 'unnamed::MyTest' whose type
 uses the anonymous namespace

 Removing the namespace fixes it, which is poor because we seem to want
 to move towards more anonymous namespace use.  Putting the test case
 inside the namespace also fixes it, but is incompatible with
 FRIEND_TEST().  This seems to be a gcc 4.2 addition, per:
  http://gcc.gnu.org/gcc-4.2/changes.html

 Members of the anonymous namespace are now local to a particular
 translation unit, along with any other declarations which use them,
 though they are still treated as having external linkage for language
 semantics.

 At this point, I'm sort of at the bleeding edge of my knowledge.  For
 FRIEND_TEST() cases, it seems like the anonymous namespace needs to
 go, but elsewhere it can be changed to enclose the entire file.  Does
 that seem reasonable for now?

 -scott


 Assuming that you really need to use TEST_F, then it would be unfortunate to
 lose the anonymous namespace.  The anonymous namespace has allowed us to
 have short names for helper classes used by tests without fear of colliding
 with other short names used by other tests.  (We have had those kinds of
 conflicts in the past.)
 We don't use FRIEND_TEST that much.  Maybe we can just use #ifdef UNIT_TEST
 to expose class APIs to unit tests?
 -Darin
 



--~--~-~--~~~---~--~~
Chromium Developers mailing list: chromium-dev@googlegroups.com 
View archives, change email options, or unsubscribe: 
http://groups.google.com/group/chromium-dev
-~--~~~~--~~--~--~---



[chromium-dev] Re: Unit tests and anonymous namespaces.

2009-03-06 Thread 陈智昌

2009/3/6 Scott Hess sh...@chromium.org:
 I just wanted to make sure I understood your proposal.

 Right now, test classes want to be in the anonymous namespace so that
 unit test files do not have to coordinate with each other in the
 naming of test classes.  With your proposal, the thing which is
 exposed outside of the anonymous namespace (MyClassPeer) is based on a
 thing already known to be unique (MyClass), so coordinate is not an
 issue unless you have multiple unit test files testing the same class.
  There are still just as many items exposed outside of the anonymous
 namespace, but they are named in a way which prevents collisions.

 Is that about right?

Mostly right.  It's fewer things exposed outside of the anonymous
namespace, since previously you needed each TEST/TEST_F class to exist
outside the anonymous namespace in order for you to FRIEND_TEST it.
In this way, you only have one Peer per class you're testing.  I don't
know enough about Chrome yet, but if there were some very commonly
used classes, then it might make sense to put the Peer class in a
header file for multiple tests to share.  My gut instinct is this use
case doesn't happen enough in Chrome to make it worthwhile, but I have
no clue.  It made more sense in the Google code base for various
reasons.

Also, I'm a big fan of testing via the public interface methods as
much as possible.  Hopefully we don't need to friend most classes in
order to tell them well.


 Thanks,
 scott


 On Tue, Mar 3, 2009 at 4:49 PM, William Chan (陈智昌)
 willc...@chromium.org wrote:
 My old team never really used FRIEND_TEST.  We found it ugly that our
 production code depended on test code.  We typically used friended
 Peer classes defined in the unittest file, but not in the anonymous
 namespace.  These are simple shims that provide access to the private
 section.  It also saves on having to FRIEND_TEST each individual test
 as you add them.  It looks like almost every time FRIEND_TEST is used,
 it's used for multiple tests, not just a single one.  I'm not sure how
 much of a problem chrome has with build dependencies leading to
 rebuilds, but it was very annoying in google projects to add a
 FRIEND_TEST to a widely used .h file, thus forcing everyone to
 rebuild, even though you're only adding a new test.

 On Tue, Mar 3, 2009 at 4:30 PM, Darin Fisher da...@chromium.org wrote:
 On Tue, Mar 3, 2009 at 3:55 PM, Scott Hess sh...@chromium.org wrote:

 On the Mac, code like this:

 namespace {
 class MyTest : public testing::Test {
 };
 }  // namespace

 TEST_F(MyTest, ATest) {
 }

 generates errors like this:
 warning: 'MyTest_ATest_Test' has a field
 'MyTest_ATest_Test::anonymous' whose type uses the anonymous
 namespace
 warning: 'MyTest_ATest_Test' has a base 'unnamed::MyTest' whose type
 uses the anonymous namespace

 Removing the namespace fixes it, which is poor because we seem to want
 to move towards more anonymous namespace use.  Putting the test case
 inside the namespace also fixes it, but is incompatible with
 FRIEND_TEST().  This seems to be a gcc 4.2 addition, per:
  http://gcc.gnu.org/gcc-4.2/changes.html

 Members of the anonymous namespace are now local to a particular
 translation unit, along with any other declarations which use them,
 though they are still treated as having external linkage for language
 semantics.

 At this point, I'm sort of at the bleeding edge of my knowledge.  For
 FRIEND_TEST() cases, it seems like the anonymous namespace needs to
 go, but elsewhere it can be changed to enclose the entire file.  Does
 that seem reasonable for now?

 -scott


 Assuming that you really need to use TEST_F, then it would be unfortunate to
 lose the anonymous namespace.  The anonymous namespace has allowed us to
 have short names for helper classes used by tests without fear of colliding
 with other short names used by other tests.  (We have had those kinds of
 conflicts in the past.)
 We don't use FRIEND_TEST that much.  Maybe we can just use #ifdef UNIT_TEST
 to expose class APIs to unit tests?
 -Darin
 




--~--~-~--~~~---~--~~
Chromium Developers mailing list: chromium-dev@googlegroups.com 
View archives, change email options, or unsubscribe: 
http://groups.google.com/group/chromium-dev
-~--~~~~--~~--~--~---



[chromium-dev] Re: Unit tests and anonymous namespaces.

2009-03-06 Thread Scott Hess

2009/3/6 William Chan (陈智昌) willc...@chromium.org:
 2009/3/6 Scott Hess sh...@chromium.org:
 I just wanted to make sure I understood your proposal.

 Right now, test classes want to be in the anonymous namespace so that
 unit test files do not have to coordinate with each other in the
 naming of test classes.  With your proposal, the thing which is
 exposed outside of the anonymous namespace (MyClassPeer) is based on a
 thing already known to be unique (MyClass), so coordinate is not an
 issue unless you have multiple unit test files testing the same class.
  There are still just as many items exposed outside of the anonymous
 namespace, but they are named in a way which prevents collisions.

 Is that about right?

 Mostly right.  It's fewer things exposed outside of the anonymous
 namespace, since previously you needed each TEST/TEST_F class to exist
 outside the anonymous namespace in order for you to FRIEND_TEST it.
 In this way, you only have one Peer per class you're testing.  I don't
 know enough about Chrome yet, but if there were some very commonly
 used classes, then it might make sense to put the Peer class in a
 header file for multiple tests to share.  My gut instinct is this use
 case doesn't happen enough in Chrome to make it worthwhile, but I have
 no clue.  It made more sense in the Google code base for various
 reasons.

 Also, I'm a big fan of testing via the public interface methods as
 much as possible.  Hopefully we don't need to friend most classes in
 order to tell them well.

The complaint I got about putting the test class outside the anonymous
namespace is that there was another completely unrelated test far away
which used the same name (and was also outside the anonymous
namespace, but could be put inside).  Having files implementing
unittests around a single class needing to coordinate with each other
seems much more reasonable.

Thanks,
scott

--~--~-~--~~~---~--~~
Chromium Developers mailing list: chromium-dev@googlegroups.com 
View archives, change email options, or unsubscribe: 
http://groups.google.com/group/chromium-dev
-~--~~~~--~~--~--~---



[chromium-dev] Re: More plugin questions

2009-03-06 Thread John Abd-El-Malek
Hi Vijay,
It sounds like reading up on NPAPI and how Windows applications paint is in
order :)

Here are some documents:

Here's the high level link about NPAPI on the Mozilla docs, links to samples
etc: https://developer.mozilla.org/en/Plugins
This is the reference for NPAPI:
https://developer.mozilla.org/en/Gecko_Plugin_API_Reference

Here's the MSDN page on GDI, which shows how to paint into bitmaps etc:
http://msdn.microsoft.com/en-us/library/dd145203(VS.85).aspx

I'll fill in a few answers below.


On Fri, Mar 6, 2009 at 2:03 PM, eager_learner
vijay.sankar.ra...@gmail.comwrote:


 Thanks John and Marshall. I have much work done in the lines of what
 Marshall has suggested except that I did this in the plugin_list.cc as
 opposed to plugin_list_win.cc. I got all my clues from the default
 plugin. I am able to get the stream for the content-type as desired. I
 just dont know what is available in terms of UI for me to display.

 At the end of my followup questions are things I have done [GOTO ABC
 at the end of my questions]

 Q1. SetWindow entry point function similar to NPP_SetWindow gets
 passed a parameter of type NPWindow
//static NPError SetWindow_metalink(NPP instance, NPWindow
 *window)
a)   How can this be used to display anything for the plugin?


see the npapi documentation.  depending on whether it's
windowed/windoweless, you'll either have to run a message loop for the HWND,
or you'll be called with an HDC (on windows) to paint.




b)   window-window is of type void*  and is expected to be a
 window handle. Can this be platform agnostic(Win32/Linux...)? Are


no



 there Chrome API wrappers that abstract details of Windowing and
 rendering? I would assume that this is part of Webkit. I have no clue
 about this. Pointers to docs and smaple code highly appreciated.

 Q2. Regarding the archtecture document

 http://sites.google.com/a/chromium.org/dev/developers/design-documents/plugin-architecture,there
 is
i. a browser process
ii. a rendering tab process  and
   iii. a plugin process




   Assuming that the Entrypoint functions are running in the plugin
 process (??? correct me), how will the plugin process communicate with
 the rendering process to
   display what it needs to?


you don't need to worry about any of this, it's all handled transparently.
 you just need to implement the NPAPI entry points.


 The WebKit is shown to be part of the
 rendering process. Does the plugin writer need to be aware of the IPC
 mechanism defined in chrome
   and if so where could I find that.

 Q3. What I would like to do is have a dynamically generated HTML page
 with a table of items based on the stream that I get in NPP_Write
 function. Can I summon the renderer via the NPWindow argument? Any


no.  but you can script the renderer.  see NPObject in the NPAPI
documentation.


 Example code for this?

 Q4. A general question I have on browser plugins is whether the screen
 blitz is platform independent (Win32, Linux etc).


no


 Is there any
 conditionally compiled code that plugin developers generally have for
 display. This question is rephrasing Q1.b.

 Q5. Since I am working on the metalink plugin [PoC] as an internal
 plugin, I will need the plugin-process to spawn threads
 (chomeThread??) to download each piece concurrantly. Is there a
 document explaining to developers API like ChromeThread etc?


the documentation for the chrome classes is mostly in the headers.



 Below is the summary of where I have reached.

 ABC:
 //in plugin_list.cc in PluginList::PluginList() I added the following
#if defined (OS_WIN )
#if defined (METALINK)
  const PluginVersionInfo metalink_plugin = {
  FilePath(kDefaultPluginLibraryName),
  LMetalink Plug-in,
  LProvides the starting point for Metalink
 plugin to be
 registered and called appropriately,
  L1,
  Lapplication/metalink+xml,
  Lmetalink,
  LSomething,
  {
metalink_plugin::NP_GetEntryPoints,
metalink_plugin::NP_Initialize,
metalink_plugin::NP_Shutdown
  }
  };
  internal_plugins_.push_back(metalink_plugin);
#endif
#endif

 My Entrypoints for NPAPI are also defined
NPError API_CALL NP_GetEntryPoints(NPPluginFuncs*
 funcs)
{
#if 0
  int * p = 0;
  *p = 22; // my assert
#endif
  funcs-version = 1;