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

Side by Side Diff: third_party/WebKit/Source/web/WebDOMActivityLogger.cpp

Issue 2080623002: Revert "Remove OwnPtr from Blink." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 17 matching lines...) Expand all
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "public/web/WebDOMActivityLogger.h" 31 #include "public/web/WebDOMActivityLogger.h"
32 32
33 #include "bindings/core/v8/V8Binding.h" 33 #include "bindings/core/v8/V8Binding.h"
34 #include "bindings/core/v8/V8DOMActivityLogger.h" 34 #include "bindings/core/v8/V8DOMActivityLogger.h"
35 #include "core/dom/Document.h" 35 #include "core/dom/Document.h"
36 #include "core/frame/LocalDOMWindow.h" 36 #include "core/frame/LocalDOMWindow.h"
37 #include "wtf/PassRefPtr.h" 37 #include "wtf/PassRefPtr.h"
38 #include "wtf/PtrUtil.h"
39 #include "wtf/text/WTFString.h" 38 #include "wtf/text/WTFString.h"
40 #include <memory>
41 39
42 namespace blink { 40 namespace blink {
43 41
44 class DOMActivityLoggerContainer : public V8DOMActivityLogger { 42 class DOMActivityLoggerContainer : public V8DOMActivityLogger {
45 public: 43 public:
46 explicit DOMActivityLoggerContainer(std::unique_ptr<WebDOMActivityLogger> lo gger) 44 explicit DOMActivityLoggerContainer(PassOwnPtr<WebDOMActivityLogger> logger)
47 : m_domActivityLogger(std::move(logger)) 45 : m_domActivityLogger(std::move(logger))
48 { 46 {
49 } 47 }
50 48
51 void logGetter(const String& apiName) override 49 void logGetter(const String& apiName) override
52 { 50 {
53 m_domActivityLogger->logGetter(WebString(apiName), getURL(), getTitle()) ; 51 m_domActivityLogger->logGetter(WebString(apiName), getURL(), getTitle()) ;
54 } 52 }
55 53
56 void logSetter(const String& apiName, const v8::Local<v8::Value>& newValue) override 54 void logSetter(const String& apiName, const v8::Local<v8::Value>& newValue) override
(...skipping 22 matching lines...) Expand all
79 return WebURL(); 77 return WebURL();
80 } 78 }
81 79
82 WebString getTitle() 80 WebString getTitle()
83 { 81 {
84 if (Document* document = currentDOMWindow(v8::Isolate::GetCurrent())->do cument()) 82 if (Document* document = currentDOMWindow(v8::Isolate::GetCurrent())->do cument())
85 return WebString(document->title()); 83 return WebString(document->title());
86 return WebString(); 84 return WebString();
87 } 85 }
88 86
89 std::unique_ptr<WebDOMActivityLogger> m_domActivityLogger; 87 OwnPtr<WebDOMActivityLogger> m_domActivityLogger;
90 }; 88 };
91 89
92 bool hasDOMActivityLogger(int worldId, const WebString& extensionId) 90 bool hasDOMActivityLogger(int worldId, const WebString& extensionId)
93 { 91 {
94 return V8DOMActivityLogger::activityLogger(worldId, extensionId); 92 return V8DOMActivityLogger::activityLogger(worldId, extensionId);
95 } 93 }
96 94
97 void setDOMActivityLogger(int worldId, const WebString& extensionId, WebDOMActiv ityLogger* logger) 95 void setDOMActivityLogger(int worldId, const WebString& extensionId, WebDOMActiv ityLogger* logger)
98 { 96 {
99 DCHECK(logger); 97 DCHECK(logger);
100 V8DOMActivityLogger::setActivityLogger(worldId, extensionId, wrapUnique(new DOMActivityLoggerContainer(wrapUnique(logger)))); 98 V8DOMActivityLogger::setActivityLogger(worldId, extensionId, adoptPtr(new DO MActivityLoggerContainer(adoptPtr(logger))));
101 } 99 }
102 100
103 } // namespace blink 101 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebBlob.cpp ('k') | third_party/WebKit/Source/web/WebDataSourceImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698