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

Side by Side Diff: content/browser/webui/web_ui_url_loader_factory.cc

Issue 2867693004: Snapshot of all changes to get jumbo in blink and content.
Patch Set: Rebased again Created 3 years, 5 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
« no previous file with comments | « content/browser/webrtc/webrtc_eventlog_host.cc ('k') | content/child/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/webui/web_ui_url_loader_factory.h" 5 #include "content/browser/webui/web_ui_url_loader_factory.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 20 matching lines...) Expand all
31 #include "mojo/public/cpp/bindings/binding_set.h" 31 #include "mojo/public/cpp/bindings/binding_set.h"
32 #include "third_party/zlib/google/compression_utils.h" 32 #include "third_party/zlib/google/compression_utils.h"
33 #include "ui/base/template_expressions.h" 33 #include "ui/base/template_expressions.h"
34 34
35 namespace content { 35 namespace content {
36 36
37 namespace { 37 namespace {
38 38
39 class WebUIURLLoaderFactory; 39 class WebUIURLLoaderFactory;
40 base::LazyInstance<std::map<int, std::unique_ptr<WebUIURLLoaderFactory>>>::Leaky 40 base::LazyInstance<std::map<int, std::unique_ptr<WebUIURLLoaderFactory>>>::Leaky
41 g_factories = LAZY_INSTANCE_INITIALIZER; 41 g_webui_url_loader_factories = LAZY_INSTANCE_INITIALIZER;
42 42
43 void CallOnError(mojom::URLLoaderClientPtrInfo client_info, int error_code) { 43 void CallOnError(mojom::URLLoaderClientPtrInfo client_info, int error_code) {
44 mojom::URLLoaderClientPtr client; 44 mojom::URLLoaderClientPtr client;
45 client.Bind(std::move(client_info)); 45 client.Bind(std::move(client_info));
46 46
47 ResourceRequestCompletionStatus status; 47 ResourceRequestCompletionStatus status;
48 status.error_code = error_code; 48 status.error_code = error_code;
49 client->OnComplete(status); 49 client->OnComplete(status);
50 } 50 }
51 51
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 270
271 void SyncLoad(int32_t routing_id, 271 void SyncLoad(int32_t routing_id,
272 int32_t request_id, 272 int32_t request_id,
273 const ResourceRequest& request, 273 const ResourceRequest& request,
274 SyncLoadCallback callback) override { 274 SyncLoadCallback callback) override {
275 NOTREACHED(); 275 NOTREACHED();
276 } 276 }
277 277
278 // FrameTreeNode::Observer implementation: 278 // FrameTreeNode::Observer implementation:
279 void OnFrameTreeNodeDestroyed(FrameTreeNode* node) override { 279 void OnFrameTreeNodeDestroyed(FrameTreeNode* node) override {
280 g_factories.Get().erase(frame_tree_node_id_); 280 g_webui_url_loader_factories.Get().erase(frame_tree_node_id_);
281 } 281 }
282 282
283 private: 283 private:
284 int frame_tree_node_id_; 284 int frame_tree_node_id_;
285 StoragePartitionImpl* storage_partition_; 285 StoragePartitionImpl* storage_partition_;
286 mojo::BindingSet<mojom::URLLoaderFactory> loader_factory_bindings_; 286 mojo::BindingSet<mojom::URLLoaderFactory> loader_factory_bindings_;
287 287
288 DISALLOW_COPY_AND_ASSIGN(WebUIURLLoaderFactory); 288 DISALLOW_COPY_AND_ASSIGN(WebUIURLLoaderFactory);
289 }; 289 };
290 290
291 } // namespace 291 } // namespace
292 292
293 mojom::URLLoaderFactoryPtr CreateWebUIURLLoader(FrameTreeNode* node) { 293 mojom::URLLoaderFactoryPtr CreateWebUIURLLoader(FrameTreeNode* node) {
294 int ftn_id = node->frame_tree_node_id(); 294 int ftn_id = node->frame_tree_node_id();
295 if (g_factories.Get()[ftn_id].get() == nullptr) 295 if (g_webui_url_loader_factories.Get()[ftn_id].get() == nullptr)
296 g_factories.Get()[ftn_id] = base::MakeUnique<WebUIURLLoaderFactory>(node); 296 g_webui_url_loader_factories.Get()[ftn_id] = base::MakeUnique<WebUIURLLoader Factory>(node);
297 return g_factories.Get()[ftn_id]->CreateBinding(); 297 return g_webui_url_loader_factories.Get()[ftn_id]->CreateBinding();
298 } 298 }
299 299
300 } // namespace content 300 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/webrtc/webrtc_eventlog_host.cc ('k') | content/child/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698