Bug 85758

Summary: [Chromium] Move clipboard to Platform.h
Product: WebKit Reporter: Mark Pilgrim (Google) <pilgrim>
Component: WebKit Misc.Assignee: Mark Pilgrim (Google) <pilgrim>
Status: RESOLVED FIXED    
Severity: Normal CC: abarth, dglazkov, eric, fishd, haraken, jamesr, tkent+wkapi, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 82948    
Attachments:
Description Flags
Patch
none
Patch
none
WIP Patch
none
Patch
none
Patch none

Description Mark Pilgrim (Google) 2012-05-06 19:00:05 PDT
[Chromium] Move clipboard to Platform.h
Comment 1 Mark Pilgrim (Google) 2012-05-06 19:00:37 PDT
Created attachment 140449 [details]
Patch
Comment 2 WebKit Review Bot 2012-05-06 19:02:57 PDT
Please wait for approval from abarth@webkit.org, dglazkov@chromium.org, fishd@chromium.org, jamesr@chromium.org or tkent@chromium.org before submitting, as this patch contains changes to the Chromium public API. See also https://trac.webkit.org/wiki/ChromiumWebKitAPI.
Comment 3 Adam Barth 2012-05-06 20:44:59 PDT
Comment on attachment 140449 [details]
Patch

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

> Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h:-54
> -class WebClipboard;

You can probably guess what I'm going to say at this point.  :)

WebClipboard.h and its dependencies are already in Source/WebKit/chromium/public/platform, so they should be easy to move at the same time.
Comment 4 Mark Pilgrim (Google) 2012-05-07 07:19:07 PDT
Created attachment 140525 [details]
Patch
Comment 5 WebKit Review Bot 2012-05-07 07:25:14 PDT
Comment on attachment 140525 [details]
Patch

Attachment 140525 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/12647056
Comment 6 Adam Barth 2012-05-07 10:20:51 PDT
Comment on attachment 140525 [details]
Patch

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

> Source/Platform/chromium/public/WebClipboard.h:42
> +class WebDragData;
> +class WebImage;

Please move these dependencies too.  The idea is that there shouldn't be any dependencies from the Platform layer to the WebKit layer.  (Dependencies from WebKit to Platform are fine.)  Here's a diagram that's intended to illustrate that relation:

https://docs.google.com/drawings/d/1GJXd6XSLEehvuqA7Xbvbz0OH6Znnr2iTijihjrEY0ts/edit
Comment 7 Adam Barth 2012-05-07 10:22:52 PDT
To avoid breaking the compile when moving these APIs around, we've been introducing "forwarding" headers like the following:

http://trac.webkit.org/browser/trunk/Source/WebKit/chromium/public/platform/WebURL.h

