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

Side by Side Diff: content/shell/browser/shell_devtools_frontend.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 | « components/precache/core/precache_fetcher.cc ('k') | google_apis/drive/base_requests.h » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/shell/browser/shell_devtools_frontend.h" 5 #include "content/shell/browser/shell_devtools_frontend.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/json/json_reader.h" 9 #include "base/json/json_reader.h"
10 #include "base/json/json_writer.h" 10 #include "base/json/json_writer.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 public: 42 public:
43 ResponseWriter(base::WeakPtr<ShellDevToolsFrontend> shell_devtools_, 43 ResponseWriter(base::WeakPtr<ShellDevToolsFrontend> shell_devtools_,
44 int stream_id); 44 int stream_id);
45 ~ResponseWriter() override; 45 ~ResponseWriter() override;
46 46
47 // URLFetcherResponseWriter overrides: 47 // URLFetcherResponseWriter overrides:
48 int Initialize(const net::CompletionCallback& callback) override; 48 int Initialize(const net::CompletionCallback& callback) override;
49 int Write(net::IOBuffer* buffer, 49 int Write(net::IOBuffer* buffer,
50 int num_bytes, 50 int num_bytes,
51 const net::CompletionCallback& callback) override; 51 const net::CompletionCallback& callback) override;
52 int Finish(const net::CompletionCallback& callback) override; 52 int Finish(int net_error, const net::CompletionCallback& callback) override;
53 53
54 private: 54 private:
55 base::WeakPtr<ShellDevToolsFrontend> shell_devtools_; 55 base::WeakPtr<ShellDevToolsFrontend> shell_devtools_;
56 int stream_id_; 56 int stream_id_;
57 57
58 DISALLOW_COPY_AND_ASSIGN(ResponseWriter); 58 DISALLOW_COPY_AND_ASSIGN(ResponseWriter);
59 }; 59 };
60 60
61 ResponseWriter::ResponseWriter( 61 ResponseWriter::ResponseWriter(
62 base::WeakPtr<ShellDevToolsFrontend> shell_devtools, 62 base::WeakPtr<ShellDevToolsFrontend> shell_devtools,
(...skipping 20 matching lines...) Expand all
83 base::StringValue* chunkValue = new base::StringValue(chunk); 83 base::StringValue* chunkValue = new base::StringValue(chunk);
84 84
85 content::BrowserThread::PostTask( 85 content::BrowserThread::PostTask(
86 content::BrowserThread::UI, FROM_HERE, 86 content::BrowserThread::UI, FROM_HERE,
87 base::Bind(&ShellDevToolsFrontend::CallClientFunction, 87 base::Bind(&ShellDevToolsFrontend::CallClientFunction,
88 shell_devtools_, "DevToolsAPI.streamWrite", 88 shell_devtools_, "DevToolsAPI.streamWrite",
89 base::Owned(id), base::Owned(chunkValue), nullptr)); 89 base::Owned(id), base::Owned(chunkValue), nullptr));
90 return num_bytes; 90 return num_bytes;
91 } 91 }
92 92
93 int ResponseWriter::Finish(const net::CompletionCallback& callback) { 93 int ResponseWriter::Finish(int net_error,
94 const net::CompletionCallback& callback) {
94 return net::OK; 95 return net::OK;
95 } 96 }
96 97
97 static GURL GetFrontendURL() { 98 static GURL GetFrontendURL() {
98 int port = ShellDevToolsManagerDelegate::GetHttpHandlerPort(); 99 int port = ShellDevToolsManagerDelegate::GetHttpHandlerPort();
99 return GURL( 100 return GURL(
100 base::StringPrintf("http://127.0.0.1:%d/devtools/inspector.html", port)); 101 base::StringPrintf("http://127.0.0.1:%d/devtools/inspector.html", port));
101 } 102 }
102 103
103 } // namespace 104 } // namespace
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 CallClientFunction("DevToolsAPI.embedderMessageAck", 370 CallClientFunction("DevToolsAPI.embedderMessageAck",
370 &id_value, arg, nullptr); 371 &id_value, arg, nullptr);
371 } 372 }
372 373
373 void ShellDevToolsFrontend::AgentHostClosed( 374 void ShellDevToolsFrontend::AgentHostClosed(
374 DevToolsAgentHost* agent_host, bool replaced) { 375 DevToolsAgentHost* agent_host, bool replaced) {
375 frontend_shell_->Close(); 376 frontend_shell_->Close();
376 } 377 }
377 378
378 } // namespace content 379 } // namespace content
OLDNEW
« no previous file with comments | « components/precache/core/precache_fetcher.cc ('k') | google_apis/drive/base_requests.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698