Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Side by Side Diff: chrome/browser/chromeos/web_socket_proxy_controller.cc

Issue 10026013: Update use of TimeDelta in chrome/browser/*, ui/views/*, and other places. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase onto master. Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chromeos/web_socket_proxy_controller.h" 5 #include "chrome/browser/chromeos/web_socket_proxy_controller.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include <netinet/in.h> 9 #include <netinet/in.h>
10 #include <sys/wait.h> 10 #include <sys/wait.h>
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 server_ = NULL; 94 server_ = NULL;
95 if (!shutdown_requested_) { 95 if (!shutdown_requested_) {
96 // Proxy terminated unexpectedly or failed to start (it can happen due 96 // Proxy terminated unexpectedly or failed to start (it can happen due
97 // to a network problem). Keep trying. 97 // to a network problem). Keep trying.
98 if (delay_ms_ < 100 * 1000) 98 if (delay_ms_ < 100 * 1000)
99 (delay_ms_ *= 3) /= 2; 99 (delay_ms_ *= 3) /= 2;
100 100
101 MessageLoop::current()->PostDelayedTask( 101 MessageLoop::current()->PostDelayedTask(
102 FROM_HERE, 102 FROM_HERE,
103 base::Bind(&ProxyLifetime::ProxyCallback, base::Unretained(this)), 103 base::Bind(&ProxyLifetime::ProxyCallback, base::Unretained(this)),
104 delay_ms_); 104 base::TimeDelta::FromMilliseconds(delay_ms_));
105 } 105 }
106 } 106 }
107 } 107 }
108 108
109 // Delay between next attempt to run proxy. 109 // Delay in milliseconds between next attempt to run proxy.
110 int volatile delay_ms_; 110 int volatile delay_ms_;
111 111
112 // Proxy listens for incoming websocket connections on this port. 112 // Proxy listens for incoming websocket connections on this port.
113 int volatile port_; 113 int volatile port_;
114 114
115 chromeos::WebSocketProxy* volatile server_; 115 chromeos::WebSocketProxy* volatile server_;
116 volatile bool shutdown_requested_; 116 volatile bool shutdown_requested_;
117 base::Lock lock_; 117 base::Lock lock_;
118 content::NotificationRegistrar registrar_; 118 content::NotificationRegistrar registrar_;
119 friend class chromeos::WebSocketProxyController; 119 friend class chromeos::WebSocketProxyController;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 { 152 {
153 base::AutoLock alk(g_proxy_lifetime.Get().lock_); 153 base::AutoLock alk(g_proxy_lifetime.Get().lock_);
154 g_proxy_lifetime.Get().shutdown_requested_ = true; 154 g_proxy_lifetime.Get().shutdown_requested_ = true;
155 if (g_proxy_lifetime.Get().server_) 155 if (g_proxy_lifetime.Get().server_)
156 g_proxy_lifetime.Get().server_->Shutdown(); 156 g_proxy_lifetime.Get().server_->Shutdown();
157 } 157 }
158 g_proxy_lifetime.Get().web_socket_proxy_thread_.Stop(); 158 g_proxy_lifetime.Get().web_socket_proxy_thread_.Stop();
159 } 159 }
160 160
161 } // namespace chromeos 161 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698