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

Side by Side Diff: content/renderer/internal_document_state_data.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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/internal_document_state_data.h" 5 #include "content/renderer/internal_document_state_data.h"
6 6
7 #include "base/memory/ptr_util.h"
7 #include "content/public/renderer/document_state.h" 8 #include "content/public/renderer/document_state.h"
8 #include "third_party/WebKit/public/web/WebDataSource.h" 9 #include "third_party/WebKit/public/web/WebDataSource.h"
9 10
10 namespace content { 11 namespace content {
11 12
12 namespace { 13 namespace {
13 14
14 // Key InternalDocumentStateData is stored under in DocumentState. 15 // Key InternalDocumentStateData is stored under in DocumentState.
15 const char kUserDataKey[] = "InternalDocumentStateData"; 16 const char kUserDataKey[] = "InternalDocumentStateData";
16 17
(...skipping 14 matching lines...) Expand all
31 32
32 // static 33 // static
33 InternalDocumentStateData* InternalDocumentStateData::FromDocumentState( 34 InternalDocumentStateData* InternalDocumentStateData::FromDocumentState(
34 DocumentState* ds) { 35 DocumentState* ds) {
35 if (!ds) 36 if (!ds)
36 return NULL; 37 return NULL;
37 InternalDocumentStateData* data = static_cast<InternalDocumentStateData*>( 38 InternalDocumentStateData* data = static_cast<InternalDocumentStateData*>(
38 ds->GetUserData(&kUserDataKey)); 39 ds->GetUserData(&kUserDataKey));
39 if (!data) { 40 if (!data) {
40 data = new InternalDocumentStateData; 41 data = new InternalDocumentStateData;
41 ds->SetUserData(&kUserDataKey, data); 42 ds->SetUserData(&kUserDataKey, base::WrapUnique(data));
42 } 43 }
43 return data; 44 return data;
44 } 45 }
45 46
46 InternalDocumentStateData::~InternalDocumentStateData() { 47 InternalDocumentStateData::~InternalDocumentStateData() {
47 } 48 }
48 49
49 } // namespace content 50 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/internal_document_state_data.h ('k') | content/renderer/mojo_bindings_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698