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

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 test 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
« no previous file with comments | « no previous file | components/precache/core/precache_fetcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 869 matching lines...) Expand 10 before | Expand all | Expand 10 after
1176 void DevToolsUIBindings::FrontendLoaded() { 1177 void DevToolsUIBindings::FrontendLoaded() {
1177 if (frontend_loaded_) 1178 if (frontend_loaded_)
1178 return; 1179 return;
1179 frontend_loaded_ = true; 1180 frontend_loaded_ = true;
1180 1181
1181 // Call delegate first - it seeds importants bit of information. 1182 // Call delegate first - it seeds importants bit of information.
1182 delegate_->OnLoadCompleted(); 1183 delegate_->OnLoadCompleted();
1183 1184
1184 AddDevToolsExtensionsToClient(); 1185 AddDevToolsExtensionsToClient();
1185 } 1186 }
OLDNEW
« no previous file with comments | « no previous file | components/precache/core/precache_fetcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698