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

Side by Side Diff: content/browser/service_worker/service_worker_version.cc

Issue 269373002: Store the service worker script and its imports on first load... kinda (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/browser/service_worker/service_worker_version.h" 5 #include "content/browser/service_worker/service_worker_version.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "content/browser/service_worker/embedded_worker_instance.h" 9 #include "content/browser/service_worker/embedded_worker_instance.h"
10 #include "content/browser/service_worker/embedded_worker_registry.h" 10 #include "content/browser/service_worker/embedded_worker_registry.h"
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 } 543 }
544 544
545 scoped_refptr<ServiceWorkerVersion> protect(this); 545 scoped_refptr<ServiceWorkerVersion> protect(this);
546 callback->Run(SERVICE_WORKER_OK); 546 callback->Run(SERVICE_WORKER_OK);
547 sync_callbacks_.Remove(request_id); 547 sync_callbacks_.Remove(request_id);
548 } 548 }
549 549
550 void ServiceWorkerVersion::AddToScriptCache( 550 void ServiceWorkerVersion::AddToScriptCache(
551 const GURL& url, int64 resource_id) { 551 const GURL& url, int64 resource_id) {
552 DCHECK_EQ(kInvalidServiceWorkerResponseId, LookupInScriptCache(url)); 552 DCHECK_EQ(kInvalidServiceWorkerResponseId, LookupInScriptCache(url));
553 DCHECK_EQ(NEW, status_); 553 DCHECK(status_ == NEW || status_ == INSTALLING);
554 script_cache_map_[url] = resource_id; 554 script_cache_map_[url] = resource_id;
555 } 555 }
556 556
557 int64 ServiceWorkerVersion::LookupInScriptCache(const GURL& url) { 557 int64 ServiceWorkerVersion::LookupInScriptCache(const GURL& url) {
558 ResourceIDMap::const_iterator found = script_cache_map_.find(url); 558 ResourceIDMap::const_iterator found = script_cache_map_.find(url);
559 if (found == script_cache_map_.end()) 559 if (found == script_cache_map_.end())
560 return kInvalidServiceWorkerResponseId; 560 return kInvalidServiceWorkerResponseId;
561 return found->second; 561 return found->second;
562 } 562 }
563 563
564 void ServiceWorkerVersion::NotifyMainScriptCacheResult(bool success) {
565 FOR_EACH_OBSERVER(Listener, listeners_,
566 OnMainScriptCacheResult(this, success));
567 }
568
564 } // namespace content 569 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698