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

Unified Diff: third_party/WebKit/Source/bindings/core/v8/ScriptStreamer.cpp

Issue 2050123002: Remove OwnPtr from Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: First attempt to land. 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/bindings/core/v8/ScriptStreamer.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptStreamer.cpp b/third_party/WebKit/Source/bindings/core/v8/ScriptStreamer.cpp
index 642cb5ceaf41d1a80a2c62552ff021c9ce4bcaf7..d286f919e5dcdc6aed17a63e4b6efa00d9db202a 100644
--- a/third_party/WebKit/Source/bindings/core/v8/ScriptStreamer.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/ScriptStreamer.cpp
@@ -18,7 +18,9 @@
#include "platform/TraceEvent.h"
#include "public/platform/WebScheduler.h"
#include "wtf/Deque.h"
+#include "wtf/PtrUtil.h"
#include "wtf/text/TextEncodingRegistry.h"
+#include <memory>
namespace blink {
@@ -179,7 +181,7 @@ public:
, m_queueTailPosition(0)
, m_bookmarkPosition(0)
, m_lengthOfBOM(0)
- , m_loadingTaskRunner(adoptPtr(loadingTaskRunner->clone()))
+ , m_loadingTaskRunner(wrapUnique(loadingTaskRunner->clone()))
{
}
@@ -387,7 +389,7 @@ private:
// m_queueLeadPosition references with a mutex.
size_t m_lengthOfBOM; // Used by both threads; guarded by m_mutex.
- OwnPtr<WebTaskRunner> m_loadingTaskRunner;
+ std::unique_ptr<WebTaskRunner> m_loadingTaskRunner;
};
size_t ScriptStreamer::s_smallScriptThreshold = 30 * 1024;
@@ -500,7 +502,7 @@ void ScriptStreamer::notifyAppendData(ScriptResource* resource)
const char* data = 0;
size_t length = resource->resourceBuffer()->getSomeData(data, static_cast<size_t>(0));
- OwnPtr<TextResourceDecoder> decoder(TextResourceDecoder::create("application/javascript", resource->encoding()));
+ std::unique_ptr<TextResourceDecoder> decoder(TextResourceDecoder::create("application/javascript", resource->encoding()));
lengthOfBOM = decoder->checkForBOM(data, length);
// Maybe the encoding changed because we saw the BOM; get the encoding
@@ -533,10 +535,10 @@ void ScriptStreamer::notifyAppendData(ScriptResource* resource)
ASSERT(!m_source);
m_stream = new SourceStream(m_loadingTaskRunner.get());
// m_source takes ownership of m_stream.
- m_source = adoptPtr(new v8::ScriptCompiler::StreamedSource(m_stream, m_encoding));
+ m_source = wrapUnique(new v8::ScriptCompiler::StreamedSource(m_stream, m_encoding));
ScriptState::Scope scope(m_scriptState.get());
- OwnPtr<v8::ScriptCompiler::ScriptStreamingTask> scriptStreamingTask(adoptPtr(v8::ScriptCompiler::StartStreamingScript(m_scriptState->isolate(), m_source.get(), m_compileOptions)));
+ std::unique_ptr<v8::ScriptCompiler::ScriptStreamingTask> scriptStreamingTask(wrapUnique(v8::ScriptCompiler::StartStreamingScript(m_scriptState->isolate(), m_source.get(), m_compileOptions)));
if (!scriptStreamingTask) {
// V8 cannot stream the script.
suppressStreaming();
@@ -589,7 +591,7 @@ ScriptStreamer::ScriptStreamer(PendingScript* script, Type scriptType, ScriptSta
, m_scriptURLString(m_resource->url().copy().getString())
, m_scriptResourceIdentifier(m_resource->identifier())
, m_encoding(v8::ScriptCompiler::StreamedSource::TWO_BYTE) // Unfortunately there's no dummy encoding value in the enum; let's use one we don't stream.
- , m_loadingTaskRunner(adoptPtr(loadingTaskRunner->clone()))
+ , m_loadingTaskRunner(wrapUnique(loadingTaskRunner->clone()))
{
}

Powered by Google App Engine
This is Rietveld 408576698