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

Side by Side Diff: third_party/WebKit/Source/modules/presentation/PresentationConnectionCallbacks.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 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/presentation/PresentationConnectionCallbacks.h" 5 #include "modules/presentation/PresentationConnectionCallbacks.h"
6 6
7 #include "bindings/core/v8/ScriptPromiseResolver.h" 7 #include "bindings/core/v8/ScriptPromiseResolver.h"
8 #include "modules/presentation/PresentationConnection.h" 8 #include "modules/presentation/PresentationConnection.h"
9 #include "modules/presentation/PresentationError.h" 9 #include "modules/presentation/PresentationError.h"
10 #include "modules/presentation/PresentationRequest.h" 10 #include "modules/presentation/PresentationRequest.h"
11 #include "public/platform/modules/presentation/WebPresentationConnectionClient.h " 11 #include "public/platform/modules/presentation/WebPresentationConnectionClient.h "
12 #include "public/platform/modules/presentation/WebPresentationError.h" 12 #include "public/platform/modules/presentation/WebPresentationError.h"
13 #include "wtf/PtrUtil.h"
14 #include <memory>
15 13
16 namespace blink { 14 namespace blink {
17 15
18 PresentationConnectionCallbacks::PresentationConnectionCallbacks(ScriptPromiseRe solver* resolver, PresentationRequest* request) 16 PresentationConnectionCallbacks::PresentationConnectionCallbacks(ScriptPromiseRe solver* resolver, PresentationRequest* request)
19 : m_resolver(resolver) 17 : m_resolver(resolver)
20 , m_request(request) 18 , m_request(request)
21 { 19 {
22 ASSERT(m_resolver); 20 ASSERT(m_resolver);
23 ASSERT(m_request); 21 ASSERT(m_request);
24 } 22 }
25 23
26 void PresentationConnectionCallbacks::onSuccess(std::unique_ptr<WebPresentationC onnectionClient> PresentationConnectionClient) 24 void PresentationConnectionCallbacks::onSuccess(std::unique_ptr<WebPresentationC onnectionClient> PresentationConnectionClient)
27 { 25 {
28 std::unique_ptr<WebPresentationConnectionClient> result(wrapUnique(Presentat ionConnectionClient.release())); 26 OwnPtr<WebPresentationConnectionClient> result(adoptPtr(PresentationConnecti onClient.release()));
29 27
30 if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContext()- >activeDOMObjectsAreStopped()) 28 if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContext()- >activeDOMObjectsAreStopped())
31 return; 29 return;
32 m_resolver->resolve(PresentationConnection::take(m_resolver.get(), std::move (result), m_request)); 30 m_resolver->resolve(PresentationConnection::take(m_resolver.get(), std::move (result), m_request));
33 } 31 }
34 32
35 void PresentationConnectionCallbacks::onError(const WebPresentationError& error) 33 void PresentationConnectionCallbacks::onError(const WebPresentationError& error)
36 { 34 {
37 if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContext()- >activeDOMObjectsAreStopped()) 35 if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContext()- >activeDOMObjectsAreStopped())
38 return; 36 return;
39 m_resolver->reject(PresentationError::take(m_resolver.get(), error)); 37 m_resolver->reject(PresentationError::take(m_resolver.get(), error));
40 } 38 }
41 39
42 } // namespace blink 40 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698