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

Side by Side Diff: content/renderer/mojo_context_state.h

Issue 2869663002: ResourceFetcher::Start should be given a WebLocalFrame (Closed)
Patch Set: fix Created 3 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
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_RENDERER_MOJO_CONTEXT_STATE_H_ 5 #ifndef CONTENT_RENDERER_MOJO_CONTEXT_STATE_H_
6 #define CONTENT_RENDERER_MOJO_CONTEXT_STATE_H_ 6 #define CONTENT_RENDERER_MOJO_CONTEXT_STATE_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "gin/modules/module_registry_observer.h" 14 #include "gin/modules/module_registry_observer.h"
15 #include "v8/include/v8.h" 15 #include "v8/include/v8.h"
16 16
17 namespace blink { 17 namespace blink {
18 class WebFrame; 18 class WebLocalFrame;
19 class WebURLResponse; 19 class WebURLResponse;
20 } 20 }
21 21
22 namespace content { 22 namespace content {
23 23
24 class ResourceFetcher; 24 class ResourceFetcher;
25 class MojoMainRunner; 25 class MojoMainRunner;
26 enum class MojoBindingsType; 26 enum class MojoBindingsType;
27 27
28 // MojoContextState manages the modules needed for mojo bindings. It does this 28 // MojoContextState manages the modules needed for mojo bindings. It does this
29 // by way of gin. Non-builtin modules are downloaded by way of ResourceFetchers. 29 // by way of gin. Non-builtin modules are downloaded by way of ResourceFetchers.
30 class MojoContextState : public gin::ModuleRegistryObserver { 30 class MojoContextState : public gin::ModuleRegistryObserver {
31 public: 31 public:
32 MojoContextState(blink::WebFrame* frame, 32 MojoContextState(blink::WebLocalFrame* frame,
33 v8::Local<v8::Context> context, 33 v8::Local<v8::Context> context,
34 MojoBindingsType bindings_type); 34 MojoBindingsType bindings_type);
35 ~MojoContextState() override; 35 ~MojoContextState() override;
36 36
37 void Run(); 37 void Run();
38 38
39 // Returns true if at least one module was added. 39 // Returns true if at least one module was added.
40 bool module_added() const { return module_added_; } 40 bool module_added() const { return module_added_; }
41 41
42 private: 42 private:
(...skipping 11 matching lines...) Expand all
54 const std::string& id, 54 const std::string& id,
55 const blink::WebURLResponse& response, 55 const blink::WebURLResponse& response,
56 const std::string& data); 56 const std::string& data);
57 57
58 // gin::ModuleRegistryObserver overrides: 58 // gin::ModuleRegistryObserver overrides:
59 void OnDidAddPendingModule( 59 void OnDidAddPendingModule(
60 const std::string& id, 60 const std::string& id,
61 const std::vector<std::string>& dependencies) override; 61 const std::vector<std::string>& dependencies) override;
62 62
63 // Frame script is executed in. Also used to download resources. 63 // Frame script is executed in. Also used to download resources.
64 blink::WebFrame* frame_; 64 blink::WebLocalFrame* frame_;
65 65
66 // See description above getter. 66 // See description above getter.
67 bool module_added_; 67 bool module_added_;
68 68
69 // Executes the script from gin. 69 // Executes the script from gin.
70 std::unique_ptr<MojoMainRunner> runner_; 70 std::unique_ptr<MojoMainRunner> runner_;
71 71
72 // Set of fetchers we're waiting on to download script. 72 // Set of fetchers we're waiting on to download script.
73 std::vector<std::unique_ptr<ResourceFetcher>> module_fetchers_; 73 std::vector<std::unique_ptr<ResourceFetcher>> module_fetchers_;
74 74
75 // Set of modules we've fetched script from. 75 // Set of modules we've fetched script from.
76 std::set<std::string> fetched_modules_; 76 std::set<std::string> fetched_modules_;
77 77
78 // The prefix to use for all module requests. 78 // The prefix to use for all module requests.
79 const std::string module_prefix_; 79 const std::string module_prefix_;
80 80
81 DISALLOW_COPY_AND_ASSIGN(MojoContextState); 81 DISALLOW_COPY_AND_ASSIGN(MojoContextState);
82 }; 82 };
83 83
84 } // namespace content 84 } // namespace content
85 85
86 #endif // CONTENT_RENDERER_MOJO_CONTEXT_STATE_H_ 86 #endif // CONTENT_RENDERER_MOJO_CONTEXT_STATE_H_
OLDNEW
« no previous file with comments | « content/renderer/fetchers/resource_fetcher_impl.cc ('k') | content/renderer/mojo_context_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698