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

Issue 14299011: Remove all but one use of WeakPtrFactory::DetachFromThread. (Closed)

Created:
7 years, 8 months ago by Wez
Modified:
7 years, 6 months ago
CC:
chromium-reviews, jamiewalch+watch_chromium.org, dcaiafa+watch_chromium.org, simonmorris+watch_chromium.org, hclam+watch_chromium.org, wez+watch_chromium.org, amit, sanjeevr, jam, gavinp+memory_chromium.org, garykac+watch_chromium.org, lambroslambrou+watch_chromium.org, stuartmorgan+watch_chromium.org, rmsousa+watch_chromium.org, alexeypa+watch_chromium.org, erikwright+watch_chromium.org, sergeyu+watch_chromium.org, kaiwang, willchan no longer on Chromium
Visibility:
Public.

Description

Remove all but one use of WeakPtrFactory::DetachFromThread. This CL changes WeakPtr in the following ways: * Changes thread-bindings semantics so that WeakPtrs only become bound when the first one is dereferenced, or the owning factory invalidates them. * Removes WeakPtrFactory::DetachFromThread. * Renames SupportsWeakPtr::DetachFromThread to DetachFromThreadHack. Calling code changes to allow this: * Unnecessary DetachFromThread() calls removed from PluginInfoMessageFilter, DhcpProxyScript[Adapter]FetcherWin and (Chromoting's) PolicyWatcherLinux. * DetachFromThread() calls rendered unnecessary by change in binding semantics removed from IOThread, SearchProviderInstallData, RuleRegistryWithCache and GLSurfaceGlx. WebGraphicsContext3DInProcessCommandBufferImpl uses the re-named DetachFromThreadHack() - bug 234964 tracks work to remove that use. BUG=232143, 234964 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=202038

Patch Set 1 #

Patch Set 2 : Remove DetachFromThread. #

Patch Set 3 : Reinstate DetachFromThread as DetachFromThreadHack, with comments. #

Patch Set 4 : Fix unit tests #

Patch Set 5 : Remove unnecessary DetachFromThread calls from DhcpProxyScript* classes. #

Patch Set 6 : Remove unnecessary DetachFromThread from UIAutomationClient #

Patch Set 7 : Update unit-tests and fix typo. #

Patch Set 8 : Reinstate HasOnRef() special-case. #

Patch Set 9 : Add text to DCHECKs and tweak example. #

Patch Set 10 : Simplify change to IOThread. #

Total comments: 4

Patch Set 11 : Address review comments. #

Patch Set 12 : Simplify threading comments. #

Total comments: 2

Patch Set 13 : Check that tests fail with the correct error. #

Patch Set 14 : Remove checks for death with correct error, which seem to fail on iOS #

Unified diffs Side-by-side diffs Delta from patch set Stats (+101 lines, -81 lines) Patch
M base/memory/weak_ptr.h View 1 2 3 4 5 6 7 8 9 10 11 7 chunks +27 lines, -28 lines 0 comments Download
M base/memory/weak_ptr.cc View 1 2 3 4 5 6 7 8 2 chunks +10 lines, -4 lines 0 comments Download
M base/memory/weak_ptr_unittest.cc View 1 2 3 4 5 6 13 6 chunks +52 lines, -8 lines 0 comments Download
M chrome/browser/extensions/api/declarative/rules_registry_with_cache.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +0 lines, -3 lines 0 comments Download
M chrome/browser/io_thread.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +0 lines, -5 lines 0 comments Download
M chrome/browser/plugins/plugin_info_message_filter.cc View 1 2 1 chunk +0 lines, -2 lines 0 comments Download
M chrome/browser/search_engines/search_provider_install_data.cc View 1 1 chunk +0 lines, -1 line 0 comments Download
M net/proxy/dhcp_proxy_script_adapter_fetcher_win.cc View 1 2 3 4 1 chunk +0 lines, -5 lines 0 comments Download
M net/proxy/dhcp_proxy_script_fetcher_win.cc View 1 2 3 4 1 chunk +0 lines, -5 lines 0 comments Download
M remoting/host/policy_hack/policy_watcher_linux.cc View 1 2 2 chunks +5 lines, -7 lines 0 comments Download
M ui/gl/gl_surface_glx.cc View 1 1 chunk +0 lines, -3 lines 0 comments Download
M webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 2 chunks +6 lines, -5 lines 0 comments Download
M win8/test/ui_automation_client.cc View 1 2 3 4 5 6 7 8 1 chunk +1 line, -5 lines 0 comments Download

Messages

Total messages: 16 (0 generated)
Wez
PTAL It looks like DetachFromThread can disappear except for one non-trivial use in WebGraphicsContext3D, which ...
7 years, 8 months ago (2013-04-17 02:22:31 UTC) #1
Peter Kasting
On 2013/04/17 02:22:31, Wez wrote: > However, it does require a change to have WeakPtr[Factory] ...
7 years, 8 months ago (2013-04-17 02:27:39 UTC) #2
Wez
On 2013/04/17 02:27:39, Peter Kasting wrote: > On 2013/04/17 02:22:31, Wez wrote: > > However, ...
7 years, 8 months ago (2013-04-17 02:39:15 UTC) #3
Wez
I've updated this CL to land pending removal of the DetachFromThread call from the 3D ...
7 years, 7 months ago (2013-05-10 00:40:41 UTC) #4
Wez
Albert, PTAL!
7 years, 7 months ago (2013-05-15 00:59:50 UTC) #5
awong
https://codereview.chromium.org/14299011/diff/31016/base/memory/weak_ptr.h File base/memory/weak_ptr.h (right): https://codereview.chromium.org/14299011/diff/31016/base/memory/weak_ptr.h#newcode22 base/memory/weak_ptr.h:22: // // Member variables should appear before the WeakPtrFactory. ...
7 years, 7 months ago (2013-05-15 01:19:15 UTC) #6
Wez
https://chromiumcodereview.appspot.com/14299011/diff/31016/base/memory/weak_ptr.h File base/memory/weak_ptr.h (right): https://chromiumcodereview.appspot.com/14299011/diff/31016/base/memory/weak_ptr.h#newcode22 base/memory/weak_ptr.h:22: // // Member variables should appear before the WeakPtrFactory. ...
7 years, 7 months ago (2013-05-15 22:51:50 UTC) #7
Wez
PTAL - have tried to simplify the threading comments.
7 years, 7 months ago (2013-05-17 04:47:53 UTC) #8
awong
One more comment but looking good. https://codereview.chromium.org/14299011/diff/52001/base/memory/weak_ptr_unittest.cc File base/memory/weak_ptr_unittest.cc (right): https://codereview.chromium.org/14299011/diff/52001/base/memory/weak_ptr_unittest.cc#newcode541 base/memory/weak_ptr_unittest.cc:541: ASSERT_DEATH(delete foo, ""); ...
7 years, 7 months ago (2013-05-17 19:02:31 UTC) #9
Wez
https://codereview.chromium.org/14299011/diff/52001/base/memory/weak_ptr_unittest.cc File base/memory/weak_ptr_unittest.cc (right): https://codereview.chromium.org/14299011/diff/52001/base/memory/weak_ptr_unittest.cc#newcode541 base/memory/weak_ptr_unittest.cc:541: ASSERT_DEATH(delete foo, ""); On 2013/05/17 19:02:32, awong wrote: > ...
7 years, 7 months ago (2013-05-18 07:02:35 UTC) #10
Wez
darin, could you provide the uber-LGTM for this, please?
7 years, 7 months ago (2013-05-20 02:13:36 UTC) #11
awong
LGTM Looks like the death tests might be causing an issue on IOS. I'd prefer ...
7 years, 7 months ago (2013-05-21 21:53:47 UTC) #12
darin (slow to review)
LGTM
7 years, 7 months ago (2013-05-23 22:27:46 UTC) #13
Wez
On 2013/05/21 21:53:47, awong wrote: > LGTM > > Looks like the death tests might ...
7 years, 7 months ago (2013-05-24 06:21:27 UTC) #14
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/wez@chromium.org/14299011/71001
7 years, 7 months ago (2013-05-24 06:21:56 UTC) #15
commit-bot: I haz the power
7 years, 7 months ago (2013-05-24 09:51:38 UTC) #16
Message was sent while issue was closed.
Change committed as 202038

Powered by Google App Engine
This is Rietveld 408576698