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

Side by Side Diff: chrome/browser/devtools/devtools_ui_bindings.cc

Issue 2425673006: Make URLFetcherFileWriter::Finish() skip closing file when there is an error (Closed)
Patch Set: Fix another subclass Created 4 years, 2 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 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 "chrome/browser/devtools/devtools_ui_bindings.h" 5 #include "chrome/browser/devtools/devtools_ui_bindings.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 class ResponseWriter : public net::URLFetcherResponseWriter { 242 class ResponseWriter : public net::URLFetcherResponseWriter {
243 public: 243 public:
244 ResponseWriter(base::WeakPtr<DevToolsUIBindings> bindings, int stream_id); 244 ResponseWriter(base::WeakPtr<DevToolsUIBindings> bindings, int stream_id);
245 ~ResponseWriter() override; 245 ~ResponseWriter() override;
246 246
247 // URLFetcherResponseWriter overrides: 247 // URLFetcherResponseWriter overrides:
248 int Initialize(const net::CompletionCallback& callback) override; 248 int Initialize(const net::CompletionCallback& callback) override;
249 int Write(net::IOBuffer* buffer, 249 int Write(net::IOBuffer* buffer,
250 int num_bytes, 250 int num_bytes,
251 const net::CompletionCallback& callback) override; 251 const net::CompletionCallback& callback) override;
252 int Finish(const net::CompletionCallback& callback) override; 252 int Finish(int net_error, const net::CompletionCallback& callback) override;
253 253
254 private: 254 private:
255 base::WeakPtr<DevToolsUIBindings> bindings_; 255 base::WeakPtr<DevToolsUIBindings> bindings_;
256 int stream_id_; 256 int stream_id_;
257 257
258 DISALLOW_COPY_AND_ASSIGN(ResponseWriter); 258 DISALLOW_COPY_AND_ASSIGN(ResponseWriter);
259 }; 259 };
260 260
261 ResponseWriter::ResponseWriter(base::WeakPtr<DevToolsUIBindings> bindings, 261 ResponseWriter::ResponseWriter(base::WeakPtr<DevToolsUIBindings> bindings,
262 int stream_id) 262 int stream_id)
(...skipping 23 matching lines...) Expand all
286 base::FundamentalValue* encodedValue = new base::FundamentalValue(encoded); 286 base::FundamentalValue* encodedValue = new base::FundamentalValue(encoded);
287 287
288 content::BrowserThread::PostTask( 288 content::BrowserThread::PostTask(
289 content::BrowserThread::UI, FROM_HERE, 289 content::BrowserThread::UI, FROM_HERE,
290 base::Bind(&DevToolsUIBindings::CallClientFunction, bindings_, 290 base::Bind(&DevToolsUIBindings::CallClientFunction, bindings_,
291 "DevToolsAPI.streamWrite", base::Owned(id), 291 "DevToolsAPI.streamWrite", base::Owned(id),
292 base::Owned(chunkValue), base::Owned(encodedValue))); 292 base::Owned(chunkValue), base::Owned(encodedValue)));
293 return num_bytes; 293 return num_bytes;
294 } 294 }
295 295
296 int ResponseWriter::Finish(const net::CompletionCallback& callback) { 296 int ResponseWriter::Finish(int net_error,
297 const net::CompletionCallback& callback) {
297 return net::OK; 298 return net::OK;
298 } 299 }
299 300
300 } // namespace 301 } // namespace
301 302
302 // DevToolsUIBindings::FrontendWebContentsObserver ---------------------------- 303 // DevToolsUIBindings::FrontendWebContentsObserver ----------------------------
303 304
304 class DevToolsUIBindings::FrontendWebContentsObserver 305 class DevToolsUIBindings::FrontendWebContentsObserver
305 : public content::WebContentsObserver { 306 : public content::WebContentsObserver {
306 public: 307 public:
(...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after
1168 void DevToolsUIBindings::FrontendLoaded() { 1169 void DevToolsUIBindings::FrontendLoaded() {
1169 if (frontend_loaded_) 1170 if (frontend_loaded_)
1170 return; 1171 return;
1171 frontend_loaded_ = true; 1172 frontend_loaded_ = true;
1172 1173
1173 // Call delegate first - it seeds importants bit of information. 1174 // Call delegate first - it seeds importants bit of information.
1174 delegate_->OnLoadCompleted(); 1175 delegate_->OnLoadCompleted();
1175 1176
1176 AddDevToolsExtensionsToClient(); 1177 AddDevToolsExtensionsToClient();
1177 } 1178 }
OLDNEW
« no previous file with comments | « no previous file | components/precache/core/precache_fetcher.cc » ('j') | net/url_request/url_fetcher_response_writer.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698