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

Side by Side Diff: content/browser/service_worker/service_worker_script_cache_map.h

Issue 845313004: Service Worker: Improve error messages from register(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: git-cl format Created 5 years, 11 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_SCRIPT_CACHE_MAP_H_ 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_SCRIPT_CACHE_MAP_H_
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_SCRIPT_CACHE_MAP_H_ 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_SCRIPT_CACHE_MAP_H_
7 7
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 17 matching lines...) Expand all
28 int64 LookupResourceId(const GURL& url); 28 int64 LookupResourceId(const GURL& url);
29 // A size of -1 means that we don't know the size yet 29 // A size of -1 means that we don't know the size yet
30 // (it has not finished caching). 30 // (it has not finished caching).
31 int64 LookupResourceSize(const GURL& url); 31 int64 LookupResourceSize(const GURL& url);
32 32
33 // Used during the initial run of a new version to build the map 33 // Used during the initial run of a new version to build the map
34 // of resources ids. 34 // of resources ids.
35 void NotifyStartedCaching(const GURL& url, int64 resource_id); 35 void NotifyStartedCaching(const GURL& url, int64 resource_id);
36 void NotifyFinishedCaching(const GURL& url, 36 void NotifyFinishedCaching(const GURL& url,
37 int64 size_bytes, 37 int64 size_bytes,
38 const net::URLRequestStatus& status); 38 const net::URLRequestStatus& status,
39 const std::string& status_message);
39 40
40 // Used to retrieve the results of the initial run of a new version. 41 // Used to retrieve the results of the initial run of a new version.
41 void GetResources( 42 void GetResources(
42 std::vector<ServiceWorkerDatabase::ResourceRecord>* resources); 43 std::vector<ServiceWorkerDatabase::ResourceRecord>* resources);
43 44
44 // Used when loading an existing version. 45 // Used when loading an existing version.
45 void SetResources( 46 void SetResources(
46 const std::vector<ServiceWorkerDatabase::ResourceRecord>& resources); 47 const std::vector<ServiceWorkerDatabase::ResourceRecord>& resources);
47 48
48 size_t size() const { return resource_map_.size(); } 49 size_t size() const { return resource_map_.size(); }
49 50
50 const net::URLRequestStatus& main_script_status() const { 51 const net::URLRequestStatus& main_script_status() const {
51 return main_script_status_; 52 return main_script_status_;
52 } 53 }
53 54
55 const std::string& main_script_status_message() const {
56 return main_script_status_message_;
57 }
58
54 private: 59 private:
55 typedef std::map<GURL, ServiceWorkerDatabase::ResourceRecord> ResourceMap; 60 typedef std::map<GURL, ServiceWorkerDatabase::ResourceRecord> ResourceMap;
56 61
57 // The version objects owns its script cache and provides a rawptr to it. 62 // The version objects owns its script cache and provides a rawptr to it.
58 friend class ServiceWorkerVersion; 63 friend class ServiceWorkerVersion;
59 ServiceWorkerScriptCacheMap( 64 ServiceWorkerScriptCacheMap(
60 ServiceWorkerVersion* owner, 65 ServiceWorkerVersion* owner,
61 base::WeakPtr<ServiceWorkerContextCore> context); 66 base::WeakPtr<ServiceWorkerContextCore> context);
62 ~ServiceWorkerScriptCacheMap(); 67 ~ServiceWorkerScriptCacheMap();
63 68
64 ServiceWorkerVersion* owner_; 69 ServiceWorkerVersion* owner_;
65 base::WeakPtr<ServiceWorkerContextCore> context_; 70 base::WeakPtr<ServiceWorkerContextCore> context_;
66 ResourceMap resource_map_; 71 ResourceMap resource_map_;
67 net::URLRequestStatus main_script_status_; 72 net::URLRequestStatus main_script_status_;
73 std::string main_script_status_message_;
68 74
69 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerScriptCacheMap); 75 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerScriptCacheMap);
70 }; 76 };
71 77
72 } // namespace content 78 } // namespace content
73 79
74 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_SCRIPT_CACHE_MAP_H_ 80 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_SCRIPT_CACHE_MAP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698