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

Side by Side Diff: third_party/WebKit/Source/modules/push_messaging/PushMessageData.cpp

Issue 1978173002: Remove OwnPtr::release() calls in modules/ (part 2). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « third_party/WebKit/Source/modules/presentation/PresentationConnectionCallbacks.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "modules/push_messaging/PushMessageData.h" 5 #include "modules/push_messaging/PushMessageData.h"
6 6
7 #include "bindings/core/v8/ExceptionState.h" 7 #include "bindings/core/v8/ExceptionState.h"
8 #include "bindings/core/v8/ScriptState.h" 8 #include "bindings/core/v8/ScriptState.h"
9 #include "bindings/core/v8/V8Binding.h" 9 #include "bindings/core/v8/V8Binding.h"
10 #include "bindings/modules/v8/UnionTypesModules.h" 10 #include "bindings/modules/v8/UnionTypesModules.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 61
62 Blob* PushMessageData::blob() const 62 Blob* PushMessageData::blob() const
63 { 63 {
64 OwnPtr<BlobData> blobData = BlobData::create(); 64 OwnPtr<BlobData> blobData = BlobData::create();
65 blobData->appendBytes(m_data.data(), m_data.size()); 65 blobData->appendBytes(m_data.data(), m_data.size());
66 66
67 // Note that the content type of the Blob object is deliberately not being 67 // Note that the content type of the Blob object is deliberately not being
68 // provided, following the specification. 68 // provided, following the specification.
69 69
70 const long long byteLength = blobData->length(); 70 const long long byteLength = blobData->length();
71 return Blob::create(BlobDataHandle::create(blobData.release(), byteLength)); 71 return Blob::create(BlobDataHandle::create(std::move(blobData), byteLength)) ;
72 } 72 }
73 73
74 ScriptValue PushMessageData::json(ScriptState* scriptState, ExceptionState& exce ptionState) const 74 ScriptValue PushMessageData::json(ScriptState* scriptState, ExceptionState& exce ptionState) const
75 { 75 {
76 v8::Isolate* isolate = scriptState->isolate(); 76 v8::Isolate* isolate = scriptState->isolate();
77 77
78 ScriptState::Scope scope(scriptState); 78 ScriptState::Scope scope(scriptState);
79 v8::Local<v8::String> dataString = v8String(isolate, text()); 79 v8::Local<v8::String> dataString = v8String(isolate, text());
80 80
81 v8::TryCatch block(isolate); 81 v8::TryCatch block(isolate);
82 v8::Local<v8::Value> parsed; 82 v8::Local<v8::Value> parsed;
83 if (!v8Call(v8::JSON::Parse(isolate, dataString), parsed, block)) { 83 if (!v8Call(v8::JSON::Parse(isolate, dataString), parsed, block)) {
84 exceptionState.rethrowV8Exception(block.Exception()); 84 exceptionState.rethrowV8Exception(block.Exception());
85 return ScriptValue(); 85 return ScriptValue();
86 } 86 }
87 87
88 return ScriptValue(scriptState, parsed); 88 return ScriptValue(scriptState, parsed);
89 } 89 }
90 90
91 String PushMessageData::text() const 91 String PushMessageData::text() const
92 { 92 {
93 return UTF8Encoding().decode(m_data.data(), m_data.size()); 93 return UTF8Encoding().decode(m_data.data(), m_data.size());
94 } 94 }
95 95
96 DEFINE_TRACE(PushMessageData) 96 DEFINE_TRACE(PushMessageData)
97 { 97 {
98 } 98 }
99 99
100 } // namespace blink 100 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/presentation/PresentationConnectionCallbacks.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698