OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/spellchecker/spellcheck_hunspell_dictionary.h" | 5 #include "chrome/browser/spellchecker/spellcheck_hunspell_dictionary.h" |
6 | 6 |
7 #include "base/files/file_util.h" | 7 #include "base/files/file_util.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
72 | 72 |
73 SpellcheckHunspellDictionary::DictionaryFile::~DictionaryFile() { | 73 SpellcheckHunspellDictionary::DictionaryFile::~DictionaryFile() { |
74 if (file.IsValid()) { | 74 if (file.IsValid()) { |
75 BrowserThread::PostTask( | 75 BrowserThread::PostTask( |
76 BrowserThread::FILE, | 76 BrowserThread::FILE, |
77 FROM_HERE, | 77 FROM_HERE, |
78 base::Bind(&CloseDictionary, Passed(&file))); | 78 base::Bind(&CloseDictionary, Passed(&file))); |
79 } | 79 } |
80 } | 80 } |
81 | 81 |
82 SpellcheckHunspellDictionary::DictionaryFile::DictionaryFile(RValue other) | 82 SpellcheckHunspellDictionary::DictionaryFile::DictionaryFile( |
83 : path(other.object->path), | 83 DictionaryFile&& other) |
84 file(other.object->file.Pass()) { | 84 : path(other.path), file(other.file.Pass()) {} |
85 } | |
86 | 85 |
87 SpellcheckHunspellDictionary::DictionaryFile& | 86 SpellcheckHunspellDictionary::DictionaryFile& |
88 SpellcheckHunspellDictionary::DictionaryFile::operator=(RValue other) { | 87 SpellcheckHunspellDictionary::DictionaryFile:: |
89 if (this != other.object) { | 88 operator=(DictionaryFile&& other) { |
90 path = other.object->path; | 89 DCHECK_NE(this, &other); |
danakj
2015/10/15 23:35:06
this looks non-destructive, can we remove the dche
dcheng
2015/10/16 00:40:01
file = other.file.Pass()
is destructive.
That be
danakj
2015/10/16 00:44:24
I think that's the right way to do it ya.
dcheng
2015/10/19 21:29:50
Done.
| |
91 file = other.object->file.Pass(); | 90 path = other.path; |
92 } | 91 file = other.file.Pass(); |
93 return *this; | 92 return *this; |
94 } | 93 } |
95 | 94 |
96 SpellcheckHunspellDictionary::SpellcheckHunspellDictionary( | 95 SpellcheckHunspellDictionary::SpellcheckHunspellDictionary( |
97 const std::string& language, | 96 const std::string& language, |
98 net::URLRequestContextGetter* request_context_getter, | 97 net::URLRequestContextGetter* request_context_getter, |
99 SpellcheckService* spellcheck_service) | 98 SpellcheckService* spellcheck_service) |
100 : language_(language), | 99 : language_(language), |
101 use_browser_spellchecker_(false), | 100 use_browser_spellchecker_(false), |
102 request_context_getter_(request_context_getter), | 101 request_context_getter_(request_context_getter), |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
368 FOR_EACH_OBSERVER(Observer, observers_, | 367 FOR_EACH_OBSERVER(Observer, observers_, |
369 OnHunspellDictionaryInitialized(language_)); | 368 OnHunspellDictionaryInitialized(language_)); |
370 } | 369 } |
371 | 370 |
372 void SpellcheckHunspellDictionary::InformListenersOfDownloadFailure() { | 371 void SpellcheckHunspellDictionary::InformListenersOfDownloadFailure() { |
373 download_status_ = DOWNLOAD_FAILED; | 372 download_status_ = DOWNLOAD_FAILED; |
374 FOR_EACH_OBSERVER(Observer, | 373 FOR_EACH_OBSERVER(Observer, |
375 observers_, | 374 observers_, |
376 OnHunspellDictionaryDownloadFailure(language_)); | 375 OnHunspellDictionaryDownloadFailure(language_)); |
377 } | 376 } |
OLD | NEW |