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

Issue 805043006: IndexedDB: ParseMethodAndError takes a leveldb::Status instance. (Closed)

Created:
6 years ago by cmumford
Modified:
6 years ago
Reviewers:
dgrogan
CC:
chromium-reviews, darin-cc_chromium.org, jsbell+idb_chromium.org, jam
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

IndexedDB: ParseMethodAndError takes a leveldb::Status instance. ParseMethodAndError took a string as first param, but all callers started with a Status object from which they derived the string. Simplified impl by just passing in the Status object. Committed: https://crrev.com/5d9f56995bdb98020897b0ade57e27c424b56fd9 Cr-Commit-Position: refs/heads/master@{#308465}

Patch Set 1 #

Total comments: 3

Patch Set 2 : str -> status_string #

Unified diffs Side-by-side diffs Delta from patch set Stats (+19 lines, -17 lines) Patch
M content/browser/indexed_db/leveldb/leveldb_database.cc View 1 chunk +1 line, -1 line 0 comments Download
M third_party/leveldatabase/env_chromium.h View 1 chunk +1 line, -1 line 0 comments Download
M third_party/leveldatabase/env_chromium.cc View 1 3 chunks +14 lines, -10 lines 0 comments Download
M third_party/leveldatabase/env_chromium_unittest.cc View 3 chunks +3 lines, -5 lines 0 comments Download

Messages

Total messages: 11 (2 generated)
cmumford
Just a change for code cleanup - no bug fixing.
6 years ago (2014-12-15 21:44:26 UTC) #2
dgrogan
lgtm just nits https://codereview.chromium.org/805043006/diff/1/third_party/leveldatabase/env_chromium.cc File third_party/leveldatabase/env_chromium.cc (right): https://codereview.chromium.org/805043006/diff/1/third_party/leveldatabase/env_chromium.cc#newcode414 third_party/leveldatabase/env_chromium.cc:414: std::string str = status.ToString(); Change the ...
6 years ago (2014-12-15 21:55:30 UTC) #3
cmumford
https://codereview.chromium.org/805043006/diff/1/third_party/leveldatabase/env_chromium.cc File third_party/leveldatabase/env_chromium.cc (right): https://codereview.chromium.org/805043006/diff/1/third_party/leveldatabase/env_chromium.cc#newcode414 third_party/leveldatabase/env_chromium.cc:414: std::string str = status.ToString(); On 2014/12/15 21:55:30, dgrogan wrote: ...
6 years ago (2014-12-15 22:26:11 UTC) #4
dgrogan
https://codereview.chromium.org/805043006/diff/1/third_party/leveldatabase/env_chromium.cc File third_party/leveldatabase/env_chromium.cc (right): https://codereview.chromium.org/805043006/diff/1/third_party/leveldatabase/env_chromium.cc#newcode414 third_party/leveldatabase/env_chromium.cc:414: std::string str = status.ToString(); On 2014/12/15 22:26:11, cmumford wrote: ...
6 years ago (2014-12-15 22:31:48 UTC) #5
cmumford
On 2014/12/15 22:31:48, dgrogan wrote: > https://codereview.chromium.org/805043006/diff/1/third_party/leveldatabase/env_chromium.cc > File third_party/leveldatabase/env_chromium.cc (right): > > https://codereview.chromium.org/805043006/diff/1/third_party/leveldatabase/env_chromium.cc#newcode414 > ...
6 years ago (2014-12-15 23:05:38 UTC) #6
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/805043006/20001
6 years ago (2014-12-15 23:07:43 UTC) #8
commit-bot: I haz the power
Committed patchset #2 (id:20001)
6 years ago (2014-12-16 00:05:06 UTC) #9
commit-bot: I haz the power
Patchset 2 (id:??) landed as https://crrev.com/5d9f56995bdb98020897b0ade57e27c424b56fd9 Cr-Commit-Position: refs/heads/master@{#308465}
6 years ago (2014-12-16 00:05:57 UTC) #10
dgrogan
6 years ago (2014-12-18 00:28:36 UTC) #11
Message was sent while issue was closed.
On 2014/12/15 23:05:38, cmumford wrote:
> On 2014/12/15 22:31:48, dgrogan wrote:
> >
>
https://codereview.chromium.org/805043006/diff/1/third_party/leveldatabase/en...
> > File third_party/leveldatabase/env_chromium.cc (right):
> > 
> >
>
https://codereview.chromium.org/805043006/diff/1/third_party/leveldatabase/en...
> > third_party/leveldatabase/env_chromium.cc:414: std::string str =
> > status.ToString();
> > On 2014/12/15 22:26:11, cmumford wrote:
> > > On 2014/12/15 21:55:30, dgrogan wrote:
> > > > Change the variable name so status_string, or something more descriptive
> > than
> > > > "str".
> > > > 
> > > > Also, since you call c_str() on this everywhere that it's used, maybe
you
> > want
> > > > to change this to a char*?
> > > 
> > > I renamed it to "status_string". I couldn't make it a char* because it
would
> > > point to a temporary stack result (ToString's return value). Let me know
if
> I
> > > misunderstood your request.
> > 
> > I think you understood it but now I'm confused. Won't ToString's return
value
> > exist for the duration of this function call? As in, I could understand not
> > wanting to return the char* from this function, but just using it internally
> > should be fine.
> > 
> > In any case, this is trivial, so feel free to submit.
> 
> I am pressing the commit button.
> 
> just to complete the discussion thread this code:
> 
> const char* const status_string = status.ToString().c_str();
> 
> Will return back a pointer to a string in heap owned by a temporary variable
> which was deleted just after operator= returns.

Yes, you are quite right. How have I written so much C++ without knowing when
the temporary is deleted...

Powered by Google App Engine
This is Rietveld 408576698