Once we've finished factoring the Platform API out of the WebKit API, we'll update all the users of the API to use the new header locations and remove these forwarding headers.
Comment 8 Mark Pilgrim (Google) 2012-05-07 12:03:39 PDT
Created attachment 140566 [details]
WIP Patch
Comment 9 Mark Pilgrim (Google) 2012-05-07 12:05:17 PDT
Still WIP.
Comment 10 Mark Pilgrim (Google) 2012-05-09 11:36:01 PDT
Created attachment 140986 [details]
Patch
Comment 11 Mark Pilgrim (Google) 2012-05-09 11:36:37 PDT
(In reply to comment #6)
> (From update of attachment 140525 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=140525&action=review
> 
> > Source/Platform/chromium/public/WebClipboard.h:42
> > +class WebDragData;
> > +class WebImage;
> 
> Please move these dependencies too.

Done in latest patch.
Comment 12 James Robinson 2012-05-09 11:41:48 PDT
Comment on attachment 140986 [details]
Patch

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

> Source/Platform/chromium/public/Platform.h:67
>      // Must return non-null.
> +    virtual WebClipboard* clipboard() { return 0; }
> +
> +    // Must return non-null.
>      virtual WebMimeRegistry* mimeRegistry() { return 0; }

these comments are kind of weird with the default impls

> Source/Platform/chromium/public/WebImage.h:40
> +#elif WEBKIT_USING_CG
> +typedef struct CGImage* CGImageRef;
> +#endif

this isn't necessarily something you have to do, but we should delete all the WEBKIT_USING_CG code from chromium code ASAPly
Comment 13 Eric Seidel (no email) 2012-05-09 11:46:17 PDT
(In reply to comment #12)
> (From update of attachment 140986 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=140986&action=review
> > Source/Platform/chromium/public/WebImage.h:40
> > +#elif WEBKIT_USING_CG
> > +typedef struct CGImage* CGImageRef;
> > +#endif
> 
> this isn't necessarily something you have to do, but we should delete all the WEBKIT_USING_CG code from chromium code ASAPly

When I was looking at removing BUILDING_ON_LEOPARD code the other day, I looked at removing CHROMIUM branches from various bits of cg, mac and cocoa files, but it was't clear to me what parts were still in use by Chromium and which weren't.
Comment 14 James Robinson 2012-05-09 11:50:18 PDT
(In reply to comment #13)
> (In reply to comment #12)
> > (From update of attachment 140986 [details] [details])
> > View in context: https://bugs.webkit.org/attachment.cgi?id=140986&action=review
> > > Source/Platform/chromium/public/WebImage.h:40
> > > +#elif WEBKIT_USING_CG
> > > +typedef struct CGImage* CGImageRef;
> > > +#endif
> > 
> > this isn't necessarily something you have to do, but we should delete all the WEBKIT_USING_CG code from chromium code ASAPly
> 
> When I was looking at removing BUILDING_ON_LEOPARD code the other day, I looked at removing CHROMIUM branches from various bits of cg, mac and cocoa files, but it was't clear to me what parts were still in use by Chromium and which weren't.

That's slightly different.  We never use CoreGraphics as the backend for GraphicsContext in Chromium, but we do still use some CG stuff in various bits of system integration (like theming code, iirc).  My understanding is that WEBKIT_USING_CG means "Using CoreGraphics as the raster backend", which we never set, but that may not be the meaning of all the code in cg/ mac/ cocoa/.
Comment 15 WebKit Review Bot 2012-05-09 12:34:05 PDT
Comment on attachment 140986 [details]
Patch

Attachment 140986 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/12665003
Comment 16 Mark Pilgrim (Google) 2012-05-09 12:37:50 PDT
(In reply to comment #15)
> (From update of attachment 140986 [details])
> Attachment 140986 [details] did not pass chromium-ews (chromium-xvfb):
> Output: http://queues.webkit.org/results/12665003

Is this because I removed WebClipboard.h from Source/WebKit/chromium/WebKit.gyp?
Comment 17 Mark Pilgrim (Google) 2012-05-09 12:38:37 PDT
...and if so, why didn't I catch this in my local build? What am I doing differently from the bots?
Comment 18 Adam Barth 2012-05-09 14:04:07 PDT
Looks like you forgot to svn add Source/Platform/chromium/public/WebClipboard.h
Comment 19 Mark Pilgrim (Google) 2012-05-09 14:33:58 PDT
(In reply to comment #18)
> Looks like you forgot to svn add Source/Platform/chromium/public/WebClipboard.h

Grr.
Comment 20 Mark Pilgrim (Google) 2012-05-09 14:37:39 PDT
Created attachment 141016 [details]
Patch
Comment 21 Mark Pilgrim (Google) 2012-05-09 14:41:12 PDT
Filed bug bug 86018 for removing code behind WEBKIT_USING_CG
Comment 22 Adam Barth 2012-05-09 14:53:53 PDT
Comment on attachment 141016 [details]
Patch

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

> Source/Platform/chromium/public/Platform.h:67
>      // Must return non-null.
> +    virtual WebClipboard* clipboard() { return 0; }
> +
> +    // Must return non-null.
>      virtual WebMimeRegistry* mimeRegistry() { return 0; }

These comments do seem odd next to these default implementations, but I think its ok.  Can we use ASSERT_NOT_REACHED() in API headers?  I suspect we're not able to.

> Source/WebKit/chromium/src/DragClientImpl.cpp:43
>  
> +#include <public/WebDragData.h>

There's no need for this blank line.

> Source/WebKit/chromium/src/WebDragData.cpp:42
> +#include <public/WebDragData.h>

This header should have been left just after config.  You probably got a style warning, but that's a bug in the style checker.
Comment 23 WebKit Review Bot 2012-05-09 15:50:08 PDT
Comment on attachment 141016 [details]
Patch

Clearing flags on attachment: 141016

Committed r116566: <http://trac.webkit.org/changeset/116566>
Comment 24 WebKit Review Bot 2012-05-09 15:50:14 PDT
All reviewed patches have been landed.  Closing bug.