| Index: third_party/WebKit/Tools/Scripts/webkitpy/thirdparty/wpt/wpt/tools/wptserve/wptserve/stash.py
|
| diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/thirdparty/wpt/wpt/tools/wptserve/wptserve/stash.py b/third_party/WebKit/Tools/Scripts/webkitpy/thirdparty/wpt/wpt/tools/wptserve/wptserve/stash.py
|
| index b546191932240007fdd3bdba927caa0cfb18912a..b6bd6eed442a2c1e22c8cfb6d294fa810991a3de 100644
|
| --- a/third_party/WebKit/Tools/Scripts/webkitpy/thirdparty/wpt/wpt/tools/wptserve/wptserve/stash.py
|
| +++ b/third_party/WebKit/Tools/Scripts/webkitpy/thirdparty/wpt/wpt/tools/wptserve/wptserve/stash.py
|
| @@ -2,7 +2,6 @@ import base64
|
| import json
|
| import os
|
| import uuid
|
| -from multiprocessing import Process
|
| from multiprocessing.managers import BaseManager, DictProxy
|
|
|
| class ServerDictManager(BaseManager):
|
| @@ -57,18 +56,19 @@ def start_server(address=None, authkey=None):
|
| #TODO: Consider expiring values after some fixed time for long-running
|
| #servers
|
|
|
| -# TODO(kristijanburnik): Provide shared Stash support for WebSockets.
|
| -
|
| class Stash(object):
|
| - """Key-value store for persisting data across HTTP/S requests.
|
| + """Key-value store for persisting data across HTTP/S and WS/S requests.
|
|
|
| - This data store is specifically designed for persisting data across
|
| - HTTP and HTTPS requests. The synchronization model is usually done by using
|
| - the SyncManager from the multiprocessing module.
|
| + This data store is specifically designed for persisting data across server
|
| + requests. The synchronization is achieved by using the BaseManager from
|
| + the multiprocessing module so different processes can acccess the same data.
|
|
|
| - Stash can be used interchangeably between HTTP and HTTPS requests as both
|
| - processes are accessing the same resource (e.g. a Manager.dict).
|
| - The WS and WSS servers are currently not supported.
|
| + Stash can be used interchangeably between HTTP, HTTPS, WS and WSS servers.
|
| + A thing to note about WS/S servers is that they require additional steps in
|
| + the handlers for accessing the same underlying shared data in the Stash.
|
| + This can usually be achieved by using load_env_config(). When using Stash
|
| + interchangeably between HTTP/S and WS/S request, the path part of the key
|
| + should be expliclitly specified if accessing the same key/value subset.
|
|
|
| The store has several unusual properties. Keys are of the form (path,
|
| uuid), where path is, by default, the path in the HTTP request and
|
| @@ -118,7 +118,7 @@ class Stash(object):
|
| if internal_key in self.data:
|
| raise StashError("Tried to overwrite existing shared stash value "
|
| "for key %s (old value was %s, new value is %s)" %
|
| - (internal_key, self[str(internal_key)], value))
|
| + (internal_key, self.data[str(internal_key)], value))
|
| else:
|
| self.data[internal_key] = value
|
|
|
| @@ -130,7 +130,7 @@ class Stash(object):
|
| the current request path)"""
|
| internal_key = self._wrap_key(key, path)
|
| value = self.data.get(internal_key, None)
|
| - if not value is None:
|
| + if value is not None:
|
| try:
|
| self.data.pop(internal_key)
|
| except KeyError:
|
|
|