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

Unified Diff: tools/gpu/gpu_tools/file_server.py

Issue 10916227: More polish in prep for CrOS support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: for landing Created 8 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: tools/gpu/gpu_tools/file_server.py
diff --git a/tools/gpu/gpu_tools/file_server.py b/tools/gpu/gpu_tools/file_server.py
deleted file mode 100644
index 16d410c3e3746fcebbe50a6c5eb4c9c6b277116f..0000000000000000000000000000000000000000
--- a/tools/gpu/gpu_tools/file_server.py
+++ /dev/null
@@ -1,42 +0,0 @@
-# Copyright (c) 2012 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-import os
-import subprocess
-
-class FileServer(object):
- def __init__(self, path, port=8000):
- self._server = None
- self._devnull = None
- self._path = path
- self._port = port
-
- assert os.path.exists(path)
- assert os.path.isdir(path)
-
- def __enter__(self):
- self._devnull = open(os.devnull, 'w')
- self._server = subprocess.Popen(
- ['python', '-m', 'SimpleHTTPServer', str(self._port)],
- cwd=self._path,
- stdout=self._devnull, stderr=self._devnull)
- return self
-
- @property
- def url(self):
- return 'http://localhost:%d' % self._port
-
- def __exit__(self, *args):
- if self._server:
- self._server.kill()
- self._server = None
- if self._devnull:
- self._devnull.close()
- self._devnull = None
-
- def __del__(self):
- if self._server:
- self._server.kill()
- if self._devnull:
- self._devnull.close()
- self._devnull = None

Powered by Google App Engine
This is Rietveld 408576698