summaryrefslogtreecommitdiff
path: root/www-client/seamonkey/files/seamonkey-2.53.7.1-cpu_hog_fix.patch
blob: 51894c485012d9349b2a6306b14a1995b7c14193 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
https://github.com/JustOff/github-wc-polyfill/issues/10

--- a/netwerk/protocol/websocket/WebSocketChannel.h
+++ b/netwerk/protocol/websocket/WebSocketChannel.h
@@ -151,6 +151,7 @@ private:
   void GeneratePong(uint8_t *payload, uint32_t len);
   void GeneratePing();
 
+  MOZ_MUST_USE nsresult OnNetworkChangedTargetThread();
   MOZ_MUST_USE nsresult OnNetworkChanged();
   MOZ_MUST_USE nsresult StartPinging();
 
--- a/netwerk/protocol/websocket/WebSocketChannel.cpp
+++ b/netwerk/protocol/websocket/WebSocketChannel.cpp
@@ -1270,14 +1270,14 @@ WebSocketChannel::Observe(nsISupports *s
         // Next we check mDataStarted, which we need to do on mTargetThread.
         if (!IsOnTargetThread()) {
           mTargetThread->Dispatch(
-            NewRunnableMethod("net::WebSocketChannel::OnNetworkChanged",
+            NewRunnableMethod("net::WebSocketChannel::OnNetworkChangedTargetThread",
                               this,
-                              &WebSocketChannel::OnNetworkChanged),
+                              &WebSocketChannel::OnNetworkChangedTargetThread),
             NS_DISPATCH_NORMAL);
         } else {
-          nsresult rv = OnNetworkChanged();
+          nsresult rv = OnNetworkChangedTargetThread();
           if (NS_FAILED(rv)) {
-            LOG(("WebSocket: OnNetworkChanged failed (%08" PRIx32 ")",
+            LOG(("WebSocket: OnNetworkChangedTargetThread failed (%08" PRIx32 ")",
                  static_cast<uint32_t>(rv)));
           }
         }
@@ -1289,23 +1289,25 @@ WebSocketChannel::Observe(nsISupports *s
 }
 
 nsresult
-WebSocketChannel::OnNetworkChanged()
+WebSocketChannel::OnNetworkChangedTargetThread()
 {
-  if (IsOnTargetThread()) {
-    LOG(("WebSocketChannel::OnNetworkChanged() - on target thread %p", this));
-
-    if (!mDataStarted) {
-      LOG(("WebSocket: data not started yet, no ping needed"));
-      return NS_OK;
-    }
+  LOG(("WebSocketChannel::OnNetworkChangedTargetThread() - on target thread %p", this));
 
-    return mSocketThread->Dispatch(
-      NewRunnableMethod("net::WebSocketChannel::OnNetworkChanged",
-                        this,
-                        &WebSocketChannel::OnNetworkChanged),
-      NS_DISPATCH_NORMAL);
+  if (!mDataStarted) {
+    LOG(("WebSocket: data not started yet, no ping needed"));
+    return NS_OK;
   }
 
+  return mSocketThread->Dispatch(
+    NewRunnableMethod("net::WebSocketChannel::OnNetworkChanged",
+                      this,
+                      &WebSocketChannel::OnNetworkChanged),
+    NS_DISPATCH_NORMAL);
+}
+
+nsresult
+WebSocketChannel::OnNetworkChanged()
+{
   MOZ_ASSERT(OnSocketThread(), "not on socket thread");
 
   LOG(("WebSocketChannel::OnNetworkChanged() - on socket thread %p", this));