Bug 61925

Summary: Add layer factory to GraphicsLayer for creating non-default layer type.
Product: WebKit Reporter: Viatcheslav Ostapenko <ostap73>
Component: WebKit2Assignee: Noam Rosenthal <noam>
Status: RESOLVED FIXED    
Severity: Normal CC: eric, kenneth, noam, ossy, simon.fraser, webkit.review.bot, yael
Priority: P3 Keywords: Qt
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Bug Depends on:    
Bug Blocks: 47068, 56935    
Attachments:
Description Flags
Layer factory method implementation.
none
Fix style error
none
Patch
none
Patch
none
Patch based on smfr's comments
kenneth: review+
Patch with an additional comment
none
Patch: Use GraphicsLayerFactory in TextureMapper none

Description Viatcheslav Ostapenko 2011-06-02 07:21:15 PDT
Webkit2 Qt implementation will use this to create graphics layers.
Comment 1 Viatcheslav Ostapenko 2011-06-02 07:28:18 PDT
Created attachment 95761 [details]
Layer factory method implementation.
Comment 2 WebKit Review Bot 2011-06-02 07:30:49 PDT
Attachment 95761 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/ChangeLog', u'Source/WebCor..." exit_code: 1

Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h:94:  The parameter name "factory" adds no information, so it should be removed.  [readability/parameter_name] [5]
Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:428:  Missing space before ( in if(  [whitespace/parens] [5]
Total errors found: 2 in 3 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Viatcheslav Ostapenko 2011-06-02 07:38:29 PDT
Created attachment 95762 [details]
Fix style error
Comment 4 Kenneth Rohde Christiansen 2011-06-05 09:06:54 PDT
As always would be nice with No'am's input
Comment 5 Kenneth Rohde Christiansen 2011-06-05 09:08:23 PDT
Comment on attachment 95762 [details]
Fix style error

View in context: https://bugs.webkit.org/attachment.cgi?id=95762&action=review

> Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:421
> +void GraphicsLayerTextureMapper::setGraphicsLayerFactory(GraphicsLayerFactory factory)

What is this set method needed for?
Comment 6 Noam Rosenthal 2011-06-05 09:12:49 PDT
(In reply to comment #4)
> As always would be nice with No'am's input

I'm working closely with Slava on all of these patches.
Comment 7 Kenneth Rohde Christiansen 2011-06-05 09:14:10 PDT
(In reply to comment #6)
> (In reply to comment #4)
> > As always would be nice with No'am's input
> 
> I'm working closely with Slava on all of these patches.

Having noted in the bug report that you are ok with the change would be nice :-)
Comment 8 Noam Rosenthal 2011-06-05 09:15:56 PDT
(In reply to comment #5)
> (From update of attachment 95762 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=95762&action=review
> 
> > Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:421
> > +void GraphicsLayerTextureMapper::setGraphicsLayerFactory(GraphicsLayerFactory factory)
> 
> What is this set method needed for?
The WebProcess uses a different GraphicsLayer implementation than the UI process or WebKit1. So the idea is that the WebProcess would call this function on its startup to override the default GraphicsLayer::create.
Comment 9 Noam Rosenthal 2011-06-08 19:19:41 PDT
I feel like the factory function should be in GraphicsLayer and not in GraphicsLayerTextureMapper. I'll post a patch soon.
Comment 10 Noam Rosenthal 2011-06-08 21:42:06 PDT
Created attachment 96543 [details]
Patch

Moved the implementation from GraphicsLayerTextureMapper to GraphicsLayer. This will allow other ports that want to use GraphicsLayer across processes to use this factory, without relying on TextureMapper.
Comment 11 Noam Rosenthal 2011-06-08 23:03:36 PDT
The build failure of windows is a problem with the test bot.
Comment 12 Simon Fraser (smfr) 2011-06-08 23:14:08 PDT
Comment on attachment 96543 [details]
Patch

Can't you just declare a static GraphicsLayer::create() method, and have the implementation in each platform's impl file?
Comment 13 Noam Rosenthal 2011-06-08 23:20:24 PDT
(In reply to comment #12)
> (From update of attachment 96543 [details])
> Can't you just declare a static GraphicsLayer::create() method, and have the implementation in each platform's impl file?

It's a bit more complicated...
We need a different implementation if we're in the web process vs. if we are in the UI process.
Comment 14 Noam Rosenthal 2011-06-08 23:22:06 PDT
(In reply to comment #13)
> (In reply to comment #12)
> > (From update of attachment 96543 [details] [details])
> > Can't you just declare a static GraphicsLayer::create() method, and have the implementation in each platform's impl file?
> 
> It's a bit more complicated...
> We need a different implementation if we're in the web process vs. if we are in the UI process.

I mean, a different implementation if we're in the web process vs. if we're in WebKit1. 
This is the only way we can use GraphicsLayers in this way with WebCore being compiled once for WebKit2 and WebKit1.
Comment 15 Simon Fraser (smfr) 2011-06-09 06:45:10 PDT
Comment on attachment 96543 [details]
Patch

Are you going to convert GraphicsLayer::create() to go through the factory for everyone, or just Qt?
Comment 16 Noam Rosenthal 2011-06-09 07:23:36 PDT
(In reply to comment #15)
> (From update of attachment 96543 [details])
> Are you going to convert GraphicsLayer::create() to go through the factory for everyone, or just Qt?

Just Qt. I considered doing that for everyone but it's too complicated, since people might call GraphicsLayer::create from within their code.
Comment 17 Noam Rosenthal 2011-06-09 07:29:53 PDT
Created attachment 96586 [details]
Patch

Revised the patch, added more information in the ChangeLog.
Comment 18 Simon Fraser (smfr) 2011-06-09 11:27:08 PDT
I think the factory stuff should be #ifdeffed for Qt then.
Comment 19 Noam Rosenthal 2011-06-09 12:02:05 PDT
(In reply to comment #18)
> I think the factory stuff should be #ifdeffed for Qt then.

OK, I'll do that, and if other ports want to use the factory they can add it to the #ifdef.
Comment 20 Noam Rosenthal 2011-06-09 20:22:24 PDT
Created attachment 96693 [details]
Patch based on smfr's comments
Comment 21 Kenneth Rohde Christiansen 2011-06-10 01:37:59 PDT
Comment on attachment 96693 [details]
Patch based on smfr's comments

View in context: https://bugs.webkit.org/attachment.cgi?id=96693&action=review

> Source/WebCore/platform/graphics/GraphicsLayer.h:372
> +    typedef PassOwnPtr<GraphicsLayer> GraphicsLayerFactory(GraphicsLayerClient*);
> +    static void setGraphicsLayerFactory(GraphicsLayerFactory);

We need a comment here explaining what it is for as that is not totally obvious - at least to me.
Comment 22 Noam Rosenthal 2011-06-10 04:39:49 PDT
Created attachment 96733 [details]
Patch with an additional comment
Comment 23 WebKit Review Bot 2011-06-10 04:55:34 PDT
The commit-queue encountered the following flaky tests while processing attachment 96733 [details]:

http/tests/local/stylesheet-and-script-load-order.html bug 62450 (author: koivisto@iki.fi)
The commit-queue is continuing to process your patch.
Comment 24 WebKit Review Bot 2011-06-10 04:56:48 PDT
Comment on attachment 96733 [details]
Patch with an additional comment

Clearing flags on attachment: 96733

Committed r88541: <http://trac.webkit.org/changeset/88541>
Comment 25 WebKit Review Bot 2011-06-10 04:56:54 PDT
All reviewed patches have been landed.  Closing bug.
Comment 26 Noam Rosenthal 2011-06-12 20:00:47 PDT
Created attachment 96911 [details]
Patch: Use GraphicsLayerFactory in TextureMapper
Comment 27 WebKit Review Bot 2011-06-13 09:17:07 PDT
Comment on attachment 96911 [details]
Patch: Use GraphicsLayerFactory in TextureMapper

Clearing flags on attachment: 96911

Committed r88643: <http://trac.webkit.org/changeset/88643>
Comment 28 WebKit Review Bot 2011-06-13 09:17:13 PDT
All reviewed patches have been landed.  Closing bug.