remove Context's Wait method for now
All it did was wait on the entire allocator, which is confusing. From the user's perspective, this wait method should instead wait for the resources for its own browser, and not any other browsers sharing the same allocator. We haven't decided how to integrate that into our API, so simply replace it with Allocator.Wait.
This commit is contained in:
parent
e698c943b3
commit
b136a6267e
|
@ -67,6 +67,6 @@ func TestMain(m *testing.M) {
|
|||
code := m.Run()
|
||||
|
||||
cancel()
|
||||
FromContext(ctx).Wait()
|
||||
FromContext(ctx).Allocator.Wait()
|
||||
os.Exit(code)
|
||||
}
|
||||
|
|
|
@ -28,14 +28,6 @@ type Context struct {
|
|||
sessionID target.SessionID
|
||||
}
|
||||
|
||||
// Wait can be called after cancelling the context containing Context, to block
|
||||
// until all the underlying resources have been cleaned up.
|
||||
func (c *Context) Wait() {
|
||||
if c.Allocator != nil {
|
||||
c.Allocator.Wait()
|
||||
}
|
||||
}
|
||||
|
||||
// NewContext creates a browser context using the parent context.
|
||||
func NewContext(parent context.Context, opts ...ContextOption) (context.Context, context.CancelFunc) {
|
||||
ctx, cancel := context.WithCancel(parent)
|
||||
|
|
|
@ -26,7 +26,7 @@ func ExampleTitle() {
|
|||
|
||||
// wait for the resources to be cleaned up
|
||||
cancel()
|
||||
chromedp.FromContext(ctx).Wait()
|
||||
chromedp.FromContext(ctx).Allocator.Wait()
|
||||
|
||||
// Output:
|
||||
// Issues · chromedp/chromedp · GitHub
|
||||
|
@ -70,7 +70,7 @@ func ExampleExecAllocatorOption() {
|
|||
|
||||
// wait for the resources to be cleaned up
|
||||
cancel()
|
||||
chromedp.FromContext(allocCtx).Wait()
|
||||
chromedp.FromContext(allocCtx).Allocator.Wait()
|
||||
|
||||
// Output:
|
||||
// Files in UserDataDir:
|
||||
|
|
Loading…
Reference in New Issue
Block a user