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

Side by Side Diff: Source/web/WebSpeechRecognitionResult.cpp

Issue 168963003: Make WebPrivatePtr capable of wrapping garbage collected objects. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Temporarily drop back to using .reset() instead of nullptr. Created 6 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 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 16 matching lines...) Expand all
27 #include "WebSpeechRecognitionResult.h" 27 #include "WebSpeechRecognitionResult.h"
28 28
29 #include "heap/Handle.h" 29 #include "heap/Handle.h"
30 #include "modules/speech/SpeechRecognitionAlternative.h" 30 #include "modules/speech/SpeechRecognitionAlternative.h"
31 #include "modules/speech/SpeechRecognitionResult.h" 31 #include "modules/speech/SpeechRecognitionResult.h"
32 #include "wtf/PassRefPtr.h" 32 #include "wtf/PassRefPtr.h"
33 #include "wtf/RawPtr.h" 33 #include "wtf/RawPtr.h"
34 #include "wtf/RefPtr.h" 34 #include "wtf/RefPtr.h"
35 #include "wtf/Vector.h" 35 #include "wtf/Vector.h"
36 36
37 // FIXME: oilpan: If the WebCore-qualified Oilpan transition types
38 // used below map to CPP #defines, move the type names they expand to
39 // into the WebCore namespace. When Oilpan is always enabled, this
40 // block can be removed.
41 namespace WebCore {
42 using WTF::RawPtr;
43 using WTF::RefPtr;
44 using WTF::Vector;
45 };
46
47 namespace blink { 37 namespace blink {
48 38
49 void WebSpeechRecognitionResult::assign(const WebSpeechRecognitionResult& other) 39 void WebSpeechRecognitionResult::assign(const WebSpeechRecognitionResult& other)
50 { 40 {
51 m_private = other.m_private; 41 m_private = other.m_private;
52 } 42 }
53 43
54 void WebSpeechRecognitionResult::assign(const WebVector<WebString>& transcripts, const WebVector<float>& confidences, bool final) 44 void WebSpeechRecognitionResult::assign(const WebVector<WebString>& transcripts, const WebVector<float>& confidences, bool final)
55 { 45 {
56 ASSERT(transcripts.size() == confidences.size()); 46 ASSERT(transcripts.size() == confidences.size());
57 47
58 WebCore::WillBeHeapVector<WebCore::RefPtrWillBeMember<WebCore::SpeechRecogni tionAlternative> > alternatives(transcripts.size()); 48 WillBeHeapVector<RefPtrWillBeMember<WebCore::SpeechRecognitionAlternative> > alternatives(transcripts.size());
59 for (size_t i = 0; i < transcripts.size(); ++i) 49 for (size_t i = 0; i < transcripts.size(); ++i)
60 alternatives[i] = WebCore::SpeechRecognitionAlternative::create(transcri pts[i], confidences[i]); 50 alternatives[i] = WebCore::SpeechRecognitionAlternative::create(transcri pts[i], confidences[i]);
61 51
62 m_private = WebCore::SpeechRecognitionResult::create(alternatives, final); 52 m_private = WebCore::SpeechRecognitionResult::create(alternatives, final);
63 } 53 }
64 54
65 void WebSpeechRecognitionResult::reset() 55 void WebSpeechRecognitionResult::reset()
66 { 56 {
67 m_private.reset(); 57 m_private.reset();
68 } 58 }
69 59
70 WebSpeechRecognitionResult::operator PassRefPtr<WebCore::SpeechRecognitionResult >() const 60 WebSpeechRecognitionResult::operator PassRefPtrWillBeRawPtr<WebCore::SpeechRecog nitionResult>() const
71 { 61 {
72 return m_private.get(); 62 return m_private.get();
73 } 63 }
74 64
75 } // namespace blink 65 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698