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

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

Issue 6801008: Websocket to TCP proxy running in a separate thread (only on ChromeOS). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: g Created 9 years, 8 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "webproxy_task.h"
6
7 #include <netinet/in.h>
8 #include <sys/wait.h>
9 #include <unistd.h>
10
11 #include "base/threading/platform_thread.h"
12 #include "chrome/browser/chromeos/net/webproxy/serv.h"
13
14 namespace chromeos {
15
16 void WebproxyTask::Run() {
17 const int kPort = 10101;
18
19 // Configure allowed origins.
20 std::vector<std::string> allowed_origins;
21 allowed_origins.push_back("chrome-extension://XXXXXXXXXXXXXXXXXXXXXX");
zel 2011/04/07 16:54:12 let's replace one of these with haiffjcadagjlijogg
Denis Lagno 2011/04/11 23:21:27 Done.
22 allowed_origins.push_back("chrome-extension://YYYYYYYYYYYYYYYYYYYYYY");
23
24 struct sockaddr_in sa;
25 memset(&sa, 0, sizeof(sa));
26 sa.sin_family = AF_INET;
27 sa.sin_port = htons(kPort);
28 sa.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
29 for (int sleep_ms = 1000;;) {
30 webproxy::Serv ws(
31 allowed_origins, reinterpret_cast<sockaddr*>(&sa), sizeof(sa));
32 ws.Run();
33 if (sleep_ms < 100 * 1000)
34 (sleep_ms *= 3) /= 2;
35 base::PlatformThread::Sleep(sleep_ms);
36 }
37 }
38
39 } // namespace chromeos
40
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698