RESOLVED FIXED 89870
[WK2] Add support for Network Information API
https://bugs.webkit.org/show_bug.cgi?id=89870
Summary [WK2] Add support for Network Information API
Chris Dumez
Reported 2012-06-25 05:31:15 PDT
There is currently no support for the Network Information API in WK2 even though it is implemented in WK1 and used by EFL port. We need to implement Network Information API in WebKit2.
Attachments
Patch (50.01 KB, patch)
2012-06-25 11:12 PDT, Chris Dumez
no flags
Patch (50.24 KB, patch)
2012-06-25 22:44 PDT, Chris Dumez
no flags
Patch (50.42 KB, patch)
2012-06-26 05:10 PDT, Chris Dumez
no flags
Patch (50.39 KB, patch)
2012-06-26 22:35 PDT, Chris Dumez
no flags
Patch (60.34 KB, patch)
2012-07-04 06:05 PDT, Chris Dumez
no flags
Patch (60.30 KB, patch)
2012-07-04 23:36 PDT, Chris Dumez
no flags
Chris Dumez
Comment 1 2012-06-25 11:12:25 PDT
Gyuyoung Kim
Comment 2 2012-06-25 18:12:40 PDT
Comment on attachment 149326 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=149326&action=review > Source/WebKit2/WebProcess/NetworkInfo/WebNetworkInfoManager.cpp:75 > + unsigned int bandwidth = true; Why do you initialize *unsigned int* with boolean type ? In addition, why true ? According to specification, bandwidth returns below values. - 0 if the user is currently offline. - Infinity if the bandwidth is unknown. - an estimation of the current bandwidth in MB/s (Megabytes per seconds) available for communication with the browsing context active document's domain. > Source/WebKit2/WebProcess/NetworkInfo/WebNetworkInfoManager.cpp:82 > + bool metered = true; Basically, metered means operator limits network usage. So, I think it is good to set 'false' by default.
Chris Dumez
Comment 3 2012-06-25 22:40:01 PDT
Comment on attachment 149326 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=149326&action=review >> Source/WebKit2/WebProcess/NetworkInfo/WebNetworkInfoManager.cpp:75 >> + unsigned int bandwidth = true; > > Why do you initialize *unsigned int* with boolean type ? In addition, why true ? > > According to specification, bandwidth returns below values. > > - 0 if the user is currently offline. > - Infinity if the bandwidth is unknown. > - an estimation of the current bandwidth in MB/s (Megabytes per seconds) available for communication with the browsing context active document's domain. Bad copy/paste, thanks for catching it. >> Source/WebKit2/WebProcess/NetworkInfo/WebNetworkInfoManager.cpp:82 >> + bool metered = true; > > Basically, metered means operator limits network usage. So, I think it is good to set 'false' by default. Yes, it should be false. It is already set to false by default on Proxy side but it should be consistent.
Chris Dumez
Comment 4 2012-06-25 22:44:47 PDT
Created attachment 149458 [details] Patch Take Gyuyoung's feedback into consideration.
Gyuyoung Kim
Comment 5 2012-06-25 23:14:57 PDT
Comment on attachment 149458 [details] Patch Almost looks good to me.
Chris Dumez
Comment 6 2012-06-25 23:42:22 PDT
(In reply to comment #5) > (From update of attachment 149458 [details]) > Almost looks good to me. Almost? ;) Then please tell me what is wrong so that I can make it look good to you in its entirety.
Gyuyoung Kim
Comment 7 2012-06-26 02:03:07 PDT
(In reply to comment #6) > (In reply to comment #5) > > (From update of attachment 149458 [details] [details]) > > Almost looks good to me. > > Almost? ;) Then please tell me what is wrong so that I can make it look good to you in its entirety. As we said on irc, return type of bandwidth needs to be consistent with all places. I file a bug.
Chris Dumez
Comment 8 2012-06-26 05:10:41 PDT
Created attachment 149512 [details] Patch Call sendSync() on m_process->connection() instead of m_page, in WebNetworkInfoManager.cpp.
Chris Dumez
Comment 9 2012-06-26 07:43:56 PDT
C APIs will be provided in a separate bug report / patch to decrease patch size (in case someone is wondering).
Chris Dumez
Comment 10 2012-06-26 11:15:07 PDT
Comment on attachment 149512 [details] Patch Clearing flags as the patch will need updating once the dependency lands.
Gyuyoung Kim
Comment 11 2012-06-26 17:43:45 PDT
Comment on attachment 149512 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=149512&action=review > Source/WebKit2/Shared/WebNetworkInfo.h:46 > + unsigned int bandwidth; bandwidth type is changed to double data type. This patch also needs to change type of bandwidth.
Chris Dumez
Comment 12 2012-06-26 22:35:01 PDT
Created attachment 149680 [details] Patch Update patch to use "double" instead of "unsigned int" for the bandwidth, now that the dependency has landed.
Gyuyoung Kim
Comment 13 2012-06-26 22:43:11 PDT
Comment on attachment 149680 [details] Patch LGTM.
Chris Dumez
Comment 14 2012-07-04 06:05:02 PDT
Created attachment 150782 [details] Patch Rebase on master and add new files to GNUMakefile and Qt project.
Kenneth Rohde Christiansen
Comment 15 2012-07-04 20:19:07 PDT
Comment on attachment 150782 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=150782&action=review > Source/WebKit2/UIProcess/WebNetworkInfoProvider.h:45 > + bool metered(WebNetworkInfoManagerProxy*) const; why not isMetered here? > Source/WebKit2/WebProcess/NetworkInfo/WebNetworkInfoManager.cpp:77 > + // The spec indicates that we should return "infinity" if the bandwidth is unknown. > + double bandwidth = std::numeric_limits<double>::infinity(); Isnt there a smarter way to emit "Infinity" in JS?
Chris Dumez
Comment 16 2012-07-04 23:33:58 PDT
Comment on attachment 150782 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=150782&action=review >> Source/WebKit2/UIProcess/WebNetworkInfoProvider.h:45 >> + bool metered(WebNetworkInfoManagerProxy*) const; > > why not isMetered here? Right, this is better, I'll fix it. For some reason it is called metered() in WebCore. >> Source/WebKit2/WebProcess/NetworkInfo/WebNetworkInfoManager.cpp:77 >> + double bandwidth = std::numeric_limits<double>::infinity(); > > Isnt there a smarter way to emit "Infinity" in JS? I don't know of any other. I know this works though: Source/JavaScriptCore/runtime/NumberConstructor.cpp: return jsNumber(std::numeric_limits<double>::infinity());
Chris Dumez
Comment 17 2012-07-04 23:36:26 PDT
Created attachment 150883 [details] Patch Take Kenneth's feedback into consideration.
WebKit Review Bot
Comment 18 2012-07-06 12:12:30 PDT
Comment on attachment 150883 [details] Patch Clearing flags on attachment: 150883 Committed r121989: <http://trac.webkit.org/changeset/121989>
WebKit Review Bot
Comment 19 2012-07-06 12:12:37 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.