Bug 23776 - Introduce 2 base classes to split WorkerMessaingProxy.
Summary: Introduce 2 base classes to split WorkerMessaingProxy.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks: 23777
  Show dependency treegraph
 
Reported: 2009-02-05 18:38 PST by Jian Li
Modified: 2009-02-09 02:02 PST (History)
2 users (show)

See Also:


Attachments
Proposed Patch (11.37 KB, patch)
2009-02-05 18:43 PST, Jian Li
no flags Details | Formatted Diff | Diff
Proposed Patch (11.04 KB, patch)
2009-02-06 13:18 PST, Jian Li
no flags Details | Formatted Diff | Diff
Proposed Patch (10.95 KB, patch)
2009-02-06 17:40 PST, Jian Li
ap: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jian Li 2009-02-05 18:38:55 PST
In order to support running Worker in other process, i.e. Chrome's worker process, we need to split WorkerMessagingProxy into two pieces.
Comment 1 Jian Li 2009-02-05 18:43:55 PST
Created attachment 27374 [details]
Proposed Patch

This patch only adds these two base classes. The next patch will change WorkerMessagingProxy to derive from these two base classes.
Comment 2 David Levin 2009-02-06 02:56:44 PST
ChangeLog:
  WorkerMessaingProxy sp

   // A proxy to talk to the worker context.
I'm not sure that this comment adds much info.

  // Creator.
This comment should be omitted.

   static WorkerContextProxyBase* create(const String& scriptURL, Worker* worker);
The param "worker" doesn't add any info so it should be omited.

Also I don't think this method is implemented yet, so it probably shouldn't be here.

Lastly, it bring up lifetime issues.  Is this class deleted by who ever creates it.  I suspect the lifetime will be more like WorkerMessagingProxy and this class will need a method like "void workerObjectDestroyed();"  (something to signal the class that the WorkerObject is done with it).


The per method comments throughout seem to repeat the method name and should just be omitted.

The vcproj file references .cpp files that aren't part of the patch.

I think GNUMakefile.am needs to have the header files added to it.  
Comment 3 David Levin 2009-02-06 10:14:34 PST
I was thinking about the Base suffix.  I don't think it is needed here because the classes are intended to pure virtual so there will not be a WorkerContextProxy that adds non virtual methods.

It is usually used when you want a class that is non-platform specific but files need to refer to the non base version.  For example, you could have "class FooBase" in platform but files in WebCore/dom would refer to class Foo and #include "foo.h" but foo.h would be in a platform specific directory like platform/win/foo.h.
   
Lastly, if implementation of these classes is going to be platform specific, then dom isn't the correct directory for them.  You'd want WebCore/platform.
Comment 4 David Levin 2009-02-06 10:56:50 PST
Actually, I take back the comment about moving them to platform because there is a dom dependency.

It is fine where it is, but it will need to be moved before implementing platform specific items.


Comment 5 Jian Li 2009-02-06 13:18:52 PST
Created attachment 27413 [details]
Proposed Patch
Comment 6 David Levin 2009-02-06 13:24:09 PST
Comment on attachment 27374 [details]
Proposed Patch

Marking as obsolete due to new patch.
Comment 7 David Levin 2009-02-06 15:16:09 PST
These issues appear unaddressed:

ChangeLog:
  WorkerMessaingProxy sp

   // A proxy to talk to the worker context.
I'm not sure that this comment adds much info.

  // Creator.
This comment should be omitted.

   static WorkerContextProxyBase* create(const String& scriptURL, Worker*
worker);
The param "worker" doesn't add any info so it should be omited.

Also I don't think this method is implemented yet, so it probably shouldn't be
here.

Lastly, it bring up lifetime issues.  Is this class deleted by who ever creates
it.  I suspect the lifetime will be more like WorkerMessagingProxy and this
class will need a method like "void workerObjectDestroyed();"  (something to
signal the class that the WorkerObject is done with it).


The per method comments throughout seem to repeat the method name and should
just be omitted.


I think GNUMakefile.am needs to have the header files added to it.  
Comment 8 Jian Li 2009-02-06 17:40:45 PST
Created attachment 27441 [details]
Proposed Patch

I fixed all the problems excepted those as commented below.

I still keep the comment for the whole class since it clarifies what the class is intended for.

I do not add workerObjectDestroyed to WorkerConextProxy class since I think we can merge it into terminateWorkerContext.
Comment 9 David Levin 2009-02-07 23:03:51 PST
Comment on attachment 27413 [details]
Proposed Patch

New patch makes this one obsolete.
Comment 10 David Levin 2009-02-07 23:08:23 PST
Looks good to me.

As suggested by dimich, after this check in, I think we'll need to move this and some other worker classes to a WebCore/workers dir (and then we'll have platform specific directories under that).

Comment 11 Alexey Proskuryakov 2009-02-09 01:57:20 PST
Comment on attachment 27441 [details]
Proposed Patch

> +namespace WebCore {
> +    class String;

We usually add an empty line here.

+        virtual void postMessageToWorkerContext(const String& message) = 0;
+        virtual void postMessageToWorkerObject(const String& message) = 0;

The argument name can be omitted in these functions.

r=me
Comment 12 Alexey Proskuryakov 2009-02-09 02:02:54 PST
Committed revision 40780.

When creating patches, please make sure that the current directory is WebKit root - that will make them easier to apply. To make directory scanning faster, you can pass a list to svn-create-patch, e.g.:

svn-create-patch WebCore LayoutTests/ChangeLog LayoutTests/fast/workers