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:
Daniel Martí 2019-03-21 15:20:27 +00:00
parent e698c943b3
commit b136a6267e
3 changed files with 3 additions and 11 deletions

View File

@ -67,6 +67,6 @@ func TestMain(m *testing.M) {
code := m.Run()
cancel()
FromContext(ctx).Wait()
FromContext(ctx).Allocator.Wait()
os.Exit(code)
}

View File

@ -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)

View File

@ -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: