OLD | NEW |
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 #include "content/renderer/mojo_context_state.h" | 5 #include "content/renderer/mojo_context_state.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 const GURL url(module_prefix_ + id); | 174 const GURL url(module_prefix_ + id); |
175 // TODO(sky): better error checks here? | 175 // TODO(sky): better error checks here? |
176 DCHECK(url.is_valid() && !url.is_empty()); | 176 DCHECK(url.is_valid() && !url.is_empty()); |
177 DCHECK(fetched_modules_.find(id) == fetched_modules_.end()); | 177 DCHECK(fetched_modules_.find(id) == fetched_modules_.end()); |
178 fetched_modules_.insert(id); | 178 fetched_modules_.insert(id); |
179 ResourceFetcher* fetcher = ResourceFetcher::Create(url); | 179 ResourceFetcher* fetcher = ResourceFetcher::Create(url); |
180 module_fetchers_.push_back(fetcher); | 180 module_fetchers_.push_back(fetcher); |
181 fetcher->Start(frame_, | 181 fetcher->Start(frame_, |
182 blink::WebURLRequest::RequestContextScript, | 182 blink::WebURLRequest::RequestContextScript, |
183 blink::WebURLRequest::FrameTypeNone, | 183 blink::WebURLRequest::FrameTypeNone, |
184 ResourceFetcher::PLATFORM_LOADER, | |
185 base::Bind(&MojoContextState::OnFetchModuleComplete, | 184 base::Bind(&MojoContextState::OnFetchModuleComplete, |
186 base::Unretained(this), fetcher, id)); | 185 base::Unretained(this), fetcher, id)); |
187 } | 186 } |
188 | 187 |
189 void MojoContextState::OnFetchModuleComplete( | 188 void MojoContextState::OnFetchModuleComplete( |
190 ResourceFetcher* fetcher, | 189 ResourceFetcher* fetcher, |
191 const std::string& id, | 190 const std::string& id, |
192 const blink::WebURLResponse& response, | 191 const blink::WebURLResponse& response, |
193 const std::string& data) { | 192 const std::string& data) { |
194 if (response.isNull()) { | 193 if (response.isNull()) { |
(...skipping 19 matching lines...) Expand all Loading... |
214 const std::vector<std::string>& dependencies) { | 213 const std::vector<std::string>& dependencies) { |
215 FetchModules(dependencies); | 214 FetchModules(dependencies); |
216 | 215 |
217 gin::ContextHolder* context_holder = runner_->GetContextHolder(); | 216 gin::ContextHolder* context_holder = runner_->GetContextHolder(); |
218 gin::ModuleRegistry* registry = gin::ModuleRegistry::From( | 217 gin::ModuleRegistry* registry = gin::ModuleRegistry::From( |
219 context_holder->context()); | 218 context_holder->context()); |
220 registry->AttemptToLoadMoreModules(context_holder->isolate()); | 219 registry->AttemptToLoadMoreModules(context_holder->isolate()); |
221 } | 220 } |
222 | 221 |
223 } // namespace content | 222 } // namespace content |
OLD | NEW |