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

Side by Side Diff: webkit/glue/webappcachecontext.h

Issue 9712: AppCachePlumbing (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 8 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
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef WEBKIT_GLUE_WEBAPPCACHECONTEXT_H_
6 #define WEBKIT_GLUE_WEBAPPCACHECONTEXT_H_
7
8 #include "base/basictypes.h"
9
10 class GURL;
11
12 // This class is used in child processes, renderers and workers.
13 //
14 // An AppCacheContext corresponds with what html5 refers to as a
15 // "browsing context". Conceptually, each frame or worker represents
16 // a unique context. This class is used in child processes (renderers
17 // and workers) to inform the browser process of new frames and workers, and
18 // to keep track of which appcache is selected for each context. Resource
19 // requests contain the context id so the browser process can identify
20 // which context a request came from. As new documents are committed into a
21 // frame, the cache selection algorithm is initiated by calling one of the
22 // SelectAppCache methods.
23 //
24 // Each WebAppCacheContext is assigned a unique id within its child process.
25 // These ids are made globally unique by pairing them with a child process
26 // id within the browser process.
27 //
28 // WebFrameImpl has a scoped ptr to one of these as a data member.
29 // TODO(michaeln): integrate with WebWorkers
30 class WebAppCacheContext {
31 public:
32 enum ContextType {
33 MAIN_FRAME = 0,
34 CHILD_FRAME,
35 DEDICATED_WORKER
36 };
37
38 static const int kNoAppCacheContextId; // = 0;
39 static const int64 kNoAppCacheId; // = 0;
40 static const int64 kUnknownAppCacheId; // = -1;
41
42 // Factory method called internally by webkit_glue to create a concrete
43 // instance of this class. If SetFactory has been called, the factory
44 // function provided there is used to create a new instance, otherwise
45 // a noop implementation is returned.
46 static WebAppCacheContext* Create();
47
48 typedef WebAppCacheContext* (*WebAppCacheFactoryProc)(void);
49 static void SetFactory(WebAppCacheFactoryProc factory_proc);
50
51 // Unique id within the child process housing this context
52 virtual int context_id() = 0;
darin (slow to review) 2009/04/13 18:37:54 nit: virtual methods should not be named unix_hack
53
54 // Which appcache is associated with the context. There are windows of
55 // time where the appcache is not yet known, the return value is
56 // kUnknownAppCacheId in that case.
57 virtual int64 app_cache_id() = 0;
darin (slow to review) 2009/04/13 18:37:54 ditto
58
59 // The following methods result in async messages being sent to the
60 // browser process. The initialize method tell the browser process about
61 // the existance of this context, its type and its id. The select methods
62 // tell the browser process to initiate the cache selection algorithm for
63 // the context.
64 virtual void Initialize(ContextType context_type,
65 WebAppCacheContext* opt_parent) = 0;
66 virtual void SelectAppCacheWithoutManifest(
67 const GURL& document_url,
68 int64 cache_document_was_loaded_from) = 0;
69 virtual void SelectAppCacheWithManifest(
70 const GURL& document_url,
71 int64 cache_document_was_loaded_from,
72 const GURL& manifest_url) = 0;
73
74 virtual ~WebAppCacheContext() {}
75 };
76
77 #endif // WEBKIT_GLUE_WEBAPPCACHECONTEXT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698