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

Unified Diff: third_party/WebKit/Source/core/inspector/InspectorPageAgent.cpp

Issue 1745423002: DevTools: migrate protocol values from RefPtr to OwnPtr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/inspector/InspectorPageAgent.cpp
diff --git a/third_party/WebKit/Source/core/inspector/InspectorPageAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorPageAgent.cpp
index 07a473eb8f1d6a5fbacb6d7b610b0d1dd1bbaf48..d0fb0d4eaeceec73d90a3c820fbe0a825131d846 100644
--- a/third_party/WebKit/Source/core/inspector/InspectorPageAgent.cpp
+++ b/third_party/WebKit/Source/core/inspector/InspectorPageAgent.cpp
@@ -388,23 +388,24 @@ void InspectorPageAgent::disable(ErrorString*)
void InspectorPageAgent::addScriptToEvaluateOnLoad(ErrorString*, const String& source, String* identifier)
{
- RefPtr<protocol::DictionaryValue> scripts = m_state->getObject(PageAgentState::pageAgentScriptsToEvaluateOnLoad);
+ protocol::DictionaryValue* scripts = m_state->getObject(PageAgentState::pageAgentScriptsToEvaluateOnLoad);
if (!scripts) {
- scripts = protocol::DictionaryValue::create();
- m_state->setObject(PageAgentState::pageAgentScriptsToEvaluateOnLoad, scripts);
+ OwnPtr<protocol::DictionaryValue> newScripts = protocol::DictionaryValue::create();
+ scripts = newScripts.get();
+ m_state->setObject(PageAgentState::pageAgentScriptsToEvaluateOnLoad, newScripts.release());
}
// Assure we don't override existing ids -- m_lastScriptIdentifier could get out of sync WRT actual
// scripts once we restored the scripts from the cookie during navigation.
do {
*identifier = String::number(++m_lastScriptIdentifier);
- } while (scripts->find(*identifier) != scripts->end());
+ } while (scripts->get(*identifier));
scripts->setString(*identifier, source);
}
void InspectorPageAgent::removeScriptToEvaluateOnLoad(ErrorString* error, const String& identifier)
{
- RefPtr<protocol::DictionaryValue> scripts = m_state->getObject(PageAgentState::pageAgentScriptsToEvaluateOnLoad);
- if (!scripts || scripts->find(identifier) == scripts->end()) {
+ protocol::DictionaryValue* scripts = m_state->getObject(PageAgentState::pageAgentScriptsToEvaluateOnLoad);
+ if (!scripts || !scripts->get(identifier)) {
*error = "Script not found";
return;
}
@@ -589,7 +590,7 @@ void InspectorPageAgent::didClearDocumentOfWindowObject(LocalFrame* frame)
if (!frontend())
return;
- RefPtr<protocol::DictionaryValue> scripts = m_state->getObject(PageAgentState::pageAgentScriptsToEvaluateOnLoad);
+ protocol::DictionaryValue* scripts = m_state->getObject(PageAgentState::pageAgentScriptsToEvaluateOnLoad);
if (scripts) {
for (const auto& script : *scripts) {
String scriptText;

Powered by Google App Engine
This is Rietveld 408576698