|
|
Created:
6 years, 10 months ago by Evan Stade Modified:
6 years, 10 months ago CC:
chromium-reviews, cbentzel+watch_chromium.org Base URL:
svn://svn.chromium.org/chrome/trunk/src Visibility:
Public. |
Descriptionlibaddressinput - one less copy when downloading data
BUG=337679
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=248561
Patch Set 1 #Patch Set 2 : move ownership of urlfetcher #
Total comments: 5
Patch Set 3 : checks #
Total comments: 6
Patch Set 4 : fix destruction order #Patch Set 5 : re-up #
Messages
Total messages: 40 (0 generated)
For context, libaddressinput downloads one potentially large block of data, which I'd like to avoid copying around too much.
https://codereview.chromium.org/151133002/diff/20001/net/url_request/test_url... File net/url_request/test_url_fetcher_factory.cc (right): https://codereview.chromium.org/151133002/diff/20001/net/url_request/test_url... net/url_request/test_url_fetcher_factory.cc:163: scoped_refptr<IOBuffer> buffer = new StringIOBuffer(fake_response_string_); pedantic nit: buffer(new StringIOBuffer(...)) ? https://codereview.chromium.org/151133002/diff/20001/net/url_request/test_url... net/url_request/test_url_fetcher_factory.cc:166: CompletionCallback()); This doesn't fully match the URLFetcher / URLFetcherResponseWriter interface. If you're going to allow callers to supply an arbitrary URLFRW, I feel like we should at least try to not violate 'least surprise' here. Namely, https://code.google.com/p/chromium/codesearch#chromium/src/net/url_request/ur... Write() may not write all of the data from fake_response_string_, so we should try to continue writing more.
https://codereview.chromium.org/151133002/diff/20001/net/url_request/test_url... File net/url_request/test_url_fetcher_factory.cc (right): https://codereview.chromium.org/151133002/diff/20001/net/url_request/test_url... net/url_request/test_url_fetcher_factory.cc:166: CompletionCallback()); On 2014/01/31 21:03:17, Ryan Sleevi wrote: > This doesn't fully match the URLFetcher / URLFetcherResponseWriter interface. > > If you're going to allow callers to supply an arbitrary URLFRW, I feel like we > should at least try to not violate 'least surprise' here. > > Namely, > https://code.google.com/p/chromium/codesearch#chromium/src/net/url_request/ur... > > Write() may not write all of the data from fake_response_string_, so we should > try to continue writing more. well, it has several flaws: a) SetResponseString must have been previously called (as opposed to being called afterwards) b) async Writers are not supported c) writers that don't write all of buffer will fail (as you've noted) Fixing all these things would require a bit of effort. Spending effort on code to support tests which don't exist seems like a bit of a waste, I think. No one bothered to implement SaveResponseWithWriter at all (until it was needed), now it's partially implemented, which seems like an improvement.
On 2014/01/31 22:24:57, Evan Stade wrote: > https://codereview.chromium.org/151133002/diff/20001/net/url_request/test_url... > File net/url_request/test_url_fetcher_factory.cc (right): > > https://codereview.chromium.org/151133002/diff/20001/net/url_request/test_url... > net/url_request/test_url_fetcher_factory.cc:166: CompletionCallback()); > On 2014/01/31 21:03:17, Ryan Sleevi wrote: > > This doesn't fully match the URLFetcher / URLFetcherResponseWriter interface. > > > > If you're going to allow callers to supply an arbitrary URLFRW, I feel like we > > should at least try to not violate 'least surprise' here. > > > > Namely, > > > https://code.google.com/p/chromium/codesearch#chromium/src/net/url_request/ur... > > > > Write() may not write all of the data from fake_response_string_, so we should > > try to continue writing more. > > well, it has several flaws: > > a) SetResponseString must have been previously called (as opposed to being > called afterwards) > b) async Writers are not supported > c) writers that don't write all of buffer will fail (as you've noted) > > Fixing all these things would require a bit of effort. Spending effort on code > to support tests which don't exist seems like a bit of a waste, I think. No one > bothered to implement SaveResponseWithWriter at all (until it was needed), now > it's partially implemented, which seems like an improvement. Sure. But as with all things in net/, once it looks like somethings there, people will start to use it :) I'd suggest that it's fine to not implement the other bits, but use some DCHECK / NOTIMPLEMENTED() guards so that if/when tests fail - or hopefully when someone starts coding against it - they realize it's not finalized and come back and touch it more. Just the "silent failure" now is fairly subtle.
https://codereview.chromium.org/151133002/diff/20001/net/url_request/test_url... File net/url_request/test_url_fetcher_factory.cc (right): https://codereview.chromium.org/151133002/diff/20001/net/url_request/test_url... net/url_request/test_url_fetcher_factory.cc:163: scoped_refptr<IOBuffer> buffer = new StringIOBuffer(fake_response_string_); On 2014/01/31 21:03:17, Ryan Sleevi wrote: > pedantic nit: buffer(new StringIOBuffer(...)) ? Done. https://codereview.chromium.org/151133002/diff/20001/net/url_request/test_url... net/url_request/test_url_fetcher_factory.cc:166: CompletionCallback()); On 2014/01/31 22:24:57, Evan Stade wrote: > On 2014/01/31 21:03:17, Ryan Sleevi wrote: > > This doesn't fully match the URLFetcher / URLFetcherResponseWriter interface. > > > > If you're going to allow callers to supply an arbitrary URLFRW, I feel like we > > should at least try to not violate 'least surprise' here. > > > > Namely, > > > https://code.google.com/p/chromium/codesearch#chromium/src/net/url_request/ur... > > > > Write() may not write all of the data from fake_response_string_, so we should > > try to continue writing more. > > well, it has several flaws: > > a) SetResponseString must have been previously called (as opposed to being > called afterwards) > b) async Writers are not supported > c) writers that don't write all of buffer will fail (as you've noted) > > Fixing all these things would require a bit of effort. Spending effort on code > to support tests which don't exist seems like a bit of a waste, I think. No one > bothered to implement SaveResponseWithWriter at all (until it was needed), now > it's partially implemented, which seems like an improvement. Done.
net/ LGTM, although I'm a little surprised that you're optimizing down to the string level. Perhaps it's not the best datatype?
On 2014/02/01 00:46:33, Ryan Sleevi wrote: > net/ LGTM, although I'm a little surprised that you're optimizing down to the > string level. Perhaps it's not the best datatype? Thanks. Some of the strings are large. libaddressinput could use a different kind of buffer but I'm not sure what that would gain us (I'd still want to avoid copying).
+dbeam for libaddressinput
small questions before lg https://codereview.chromium.org/151133002/diff/80001/third_party/libaddressin... File third_party/libaddressinput/chromium/chrome_downloader_impl.cc (right): https://codereview.chromium.org/151133002/diff/80001/third_party/libaddressin... third_party/libaddressinput/chromium/chrome_downloader_impl.cc:22: class UnownedStringWriter : public net::URLFetcherResponseWriter { nit: BufferedStringWriter maybe? https://codereview.chromium.org/151133002/diff/80001/third_party/libaddressin... third_party/libaddressinput/chromium/chrome_downloader_impl.cc:28: data_->clear(); should we be calling the CompletionCallbacks from any of these methods? https://codereview.chromium.org/151133002/diff/80001/third_party/libaddressin... third_party/libaddressinput/chromium/chrome_downloader_impl.cc:43: private: maybe add this somewhere: // Cleared on initialization, written to a chunk at a time.
https://codereview.chromium.org/151133002/diff/80001/third_party/libaddressin... File third_party/libaddressinput/chromium/chrome_downloader_impl.cc (right): https://codereview.chromium.org/151133002/diff/80001/third_party/libaddressin... third_party/libaddressinput/chromium/chrome_downloader_impl.cc:22: class UnownedStringWriter : public net::URLFetcherResponseWriter { On 2014/02/01 00:53:33, Dan Beam wrote: > nit: BufferedStringWriter maybe? I like unowned better, I'm not sure what "BufferedString" would mean. https://codereview.chromium.org/151133002/diff/80001/third_party/libaddressin... third_party/libaddressinput/chromium/chrome_downloader_impl.cc:28: data_->clear(); On 2014/02/01 00:53:33, Dan Beam wrote: > should we be calling the CompletionCallbacks from any of these methods? no, we should not, because these operations are all synchronous. https://codereview.chromium.org/151133002/diff/80001/third_party/libaddressin... third_party/libaddressinput/chromium/chrome_downloader_impl.cc:43: private: On 2014/02/01 00:53:33, Dan Beam wrote: > maybe add this somewhere: > > // Cleared on initialization, written to a chunk at a time. I think that's easy enough to see in code; a comment has the drawback of being likely to fork from the code. And it's not like I'm inviting other clients to use this class (that's why it's in the .cc).
lgtm
lgtm
The CQ bit was checked by estade@chromium.org
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/estade@chromium.org/151133002/410002
The CQ bit was unchecked by commit-bot@chromium.org
Retried try job too often on linux_rel for step(s) base_unittests, browser_tests, interactive_ui_tests, net_unittests, unit_tests http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=linux_rel&...
CQ bit was unchecked on CL. Ignoring.
CQ bit was unchecked on CL. Ignoring.
The CQ bit was checked by estade@chromium.org
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/estade@chromium.org/151133002/410002
The CQ bit was unchecked by commit-bot@chromium.org
Retried try job too often on linux_chromeos for step(s) app_list_unittests, ash_unittests, aura_unittests, base_unittests, browser_tests, cacheinvalidation_unittests, check_deps, check_deps2git, chromeos_unittests, components_unittests, content_browsertests, content_unittests, crypto_unittests, dbus_unittests, device_unittests, events_unittests, google_apis_unittests, gpu_unittests, interactive_ui_tests, ipc_tests, jingle_unittests, media_unittests, net_unittests, ppapi_unittests, printing_unittests, sandbox_linux_unittests, sql_unittests, sync_unit_tests, unit_tests http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=linux_chro...
CQ bit was unchecked on CL. Ignoring.
CQ bit was unchecked on CL. Ignoring.
The CQ bit was checked by estade@chromium.org
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/estade@chromium.org/151133002/410002
CQ bit was unchecked on CL. Ignoring.
CQ bit was unchecked on CL. Ignoring.
CQ bit was unchecked on CL. Ignoring.
The CQ bit was checked by estade@chromium.org
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/estade@chromium.org/151133002/840001
The CQ bit was unchecked by commit-bot@chromium.org
Retried try job too often on linux_rel for step(s) cacheinvalidation_unittests, cc_unittests, check_deps, check_deps2git, chromedriver_unittests, components_unittests, content_browsertests, content_unittests, crypto_unittests, google_apis_unittests, gpu_unittests, ipc_tests, jingle_unittests, media_unittests, nacl_integration, ppapi_unittests, printing_unittests, remoting_unittests, sandbox_linux_unittests, sql_unittests, sync_integration_tests, sync_unit_tests, telemetry_perf_unittests, telemetry_unittests http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=linux_rel&...
CQ bit was unchecked on CL. Ignoring.
CQ bit was unchecked on CL. Ignoring.
The CQ bit was checked by estade@chromium.org
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/estade@chromium.org/151133002/840001
Message was sent while issue was closed.
Change committed as 248561
Message was sent while issue was closed.
CQ bit was unchecked on CL. Ignoring.
Message was sent while issue was closed.
CQ bit was unchecked on CL. Ignoring. |