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

Side by Side Diff: content/browser/renderer_host/render_process_host_impl.cc

Issue 2842833003: Update SupportsUserData uses with unique_ptr. (Closed)
Patch Set: rebase 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 // Represents the browser side of the browser <--> renderer communication 5 // Represents the browser side of the browser <--> renderer communication
6 // channel. There will be one RenderProcessHost per renderer process. 6 // channel. There will be one RenderProcessHost per renderer process.
7 7
8 #include "content/browser/renderer_host/render_process_host_impl.h" 8 #include "content/browser/renderer_host/render_process_host_impl.h"
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 SiteToProcessMap map_; 370 SiteToProcessMap map_;
371 }; 371 };
372 372
373 // Find the SiteProcessMap specific to the given context. 373 // Find the SiteProcessMap specific to the given context.
374 SiteProcessMap* GetSiteProcessMapForBrowserContext(BrowserContext* context) { 374 SiteProcessMap* GetSiteProcessMapForBrowserContext(BrowserContext* context) {
375 DCHECK(context); 375 DCHECK(context);
376 SiteProcessMap* map = static_cast<SiteProcessMap*>( 376 SiteProcessMap* map = static_cast<SiteProcessMap*>(
377 context->GetUserData(kSiteProcessMapKeyName)); 377 context->GetUserData(kSiteProcessMapKeyName));
378 if (!map) { 378 if (!map) {
379 map = new SiteProcessMap(); 379 map = new SiteProcessMap();
380 context->SetUserData(kSiteProcessMapKeyName, map); 380 context->SetUserData(kSiteProcessMapKeyName, base::WrapUnique(map));
381 } 381 }
382 return map; 382 return map;
383 } 383 }
384 384
385 // NOTE: changes to this class need to be reviewed by the security team. 385 // NOTE: changes to this class need to be reviewed by the security team.
386 class RendererSandboxedProcessLauncherDelegate 386 class RendererSandboxedProcessLauncherDelegate
387 : public SandboxedProcessLauncherDelegate { 387 : public SandboxedProcessLauncherDelegate {
388 public: 388 public:
389 RendererSandboxedProcessLauncherDelegate() {} 389 RendererSandboxedProcessLauncherDelegate() {}
390 390
(...skipping 2464 matching lines...) Expand 10 before | Expand all | Expand 10 after
2855 RenderProcessHost* host, 2855 RenderProcessHost* host,
2856 const SessionStorageNamespaceMap& sessions, 2856 const SessionStorageNamespaceMap& sessions,
2857 int view_route_id) { 2857 int view_route_id) {
2858 DCHECK(host); 2858 DCHECK(host);
2859 if (sessions.empty()) 2859 if (sessions.empty())
2860 return; 2860 return;
2861 SessionStorageHolder* holder = static_cast<SessionStorageHolder*>( 2861 SessionStorageHolder* holder = static_cast<SessionStorageHolder*>(
2862 host->GetUserData(kSessionStorageHolderKey)); 2862 host->GetUserData(kSessionStorageHolderKey));
2863 if (!holder) { 2863 if (!holder) {
2864 holder = new SessionStorageHolder(); 2864 holder = new SessionStorageHolder();
2865 host->SetUserData(kSessionStorageHolderKey, holder); 2865 host->SetUserData(kSessionStorageHolderKey, base::WrapUnique(holder));
2866 } 2866 }
2867 holder->Hold(sessions, view_route_id); 2867 holder->Hold(sessions, view_route_id);
2868 } 2868 }
2869 2869
2870 void RenderProcessHostImpl::OnShutdownRequest() { 2870 void RenderProcessHostImpl::OnShutdownRequest() {
2871 // Don't shut down if there are active RenderViews, or if there are pending 2871 // Don't shut down if there are active RenderViews, or if there are pending
2872 // RenderViews being swapped back in. 2872 // RenderViews being swapped back in.
2873 // In single process mode, we never shutdown the renderer. 2873 // In single process mode, we never shutdown the renderer.
2874 if (pending_views_ || run_renderer_in_process() || GetActiveViewCount() > 0) 2874 if (pending_views_ || run_renderer_in_process() || GetActiveViewCount() > 0)
2875 return; 2875 return;
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
3132 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; 3132 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error;
3133 3133
3134 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. 3134 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing.
3135 // Capture the error message in a crash key value. 3135 // Capture the error message in a crash key value.
3136 base::debug::ScopedCrashKey error_key_value("mojo-message-error", error); 3136 base::debug::ScopedCrashKey error_key_value("mojo-message-error", error);
3137 bad_message::ReceivedBadMessage(render_process_id, 3137 bad_message::ReceivedBadMessage(render_process_id,
3138 bad_message::RPH_MOJO_PROCESS_ERROR); 3138 bad_message::RPH_MOJO_PROCESS_ERROR);
3139 } 3139 }
3140 3140
3141 } // namespace content 3141 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/media/session/media_session_impl.cc ('k') | content/browser/service_worker/service_worker_request_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698