Closed Bug 949956 Opened 11 years ago Closed 10 years ago

[Network Metering] Move metering related code in necko to NetStaistics.h

Categories

(Core :: Networking, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla31

People

(Reporter: johnshih.bugs, Assigned: johnshih.bugs)

References

Details

Attachments

(1 file, 5 obsolete files)

Based on 940740, since we need to do the same thing as bug 746073. (i.e., to dispatch every save event to main thread in order to make sure AddRef() won't be called outside it.)
As a result the code of SaveNetworkStats will be duplicated (in Http, WebSocket, Ftp).
This bug is intended to move this shared code to nsNetUtils.h.
In Bug 940740, we found that SaveNetworkStatsEvent is needed in Http, WebSocket, and also Ftp in order to ensure smart pointer operation runs in the main thread. As a result the code of SaveNetworkEvent can now move to nsNetUtils.h and let Http, WebSocekt, Ftp call it directly. Some redundant codes can thus be removed.
Attachment #8360329 - Attachment is obsolete: true
Attachment #8360330 - Flags: review?(jduell.mcbugs)
try server result: https://tbpl.mozilla.org/?tree=Try&rev=b2eba0357ac3
Comment on attachment 8360330 [details] [diff] [review]
Bug 949956 - Move SaveNetworkStatsEvent to nsNetUtils.h. r=jduell

Patrick, could you take a look if you are available? Thanks
Attachment #8360330 - Flags: review?(jduell.mcbugs) → review?(mcmanus)
Comment on attachment 8360330 [details] [diff] [review]
Bug 949956 - Move SaveNetworkStatsEvent to nsNetUtils.h. r=jduell

Review of attachment 8360330 [details] [diff] [review]:
-----------------------------------------------------------------

I support the general direction of this patch. Thanks!

I'd rather you made a new .h file rather than adding more junk to nsNetUtil.. maybe NetStatistics.h? Also - don't name the new class NS_SaveNetworkStatsEvent just mozilla::net::SaveNetworkStatsEvent should be fine.
Attachment #8360330 - Flags: review?(mcmanus)
Patrick,
Thanks for your suggestion! The patch is updated, please take look on it when you're available.
Attachment #8360330 - Attachment is obsolete: true
Attachment #8398383 - Flags: review?(mcmanus)
sorry for uploading a wrong patch.
Attachment #8398383 - Attachment is obsolete: true
Attachment #8398383 - Flags: review?(mcmanus)
Attachment #8398384 - Flags: review?(mcmanus)
Summary: [Network Metering] Move SaveNetworkStats code to nsNetUtils.h → [Network Metering] Move metering related code in necko to nsNetStaistics.h
Comment on attachment 8398384 [details] [diff] [review]
Bug 949956: Move duplicated code to nsNetStatistics.h r=mcmanus

Review of attachment 8398384 [details] [diff] [review]:
-----------------------------------------------------------------

::: netwerk/base/public/nsNetStatistics.h
@@ +3,5 @@
> +/* This Source Code Form is subject to the terms of the Mozilla Public
> + * License, v. 2.0. If a copy of the MPL was not distributed with this
> + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
> +
> +#ifndef nsNetStatistics_h__

name this file and guard NetStatistics.h (no ns prefix) and place it in the mozilla::net namespace. otherwise its fine.

::: netwerk/protocol/websocket/WebSocketChannel.h
@@ +20,5 @@
>  #include "BaseWebSocketChannel.h"
>  
>  #ifdef MOZ_WIDGET_GONK
>  #include "nsINetworkManager.h"
> +#include "nsProxyRelease.h"

is proxy release still needed here?
Attachment #8398384 - Flags: review?(mcmanus)
Comment on attachment 8398384 [details] [diff] [review]
Bug 949956: Move duplicated code to nsNetStatistics.h r=mcmanus

Review of attachment 8398384 [details] [diff] [review]:
-----------------------------------------------------------------

::: netwerk/protocol/websocket/WebSocketChannel.h
@@ +20,5 @@
>  #include "BaseWebSocketChannel.h"
>  
>  #ifdef MOZ_WIDGET_GONK
>  #include "nsINetworkManager.h"
> +#include "nsProxyRelease.h"

Yes, it is needed for declaring nsMainThreadPtrHandle [1].

[1] http://dxr.mozilla.org/mozilla-central/source/netwerk/protocol/websocket/WebSocketChannel.h?from=websocketchannel#272
patch update.
Attachment #8398384 - Attachment is obsolete: true
Attachment #8399862 - Flags: review?(mcmanus)
Summary: [Network Metering] Move metering related code in necko to nsNetStaistics.h → [Network Metering] Move metering related code in necko to NetStaistics.h
fix typo
Attachment #8399862 - Attachment is obsolete: true
Attachment #8399862 - Flags: review?(mcmanus)
Attachment #8399864 - Flags: review?(mcmanus)
Comment on attachment 8399864 [details] [diff] [review]
Bug 949956: Move duplicated code to NetStatistics.h r=mcmanus

Review of attachment 8399864 [details] [diff] [review]:
-----------------------------------------------------------------

lgtm thanks. please add a simple try run to the bug before commiting.
Attachment #8399864 - Flags: review?(mcmanus) → review+
try result: https://tbpl.mozilla.org/?tree=Try&rev=eed252181096

There is no fails related to this bug, I think we can move on!
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/a4d6df64006b
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla31
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: