| OLD | NEW |
| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <sstream> | 6 #include <sstream> |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 // The pagination algorithm to use, one of "next", "pagenum". | 118 // The pagination algorithm to use, one of "next", "pagenum". |
| 119 const char* kPaginationAlgo = "pagination-algo"; | 119 const char* kPaginationAlgo = "pagination-algo"; |
| 120 | 120 |
| 121 // Maximum number of concurrent started extractor requests. | 121 // Maximum number of concurrent started extractor requests. |
| 122 const int kMaxExtractorTasks = 8; | 122 const int kMaxExtractorTasks = 8; |
| 123 | 123 |
| 124 std::unique_ptr<DomDistillerService> CreateDomDistillerService( | 124 std::unique_ptr<DomDistillerService> CreateDomDistillerService( |
| 125 content::BrowserContext* context, | 125 content::BrowserContext* context, |
| 126 const base::FilePath& db_path, | 126 const base::FilePath& db_path, |
| 127 const FileToUrlMap& file_to_url_map) { | 127 const FileToUrlMap& file_to_url_map) { |
| 128 base::SequencedWorkerPool* blocking_pool = |
| 129 content::BrowserThread::GetBlockingPool(); |
| 128 scoped_refptr<base::SequencedTaskRunner> background_task_runner = | 130 scoped_refptr<base::SequencedTaskRunner> background_task_runner = |
| 129 content::BrowserThread::GetBlockingPool()->GetSequencedTaskRunner( | 131 blocking_pool->GetSequencedTaskRunner(blocking_pool->GetSequenceToken()); |
| 130 content::BrowserThread::GetBlockingPool()->GetSequenceToken()); | |
| 131 | 132 |
| 132 // TODO(cjhopman): use an in-memory database instead of an on-disk one with | 133 // TODO(cjhopman): use an in-memory database instead of an on-disk one with |
| 133 // temporary directory. | 134 // temporary directory. |
| 134 std::unique_ptr<leveldb_proto::ProtoDatabaseImpl<ArticleEntry>> db( | 135 std::unique_ptr<leveldb_proto::ProtoDatabaseImpl<ArticleEntry>> db( |
| 135 new leveldb_proto::ProtoDatabaseImpl<ArticleEntry>( | 136 new leveldb_proto::ProtoDatabaseImpl<ArticleEntry>( |
| 136 background_task_runner)); | 137 background_task_runner)); |
| 137 std::unique_ptr<DomDistillerStore> dom_distiller_store( | 138 std::unique_ptr<DomDistillerStore> dom_distiller_store( |
| 138 new DomDistillerStore(std::move(db), db_path)); | 139 new DomDistillerStore(std::move(db), db_path)); |
| 139 | 140 |
| 140 std::unique_ptr<DistillerPageFactory> distiller_page_factory( | 141 std::unique_ptr<DistillerPageFactory> distiller_page_factory( |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 protobuf_output_stream_; | 439 protobuf_output_stream_; |
| 439 }; | 440 }; |
| 440 | 441 |
| 441 IN_PROC_BROWSER_TEST_F(ContentExtractor, MANUAL_ExtractUrl) { | 442 IN_PROC_BROWSER_TEST_F(ContentExtractor, MANUAL_ExtractUrl) { |
| 442 SetDistillerJavaScriptWorldId(content::ISOLATED_WORLD_ID_CONTENT_END); | 443 SetDistillerJavaScriptWorldId(content::ISOLATED_WORLD_ID_CONTENT_END); |
| 443 Start(); | 444 Start(); |
| 444 base::RunLoop().Run(); | 445 base::RunLoop().Run(); |
| 445 } | 446 } |
| 446 | 447 |
| 447 } // namespace dom_distiller | 448 } // namespace dom_distiller |
| OLD | NEW |