| Index: content/browser/service_worker/service_worker_registration.h
|
| diff --git a/content/browser/service_worker/service_worker_registration.h b/content/browser/service_worker/service_worker_registration.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..3f05f4a3c2140e1ad7e33bb69841d1312e5a3ca5
|
| --- /dev/null
|
| +++ b/content/browser/service_worker/service_worker_registration.h
|
| @@ -0,0 +1,67 @@
|
| +// Copyright (c) 2013 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.
|
| +
|
| +#ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTRATION_H_
|
| +#define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTRATION_H_
|
| +
|
| +#include "base/basictypes.h"
|
| +#include "base/logging.h"
|
| +#include "base/memory/ref_counted.h"
|
| +#include "base/memory/scoped_ptr.h"
|
| +#include "content/browser/service_worker/service_worker_version.h"
|
| +
|
| +class GURL;
|
| +
|
| +namespace content {
|
| +
|
| +class ServiceWorkerVersion;
|
| +
|
| +// This class acts as a persistent instance
|
| +class ServiceWorkerRegistration
|
| + : public base::RefCountedThreadSafe<ServiceWorkerRegistration> {
|
| + public:
|
| + ServiceWorkerRegistration(const GURL& pattern,
|
| + const GURL& script_url,
|
| + int64 service_worker_id);
|
| +
|
| + int64 id() const { return registration_id_; }
|
| +
|
| + void Shutdown();
|
| +
|
| + const GURL& script_url() const { return script_url_; }
|
| +
|
| + ServiceWorkerVersion* active_version() const {
|
| + DCHECK(!is_shutdown_);
|
| + return active_version_.get();
|
| + }
|
| + ServiceWorkerVersion* in_waiting_version() const {
|
| + return in_waiting_version_.get();
|
| + }
|
| +
|
| + void set_active_version(ServiceWorkerVersion* version) {
|
| + DCHECK(!is_shutdown_);
|
| + active_version_.reset(version);
|
| + }
|
| + void set_in_waiting_version(ServiceWorkerVersion* version) {
|
| + DCHECK(!is_shutdown_);
|
| + in_waiting_version_.reset(version);
|
| + }
|
| +
|
| + private:
|
| + virtual ~ServiceWorkerRegistration();
|
| + friend class base::RefCountedThreadSafe<ServiceWorkerRegistration>;
|
| +
|
| + const GURL& pattern_;
|
| + const GURL& script_url_;
|
| + const int64 registration_id_;
|
| +
|
| + scoped_ptr<ServiceWorkerVersion> active_version_;
|
| + scoped_ptr<ServiceWorkerVersion> in_waiting_version_;
|
| +
|
| + bool is_shutdown_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRegistration);
|
| +};
|
| +} // namespace content
|
| +#endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTRATION_H_
|
|
|