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

Issue 11112020: Allow multiple sql::Connection error delegates. (Closed)

Created:
8 years, 2 months ago by Scott Hess - ex-Googler
Modified:
7 years, 1 month ago
CC:
chromium-reviews, erikwright (departed), cbentzel+watch_chromium.org, darin-cc_chromium.org, wtc, rkn
Visibility:
Public.

Description

[Closing because I think later developments obsoleted this.] Allow multiple sql::Connection error delegates. This seems like a cleaner solution than chaining. BUG=none

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+43 lines, -22 lines) Patch
M chrome/browser/net/sqlite_persistent_cookie_store.cc View 5 chunks +5 lines, -13 lines 0 comments Download
M sql/connection.h View 3 chunks +31 lines, -7 lines 0 comments Download
M sql/connection.cc View 1 chunk +7 lines, -2 lines 0 comments Download

Messages

Total messages: 2 (0 generated)
erikwright (departed)
Can you express what's wrong with composition via wrapping? Having a list of error observers ...
8 years, 2 months ago (2012-10-12 18:59:28 UTC) #1
Scott Hess - ex-Googler
8 years, 2 months ago (2012-10-12 19:41:17 UTC) #2
On 2012/10/12 18:59:28, erikwright wrote:
> Can you express what's wrong with composition via wrapping?
> 
> Allowing clients to compose an error delegate according to their needs seems
> safer and perfectly reasonable.

Wrapping is implicitly nested, so the earlier items cannot safely remove
themselves from the chain.  Wrapping messes with the ownership hierarchy (the
connection and all other refs could be removed, but the wrapper itself could
maintain a ref to the original handler, and have a distinct lifetime). 
Intrusively wrapping the original handler can break assumptions in the original
handler.

> Having a list of error observers implies that you have some protocol for how
you
> call them in order. And what happens if one of them acts to resolve the
problem,
> etc?

Wait, what?  It's exactly the same as your wrapped version, it's forwarded until
someone handles it.

As I said elsewhere, it would maybe be more satisfying to just have the
single-level delegate adapt to do all the jobs necessary.  I generally am
against the pattern of registering arbitrary interest all over the place, like
notifications and observers.  If I had time I'd just inline the histogram stuff
directly (sql::Connection could have a histogram prefix), which would get rid of
damn near all of the existing delegates.

Powered by Google App Engine
This is Rietveld 408576698